xmltooling
3.3.0
|
Generic data storage facility for use by services that require some degree of persistence. More...
#include <xmltooling/util/StorageService.h>
Classes | |
class | Capabilities |
Public Member Functions | |
virtual const Capabilities & | getCapabilities () const |
Returns the capabilities of the underlying service. More... | |
virtual bool | createString (const char *context, const char *key, const char *value, time_t expiration)=0 |
Creates a new "short" record in the storage service. More... | |
virtual int | readString (const char *context, const char *key, std::string *pvalue=0, time_t *pexpiration=0, int version=0)=0 |
Returns an existing "short" record from the storage service. More... | |
virtual int | updateString (const char *context, const char *key, const char *value=0, time_t expiration=0, int version=0)=0 |
Updates an existing "short" record in the storage service. More... | |
virtual bool | deleteString (const char *context, const char *key)=0 |
Deletes an existing "short" record from the storage service. More... | |
virtual bool | createText (const char *context, const char *key, const char *value, time_t expiration)=0 |
Creates a new "long" record in the storage service. More... | |
virtual int | readText (const char *context, const char *key, std::string *pvalue=0, time_t *pexpiration=0, int version=0)=0 |
Returns an existing "long" record from the storage service. More... | |
virtual int | updateText (const char *context, const char *key, const char *value=0, time_t expiration=0, int version=0)=0 |
Updates an existing "long" record in the storage service. More... | |
virtual bool | deleteText (const char *context, const char *key)=0 |
Deletes an existing "long" record from the storage service. More... | |
virtual void | reap (const char *context)=0 |
Manually trigger a cleanup of expired records. More... | |
virtual void | updateContext (const char *context, time_t expiration)=0 |
Updates the expiration time of all records in the context. More... | |
virtual void | deleteContext (const char *context)=0 |
Forcibly removes all records in a given context along with any associated resources devoted to maintaining the context. More... | |
Generic data storage facility for use by services that require some degree of persistence.
Implementations will vary in how much persistence they can supply.
Storage is divided into "contexts" identified by a string label. Keys need to be unique only within a given context, so multiple components can share a single storage service safely as long as they use different labels.
The allowable sizes for contexts, keys, and short values can vary and be reported by the implementation to callers, but MUST be at least 255 bytes.
|
pure virtual |
Creates a new "short" record in the storage service.
context | a storage context label |
key | null-terminated unique key |
value | null-terminated value |
expiration | an expiration timestamp, after which the record can be purged |
IOException | raised if fatal errors occur in the insertion process |
|
pure virtual |
Creates a new "long" record in the storage service.
context | a storage context label |
key | null-terminated unique key |
value | null-terminated value of arbitrary length |
expiration | an expiration timestamp, after which the record can be purged |
IOException | raised if errors occur in the insertion process |
|
pure virtual |
Forcibly removes all records in a given context along with any associated resources devoted to maintaining the context.
context | a storage context label |
|
pure virtual |
Deletes an existing "short" record from the storage service.
context | a storage context label |
key | null-terminated unique key |
IOException | raised if errors occur in the deletion process |
|
pure virtual |
Deletes an existing "long" record from the storage service.
context | a storage context label |
key | null-terminated unique key |
IOException | raised if errors occur in the deletion process |
|
virtual |
Returns the capabilities of the underlying service.
If implementations support only the 255 character minimum, the default implementation of this method will suffice.
|
pure virtual |
Returns an existing "short" record from the storage service.
The version parameter can be set for "If-Modified-Since" semantics.
context | a storage context label |
key | null-terminated unique key |
pvalue | location in which to return the record value |
pexpiration | location in which to return the expiration timestamp |
version | if > 0, only copy back data if newer than supplied version (the expiration time is copied back regardless) |
IOException | raised if errors occur in the read process |
|
pure virtual |
Returns an existing "long" record from the storage service.
The version parameter can be set for "If-Modified-Since" semantics.
context | a storage context label |
key | null-terminated unique key |
pvalue | location in which to return the record value |
pexpiration | location in which to return the expiration timestamp |
version | if > 0, only copy back data if newer than supplied version |
IOException | raised if errors occur in the read process |
|
pure virtual |
Manually trigger a cleanup of expired records.
The method MAY return without guaranteeing that cleanup has already occurred.
context | a storage context label |
|
pure virtual |
Updates the expiration time of all records in the context.
context | a storage context label |
expiration | a new expiration timestamp |
|
pure virtual |
Updates an existing "short" record in the storage service.
context | a storage context label |
key | null-terminated unique key |
value | null-terminated value to store, or nullptr to leave alone |
expiration | a new expiration timestamp, or 0 to leave alone |
version | if > 0, only update if the current version matches this value |
IOException | raised if errors occur in the update process |
|
pure virtual |
Updates an existing "long" record in the storage service.
context | a storage context label |
key | null-terminated unique key |
value | null-terminated value of arbitrary length to store, or nullptr to leave alone |
expiration | a new expiration timestamp, or 0 to leave alone |
version | if > 0, only update if the current version matches this value |
IOException | raised if errors occur in the update process |