10#ifndef __BE_IO_RECORDSTORE_H__
11#define __BE_IO_RECORDSTORE_H__
18#include <be_framework_enumeration.h>
20#include <be_memory_autoarray.h>
27namespace BiometricEvaluation {
30 class RecordStoreIterator;
68 const std::string &key,
140 const std::string &pathname) = 0;
151 const std::string &description) = 0;
199 const std::string &key,
222 const std::string &key,
223 const void *
const data,
224 const uint64_t size) = 0;
238 const std::string &key) = 0;
259 const std::string &key)
const = 0;
277 const std::string &key,
298 const std::string &key,
299 const void *
const data,
300 const uint64_t size);
316 const std::string &key)
const = 0;
329 const std::string &key)
const = 0;
410 const std::string &key) = 0;
426 const std::string &key)
452 const std::
string &pathname);
481 const std::
string &pathname,
482 IO::Mode mode = Mode::ReadOnly);
509 const std::
string &pathname,
510 const std::
string &description,
526 const std::
string &pathname);
555 const std::
string &mergePathname,
556 const std::
string &description,
558 const std::vector<std::
string> &pathnames,
559 const std::function<
bool()> &interrupt =
560 []() {
return (
false);});
718 return (!(*
this == rhs));
761BE_FRAMEWORK_ENUMERATION_DECLARATIONS(
763 BE_IO_RecordStore_Kind_EnumToStringMap);
A class to represent a data storage mechanism.
Definition: be_io_recordstore.h:51
static std::shared_ptr< RecordStore > openRecordStore(const std::string &pathname, IO::Mode mode=Mode::ReadOnly)
Open an existing RecordStore and return a managed pointer to the the object representing that store.
virtual void setCursorAtKey(const std::string &key)=0
Set the sequence cursor to an arbitrary position within the RecordStore, starting at key.
virtual std::string getDescription() const =0
Obtain a textual description of the RecordStore.
virtual void changeDescription(const std::string &description)=0
Change the description of the RecordStore.
virtual void insert(const std::string &key, const Memory::uint8Array &data)
Insert a record into the store.
static const std::string INVALIDKEYCHARS
The set of prohibited characters in a key: '/', '\', '*', '&'.
Definition: be_io_recordstore.h:101
virtual void remove(const std::string &key)=0
Remove a record from the store.
static const int BE_RECSTORE_SEQ_START
Tell sequence() to sequence from beginning.
Definition: be_io_recordstore.h:332
static bool isRecordStore(const std::string &pathname)
Determine if a location appears to be a RecordStore.
virtual uint64_t length(const std::string &key) const =0
Return the length of a record.
virtual iterator begin() noexcept
virtual bool containsKey(const std::string &key) const
Determines whether the RecordStore contains an element with the specified key.
virtual std::string sequenceKey(int cursor=BE_RECSTORE_SEQ_NEXT)=0
Sequence through a RecordStore, returning the key.
virtual void flush(const std::string &key) const =0
Commit the record's data to storage.
Kind
Possible types of RecordStore.
Definition: be_io_recordstore.h:79
@ SQLite
SQLiteRecordStore.
@ Compressed
CompressedRecordStore.
@ Default
"Default" RecordStore kind
@ Archive
ArchiveRecordStore.
@ BerkeleyDB
DBRecordStore.
virtual uint64_t getSpaceUsed() const =0
Obtain real storage utilization.
static const int BE_RECSTORE_SEQ_NEXT
Tell sequence to sequence from current position.
Definition: be_io_recordstore.h:334
virtual void replace(const std::string &key, const void *const data, const uint64_t size)
Replace a complete record in a RecordStore.
virtual std::string getPathname() const =0
Return the path name of the RecordStore.
virtual void sync() const =0
Synchronize the entire record store to persistent storage.
virtual void move(const std::string &pathname)=0
Move the RecordStore.
virtual unsigned int getCount() const =0
Obtain the number of items in the RecordStore.
virtual iterator end() noexcept
virtual RecordStore::Record sequence(int cursor=BE_RECSTORE_SEQ_NEXT)=0
Sequence through a RecordStore, returning the key/data pairs.
virtual void replace(const std::string &key, const Memory::uint8Array &data)
Replace a complete record in a RecordStore.
static std::shared_ptr< RecordStore > createRecordStore(const std::string &pathname, const std::string &description, const IO::RecordStore::Kind &kind)
Create a new RecordStore and return a managed pointer to the the object representing that store.
static void mergeRecordStores(const std::string &mergePathname, const std::string &description, const IO::RecordStore::Kind &kind, const std::vector< std::string > &pathnames, const std::function< bool()> &interrupt=[]() {return(false);})
Create a new RecordStore that contains the contents of several other RecordStores.
virtual void insert(const std::string &key, const void *const data, const uint64_t size)=0
Insert a record into the store.
virtual Memory::uint8Array read(const std::string &key) const =0
Read a complete record from a store.
static void removeRecordStore(const std::string &pathname)
Remove a RecordStore by deleting all persistant data associated with the store.
Generic ForwardIterator for all RecordStores.
Definition: be_io_recordstore.h:580
RecordStoreIterator operator+(difference_type rhs)
Advance a variable number of arguments.
RecordStoreIterator(RecordStoreIterator &&rvalue)=default
Default move constructor.
RecordStoreIterator operator++(int)
RecordStoreIterator(const RecordStoreIterator &rhs)=default
Default copy constructor.
RecordStoreIterator()=default
Default constructor.
RecordStoreIterator & operator=(RecordStoreIterator &&rhs)=default
Default move assignment operator.
bool operator!=(const RecordStoreIterator &rhs)
Non-equivalence operator.
Definition: be_io_recordstore.h:715
RecordStoreIterator operator+=(difference_type rhs)
Advance a variable number of arguments.
RecordStoreIterator(IO::RecordStore *recordStore, bool atEnd)
Constructor.
std::forward_iterator_tag iterator_category
Type of iterator.
Definition: be_io_recordstore.h:587
bool operator==(const RecordStoreIterator &rhs)
Equivalence operator.
RecordStoreIterator & operator++()
std::ptrdiff_t difference_type
Type used to measure distance between iterators.
Definition: be_io_recordstore.h:591
~RecordStoreIterator()=default
Default destructor.
RecordStore::Record value_type
Type when dereferencing iterators.
Definition: be_io_recordstore.h:589
A C-style array wrapped in the facade of a C++ STL container.
Definition: be_memory_autoarray.h:45
Definition: be_io_recordstore.h:53
Record()
Default constructor.
Record(const std::string &key, const Memory::uint8Array &data)
Create a Record from the key and data.