LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
LogCabin::Storage::Layout Class Reference

Encapsulates how LogCabin lays out the filesystem, and it handles locking of the storage directory. More...

#include <Layout.h>

List of all members.

Public Member Functions

 Layout ()
 Default constructor. Call some init method next.
 Layout (Layout &&other)
 Move constructor.
 ~Layout ()
 Destructor.
Layoutoperator= (Layout &&other)
 Move assignment.
void init (const Core::Config &config, uint64_t serverId)
 Initialize in the normal way for a LogCabin server.
void init (const std::string &storagePath, uint64_t serverId)
 Initialize with a particular storagePath.
void initTemporary (uint64_t serverId=1)
 Initialize for unit tests.

Public Attributes

FilesystemUtil::File topDir
 Contains all files.
FilesystemUtil::File serverDir
 Contains all files for this particular server.
FilesystemUtil::File lockFile
 Used to ensure only one process accesses serverDir at a time.
FilesystemUtil::File logDir
 Contains all log files for this particular server.
FilesystemUtil::File snapshotDir
 Contains all snapshot files for this particular server.

Private Member Functions

 Layout (const Layout &other)
Layoutoperator= (const Layout &other)

Private Attributes

bool removeAllFiles
 If true, rm -rf topDir when destroying this class.

Detailed Description

Encapsulates how LogCabin lays out the filesystem, and it handles locking of the storage directory.

The current filesystem layout looks like this:

/ - topDir, defined by config option 'storagePath' "server%lu" % serverId/ - serverDir log/ - logDir, Storage::Log implementation-defined snapshot/ - snapshotDir, contains snapshots snapshot - latest complete snapshot "partial.%010lu.%06lu" % (seconds, micro) - in progress lock - lockFile, ensures only 1 process accesses serverDir a time

Definition at line 44 of file Layout.h.


Constructor & Destructor Documentation

Default constructor. Call some init method next.

Definition at line 30 of file Layout.cc.

Move constructor.

Definition at line 40 of file Layout.cc.

Destructor.

Definition at line 51 of file Layout.cc.

LogCabin::Storage::Layout::Layout ( const Layout other) [private]

Member Function Documentation

Layout & LogCabin::Storage::Layout::operator= ( Layout &&  other)

Move assignment.

Definition at line 58 of file Layout.cc.

void LogCabin::Storage::Layout::init ( const Core::Config config,
uint64_t  serverId 
)

Initialize in the normal way for a LogCabin server.

Parameters:
configServer settings: used to extract storage path.
serverIdUnique ID for this server.

Definition at line 75 of file Layout.cc.

void LogCabin::Storage::Layout::init ( const std::string &  storagePath,
uint64_t  serverId 
)

Initialize with a particular storagePath.

Parameters:
storagePathPath for 'topDir'.
serverIdUnique ID for this server.

Definition at line 82 of file Layout.cc.

void LogCabin::Storage::Layout::initTemporary ( uint64_t  serverId = 1)

Initialize for unit tests.

This will set up the layout in a temporary directory, and this class will remove all files in that directory when it is destroyed.

Parameters:
serverIdUnique ID for this server (in case it matters).

Definition at line 110 of file Layout.cc.

Layout& LogCabin::Storage::Layout::operator= ( const Layout other) [private]

Member Data Documentation

Contains all files.

Defined by config option 'storagePath'.

Definition at line 90 of file Layout.h.

Contains all files for this particular server.

Sits underneath topDir in a directory called "server%lu" % serverId.

Definition at line 95 of file Layout.h.

Used to ensure only one process accesses serverDir at a time.

Sits underneath serverDir in a file called "lock".

Definition at line 100 of file Layout.h.

Contains all log files for this particular server.

Sits underneath serverDir in a directory called "log".

Definition at line 105 of file Layout.h.

Contains all snapshot files for this particular server.

Sits underneath serverDir in a directory called "snapshot".

Definition at line 110 of file Layout.h.

If true, rm -rf topDir when destroying this class.

Definition at line 116 of file Layout.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines