NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_io_archiverecstore.h
Go to the documentation of this file.
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#ifndef __BE_ARCHIVERECSTORE_H__
12#define __BE_ARCHIVERECSTORE_H__
13
14#include <be_io_recordstore.h>
15
16namespace BiometricEvaluation {
17 namespace IO {
44 public:
46 static const std::string MANIFEST_FILE_NAME;
48 static const std::string ARCHIVE_FILE_NAME;
49
65 const std::string &pathname,
66 const std::string &description);
67
83 const std::string &pathname,
85
90
91 /*
92 * Implementations of RecordStore methods.
93 */
94
95 /*
96 * We need the base class insert() and replace() as well
97 * otherwise, they are hidden by the declarations below.
98 */
101
102 void sync() const override;
103
104 void insert(
105 const std::string &key,
106 const void *const data,
107 const uint64_t size)
108 override;
109
110 void remove(
111 const std::string &key)
112 override;
113
115 const std::string &key) const override;
116
117 uint64_t length(
118 const std::string &key) const override;
119
120 void flush(
121 const std::string &key) const override;
122
124 int cursor = BE_RECSTORE_SEQ_NEXT)
125 override;
126
127 std::string
129 int cursor = BE_RECSTORE_SEQ_NEXT)
130 override;
131
133 const std::string &key)
134 override;
135
136 void move(
137 const std::string &pathname)
138 override;
139
140 uint64_t getSpaceUsed() const override;
141 unsigned int getCount() const override;
142 std::string getPathname() const override;
143 std::string getDescription() const override;
145 const std::string &description) override;
146
157
174 static bool needsVacuum(
175 const std::string &pathname);
176
191 static void vacuum(
192 const std::string &pathname);
193
201 std::string getArchiveName() const;
202
210 std::string getManifestName() const;
211
213 static const long OFFSET_RECORD_REMOVED = -1;
214
215 /* Prevent copying of ArchiveRecordStore objects */
219 const ArchiveRecordStore&) = delete;
220
221 private:
222 class Impl;
223 std::unique_ptr<ArchiveRecordStore::Impl> pimpl;
224 };
225 }
226}
227
228#endif /* __BE_ARCHIVERECSTORE_H__ */
229
This class implements the IO::RecordStore interface by storing data items in single file,...
unsigned int getCount() const override
Obtain the number of items in the RecordStore.
void changeDescription(const std::string &description) override
Change the description of the RecordStore.
void move(const std::string &pathname) override
Move the RecordStore.
static const long OFFSET_RECORD_REMOVED
Offset placeholder indicating a removed record.
static const std::string ARCHIVE_FILE_NAME
Name of the archive file on disk.
void insert(const std::string &key, const void *const data, const uint64_t size) override
Insert a record into the store.
static void vacuum(const std::string &pathname)
Remove deleted entries from the manifest and archive files to save space on disk.
ArchiveRecordStore(const std::string &pathname, IO::Mode mode=IO::Mode::ReadOnly)
Open an existing ArchiveRecordStore.
uint64_t getSpaceUsed() const override
Obtain real storage utilization.
void sync() const override
Synchronize the entire record store to persistent storage.
void setCursorAtKey(const std::string &key) override
Set the sequence cursor to an arbitrary position within the RecordStore, starting at key.
ArchiveRecordStore(const std::string &pathname, const std::string &description)
Create a new ArchiveRecordStore, read/write mode.
std::string sequenceKey(int cursor=BE_RECSTORE_SEQ_NEXT) override
Sequence through a RecordStore, returning the key.
ArchiveRecordStore(const ArchiveRecordStore &)=delete
std::string getPathname() const override
Return the path name of the RecordStore.
static const std::string MANIFEST_FILE_NAME
Name of the manifest file on disk.
std::string getDescription() const override
Obtain a textual description of the RecordStore.
std::string getManifestName() const
Obtain the name of the file storing the manifest data data for this store.
void flush(const std::string &key) const override
Commit the record's data to storage.
ArchiveRecordStore & operator=(const ArchiveRecordStore &)=delete
std::string getArchiveName() const
Obtain the name of the file storing the data for this store.
void remove(const std::string &key) override
Remove a record from the store.
RecordStore::Record sequence(int cursor=BE_RECSTORE_SEQ_NEXT) override
Sequence through a RecordStore, returning the key/data pairs.
bool needsVacuum()
See if the ArchiveRecordStore would benefit from calling vacuum() to remove deleted entries,...
Memory::uint8Array read(const std::string &key) const override
Read a complete record from a store.
uint64_t length(const std::string &key) const override
Return the length of a record.
static bool needsVacuum(const std::string &pathname)
See if the ArchiveRecordStore would benefit from calling vacuum() to remove deleted entries,...
A class to represent a data storage mechanism.
virtual void insert(const std::string &key, const Memory::uint8Array &data)
Insert a record into the store.
static const int BE_RECSTORE_SEQ_NEXT
Tell sequence to sequence from current position.
virtual void replace(const std::string &key, const Memory::uint8Array &data)
Replace a complete record in a RecordStore.
Mode
Accessibility of object.
Definition: be_io.h:35
@ ReadOnly
Constant indicating the state of an object that manages some underlying file is accessible for readin...
This software was developed at the National Institute of Standards and Technology (NIST) by employees...