mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Squash code from OperationResultCallback into ResultCallback
This commit is contained in:
parent
cd66b32428
commit
e5b06367f7
12 changed files with 62 additions and 91 deletions
|
@ -34,7 +34,7 @@ OperationResult StorageDummy::DoOpen(OpenResultCallback* cb, RecordValPtr option
|
|||
/**
|
||||
* Finalizes the backend when it's being closed.
|
||||
*/
|
||||
OperationResult StorageDummy::DoClose(OperationResultCallback* cb) {
|
||||
OperationResult StorageDummy::DoClose(ResultCallback* cb) {
|
||||
open = false;
|
||||
return {ReturnCode::SUCCESS};
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ OperationResult StorageDummy::DoClose(OperationResultCallback* cb) {
|
|||
/**
|
||||
* The workhorse method for Put(). This must be implemented by plugins.
|
||||
*/
|
||||
OperationResult StorageDummy::DoPut(OperationResultCallback* cb, ValPtr key, ValPtr value, bool overwrite,
|
||||
OperationResult StorageDummy::DoPut(ResultCallback* cb, ValPtr key, ValPtr value, bool overwrite,
|
||||
double expiration_time) {
|
||||
auto json_key = key->ToJSON()->ToStdString();
|
||||
auto json_value = value->ToJSON()->ToStdString();
|
||||
|
@ -53,7 +53,7 @@ OperationResult StorageDummy::DoPut(OperationResultCallback* cb, ValPtr key, Val
|
|||
/**
|
||||
* The workhorse method for Get(). This must be implemented for plugins.
|
||||
*/
|
||||
OperationResult StorageDummy::DoGet(OperationResultCallback* cb, ValPtr key) {
|
||||
OperationResult StorageDummy::DoGet(ResultCallback* cb, ValPtr key) {
|
||||
auto json_key = key->ToJSON();
|
||||
auto it = data.find(json_key->ToStdString());
|
||||
if ( it == data.end() )
|
||||
|
@ -71,7 +71,7 @@ OperationResult StorageDummy::DoGet(OperationResultCallback* cb, ValPtr key) {
|
|||
/**
|
||||
* The workhorse method for Erase(). This must be implemented for plugins.
|
||||
*/
|
||||
OperationResult StorageDummy::DoErase(OperationResultCallback* cb, ValPtr key) {
|
||||
OperationResult StorageDummy::DoErase(ResultCallback* cb, ValPtr key) {
|
||||
auto json_key = key->ToJSON();
|
||||
auto it = data.find(json_key->ToStdString());
|
||||
if ( it == data.end() )
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
/**
|
||||
* Finalizes the backend when it's being closed.
|
||||
*/
|
||||
zeek::storage::OperationResult DoClose(zeek::storage::OperationResultCallback* cb = nullptr) override;
|
||||
zeek::storage::OperationResult DoClose(zeek::storage::ResultCallback* cb = nullptr) override;
|
||||
|
||||
/**
|
||||
* Returns whether the backend is opened.
|
||||
|
@ -36,19 +36,18 @@ public:
|
|||
/**
|
||||
* The workhorse method for Put().
|
||||
*/
|
||||
zeek::storage::OperationResult DoPut(zeek::storage::OperationResultCallback* cb, zeek::ValPtr key,
|
||||
zeek::ValPtr value, bool overwrite = true,
|
||||
double expiration_time = 0) override;
|
||||
zeek::storage::OperationResult DoPut(zeek::storage::ResultCallback* cb, zeek::ValPtr key, zeek::ValPtr value,
|
||||
bool overwrite = true, double expiration_time = 0) override;
|
||||
|
||||
/**
|
||||
* The workhorse method for Get().
|
||||
*/
|
||||
zeek::storage::OperationResult DoGet(zeek::storage::OperationResultCallback* cb, zeek::ValPtr key) override;
|
||||
zeek::storage::OperationResult DoGet(zeek::storage::ResultCallback* cb, zeek::ValPtr key) override;
|
||||
|
||||
/**
|
||||
* The workhorse method for Erase().
|
||||
*/
|
||||
zeek::storage::OperationResult DoErase(zeek::storage::OperationResultCallback* cb, zeek::ValPtr key) override;
|
||||
zeek::storage::OperationResult DoErase(zeek::storage::ResultCallback* cb, zeek::ValPtr key) override;
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue