libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

FileStorageBackend Class Reference

FileStorageBackend Class Reference

This interface implements a POSIX compliant IStorageBackend interface. More...

#include <file_storage_backend.hpp>

Inherits uavcan::dynamic_node_id_server::IStorageBackend.

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

int init (const PathString &path)
 Initializes the file based backend storage by passing a path to the directory where the key named files will be stored.

Protected Member Functions

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

Detailed Description

This interface implements a POSIX compliant IStorageBackend interface.

Definition at line 30 of file file_storage_backend.hpp.


Member Typedef Documentation

typedef MakeString<MaxStringLength>::Type String [inherited]

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 [inherited]

Maximum length of keys and values.

One pair takes twice as much space.

Definition at line 28 of file storage_backend.hpp.

anonymous enum [inherited]

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 [protected, 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.

Implements IStorageBackend.

Definition at line 47 of file file_storage_backend.hpp.

int init ( const PathString path )

Initializes the file based backend storage by passing a path to the directory where the key named files will be stored.

The return value should be 0 on success. If it is -ErrInvalidConfiguration then the the path name is too long to accommodate the trailing slash and max key length.

Definition at line 123 of file file_storage_backend.hpp.

virtual void set ( const String key,
const String value 
) [protected, 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.

Implements IStorageBackend.

Definition at line 88 of file file_storage_backend.hpp.