(std::exception& ex)
74 ERR_POST_X(1,
"Exception in ~CBDB_Volumes() "<< ex.what());
96 stringerr_file =
m_Path+
"err.log";
97 m_Env->OpenErrFile(err_file.c_str());
98 m_Env->SetLogFileMax(20 * 1024 * 1024);
107 if(!
m_Env->IsTransactional()) {
110 "Joined non-transactional environment");
117 "'Warning: DB_ENV returned DB_RUNRECOVERY code." 118 " Running the recovery procedure.");
131 m_Env->SetLogAutoRemove(
true);
133 m_Env->SetLockTimeout(30 * 1000000);
179vector<unsigned> vol_ids;
181TSortedVols sorted_volumes;
185 ITERATE(vector<unsigned>, iter, vol_ids) {
193 ITERATE(TSortedVols, iter, sorted_volumes) {
208 const string& backup_loc)
242 for(vector<unsigned>::const_iterator iter = remove_list.begin();
243iter != remove_list.end(); ++iter) {
268 string(
"Cannot unlock (lock count == 0) volume=")
289 unsignedvolume_id_new,
301 unsignedvolume_id_new1,
302 unsignedvolume_id_new2,
315 constvector<unsigned>& merge_list,
345vlist.push_back(volume_id);
368 string(
"Cannot unlock (lock count == 0) volume=")
397 string(
"Illegal volume status switch volume=")
422 return "Unknown status";
430 if(new_status == old_status)
return true;
Berkeley BDB file cursor.
Wrapper around Berkeley DB transaction structure.
BDB environment object a collection including support for some or all of caching, locking,...
BDB errno exception class.
Base BDB exception class.
Berkeley DB file cursor class.
Exceptions specific to volumes management.
Transaction class for volumes management.
CBDB_VolumesTransaction(CBDB_Volumes &volumes)
void LockVolume(unsigned volume_id)
Increment volume lock counter Volume locking sets restrictions on some operations (like status change...
void Merge(unsigned volume_id_new, const vector< unsigned > &merge_list, EVolumeStatus new_status=eOnlineActive)
Merge volumes into one.
unsigned AddVolume(const string &location, unsigned type, unsigned version, EVolumeStatus status=eOffline)
Register a new volume.
void Delete(const vector< unsigned > &remove_list)
Delete volume.
void Open(const string &dir_path)
Open (mount) volume management database.
void SwitchVolumes(unsigned volume_id_old, unsigned volume_id_new, EVolumeStatus new_status=eOnlineActive)
Transactional volume switch: old volume goes offline new volume comes online.
void SetDateRange(unsigned volume_id, unsigned from, unsigned to)
Update date range.
void ChangeStatus(unsigned volume_id, EVolumeStatus status)
Change volume status.
void Close()
Close volume management database.
void SetBackupLocation(unsigned volume_id, const string &backup_loc)
Set backup token (location) for volume.
void EnumerateVolumes(vector< unsigned > &vlist, bool avail=false)
Get list of all available volumes.
bool x_CheckStatusChange(EVolumeStatus old_status, EVolumeStatus new_status)
Check if status change is possible.
const SVolumesDB & FetchVolumeRec(unsigned volume_id)
Get volume record (throws an exception if record not found)
void Split(unsigned volume_id_old, unsigned volume_id_new1, unsigned volume_id_new2, EVolumeStatus new_status=eOnlineActive)
Old volume goes offline, new volumes online All volume records should be created upfront.
unique_ptr< CBDB_Env > m_Env
SVolumesDB & GetVolumeDB()
Get low level access to volumes database (be careful will you!)
void SortVolumes()
Sort volumes.
void x_ChangeCurrentStatus(unsigned volume_id, EVolumeStatus status)
void UnLockVolume(unsigned volume_id)
Decrement volume lock counter.
EVolumeStatus
Volume status codes.
@ eOnlineMaintenance
Online, readable, under background processing.
@ eOnlineActive
Online, new updates can come.
@ eOfflineRestore
Offline, restore request received.
@ eOffline
Offline, unmounted.
@ eOfflineRelocated
Offline, data moved to another volume.
@ eOfflineArchived
Offline, data moved to archive.
@ eOnlinePassive
Online, read-only closed for updates.
static string StatusToString(EVolumeStatus status)
Utility to convert status to string.
unique_ptr< SVolumesDB > m_VolumesDB
static const char location[]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
EBDB_ErrCode
BDB Return codes.
EBDB_ErrCode Fetch(EFetchDirection fdir=eDefault)
Fetch record.
@ eReadWriteCreate
read-write, create if it doesn't exist
virtual void Commit()
Commit transaction.
bool IsRecovery() const
If it is DB_RUNRECOVERY error.
CBDB_Env & m_Env
Associated environment.
@ eTransSync
Syncronous transaction.
@ eRunRecovery
Run DB recovery first.
@ eThreaded
corresponds to DB_THREAD
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
virtual bool Exists(void) const
Check if directory "dirname" exists.
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
Definition of all error codes used in bdb library (bdb.lib and ncbi_xcache_bdb.lib).
const string version
version string
double value_type
The numeric datatype used by the parser.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
BDB file for storing volumes registry.
CBDB_FieldString location
Mount point for the volume.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4