mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Rearrange visibility of Backend methods, add DoPoll/DoExpire, add return comments
This commit is contained in:
parent
cc7b2dc890
commit
99160f8fcd
5 changed files with 40 additions and 96 deletions
|
@ -112,7 +112,7 @@ public:
|
|||
* Optional method to allow a backend to poll for data. This can be used to
|
||||
* mimic sync mode even if the backend only supports async.
|
||||
*/
|
||||
virtual void Poll() {}
|
||||
void Poll() { DoPoll(); }
|
||||
|
||||
const RecordValPtr& Options() const { return backend_options; }
|
||||
|
||||
|
@ -156,37 +156,11 @@ protected:
|
|||
*/
|
||||
OperationResult Close(OperationResultCallback* cb = nullptr);
|
||||
|
||||
/**
|
||||
* The workhorse method for Open().
|
||||
*/
|
||||
virtual OperationResult DoOpen(RecordValPtr options, OpenResultCallback* cb = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* The workhorse method for Close().
|
||||
*/
|
||||
virtual OperationResult DoClose(OperationResultCallback* cb = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* The workhorse method for Put().
|
||||
*/
|
||||
virtual OperationResult DoPut(ValPtr key, ValPtr value, bool overwrite = true, double expiration_time = 0,
|
||||
OperationResultCallback* cb = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* The workhorse method for Get().
|
||||
*/
|
||||
virtual OperationResult DoGet(ValPtr key, OperationResultCallback* cb = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* The workhorse method for Erase().
|
||||
*/
|
||||
virtual OperationResult DoErase(ValPtr key, OperationResultCallback* cb = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* Removes any entries in the backend that have expired. Can be overridden by
|
||||
* derived classes.
|
||||
*/
|
||||
virtual void Expire() {}
|
||||
void Expire() { DoExpire(); }
|
||||
|
||||
/**
|
||||
* Enqueues the Storage::backend_opened event. This is called automatically
|
||||
|
@ -210,6 +184,15 @@ protected:
|
|||
std::string tag;
|
||||
|
||||
private:
|
||||
virtual OperationResult DoOpen(RecordValPtr options, OpenResultCallback* cb = nullptr) = 0;
|
||||
virtual OperationResult DoClose(OperationResultCallback* cb = nullptr) = 0;
|
||||
virtual OperationResult DoPut(ValPtr key, ValPtr value, bool overwrite = true, double expiration_time = 0,
|
||||
OperationResultCallback* cb = nullptr) = 0;
|
||||
virtual OperationResult DoGet(ValPtr key, OperationResultCallback* cb = nullptr) = 0;
|
||||
virtual OperationResult DoErase(ValPtr key, OperationResultCallback* cb = nullptr) = 0;
|
||||
virtual void DoPoll() {}
|
||||
virtual void DoExpire() {}
|
||||
|
||||
uint8_t modes;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue