libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

IStorageBackend Class Reference

IStorageBackend Class Reference

This interface is used by the server to read and write stable storage. More...

#include <storage_backend.hpp>

Inherited by MemoryStorageBackend, and FileStorageBackend.

Public Types

enum  
 

Maximum length of keys and values.

More...
enum  
 

It is guaranteed that the server will never require more than this number of key/value pairs.

More...
typedef MakeString
< MaxStringLength >::Type 
String
 This type is used to exchange data chunks with the backend.

Public Member Functions

virtual String get (const String &key) const =0
 Read one value from the storage.
virtual void set (const String &key, const String &value)=0
 Create or update value for the given key.

Detailed Description

This interface is used by the server to read and write stable storage.

The storage is represented as a key-value container, where keys and values are ASCII strings up to 32 characters long, not including the termination byte. Fixed block size allows for absolutely straightforward and efficient implementation of storage backends, e.g. based on text files. Keys and values may contain only non-whitespace, non-formatting printable characters.

Definition at line 22 of file storage_backend.hpp.


Member Typedef Documentation

typedef MakeString<MaxStringLength>::Type String

This type is used to exchange data chunks with the backend.

It doesn't use any dynamic memory; please refer to the Array<> class for details.

Definition at line 40 of file storage_backend.hpp.


Member Enumeration Documentation

anonymous enum

Maximum length of keys and values.

One pair takes twice as much space.

Definition at line 28 of file storage_backend.hpp.

anonymous enum

It is guaranteed that the server will never require more than this number of key/value pairs.

Total storage space needed is (MaxKeyValuePairs * MaxStringLength * 2), not including storage overhead.

Definition at line 34 of file storage_backend.hpp.


Member Function Documentation

virtual String get ( const String key ) const [pure virtual]

Read one value from the storage.

If such key does not exist, or if read failed, an empty string will be returned. This method should not block for more than 50 ms.

Implemented in FileStorageBackend.

virtual void set ( const String key,
const String value 
) [pure virtual]

Create or update value for the given key.

Empty value should be regarded as a request to delete the key. This method should not block for more than 50 ms. Failures will be ignored.

Implemented in FileStorageBackend.