![]() |
CernVM-FS
2.12.0
|
#include <cache_posix.h>
Classes | |
struct | SavedState |
struct | Transaction |
Public Types | |
enum | CacheModes { kCacheReadWrite = 0, kCacheReadOnly } |
enum | RenameWorkarounds { kRenameNormal = 0, kRenameLink, kRenameSamedir } |
Public Member Functions | |
virtual CacheManagerIds | id () |
virtual std::string | Describe () |
virtual | ~PosixCacheManager () |
virtual bool | AcquireQuotaManager (QuotaManager *quota_mgr) |
virtual int | Open (const LabeledObject &object) |
virtual int64_t | GetSize (int fd) |
virtual int | Close (int fd) |
virtual int64_t | Pread (int fd, void *buf, uint64_t size, uint64_t offset) |
virtual int | Dup (int fd) |
virtual int | Readahead (int fd) |
virtual uint32_t | SizeOfTxn () |
virtual int | StartTxn (const shash::Any &id, uint64_t size, void *txn) |
virtual void | CtrlTxn (const Label &label, const int flags, void *txn) |
virtual int64_t | Write (const void *buf, uint64_t size, void *txn) |
virtual int | Reset (void *txn) |
virtual int | OpenFromTxn (void *txn) |
virtual int | AbortTxn (void *txn) |
virtual int | CommitTxn (void *txn) |
virtual void | Spawn () |
virtual manifest::Breadcrumb | LoadBreadcrumb (const std::string &fqrn) |
virtual bool | StoreBreadcrumb (const manifest::Manifest &manifest) |
bool | StoreBreadcrumb (std::string fqrn, manifest::Breadcrumb breadcrumb) |
void | TearDown2ReadOnly () |
CacheModes | cache_mode () |
bool | alien_cache () |
std::string | cache_path () |
bool | is_tmpfs () |
bool | do_refcount () const |
![]() | |
virtual | ~CacheManager () |
int | ChecksumFd (int fd, shash::Any *id) |
int | OpenPinned (const LabeledObject &object) |
bool | Open2Mem (const LabeledObject &object, unsigned char **buffer, uint64_t *size) |
bool | CommitFromMem (const LabeledObject &object, const unsigned char *buffer, const uint64_t size) |
QuotaManager * | quota_mgr () |
void * | SaveState (const int fd_progress) |
int | RestoreState (const int fd_progress, void *state) |
void | FreeState (const int fd_progress, void *state) |
CacheManagerIds | PeekState (void *state) |
Static Public Member Functions | |
static PosixCacheManager * | Create (const std::string &cache_path, const bool alien_cache, const RenameWorkarounds rename_workaround=kRenameNormal, const bool do_refcount=true) |
Static Public Attributes | |
static const uint64_t | kBigFile = 25 * 1024 * 1024 |
![]() | |
static const uint64_t | kSizeUnknown = uint64_t(-1) |
static const int | kLabelCatalog = 0x01 |
static const int | kLabelPinned = 0x02 |
static const int | kLabelVolatile = 0x04 |
static const int | kLabelExternal = 0x08 |
static const int | kLabelChunked = 0x10 |
static const int | kLabelCertificate = 0x20 |
static const int | kLabelMetainfo = 0x40 |
static const int | kLabelHistory = 0x80 |
Protected Member Functions | |
virtual void * | DoSaveState () |
virtual int | DoRestoreState (void *data) |
virtual bool | DoFreeState (void *data) |
![]() | |
CacheManager () | |
Private Member Functions | |
FRIEND_TEST (T_CacheManager, CommitTxnQuotaNotifications) | |
FRIEND_TEST (T_CacheManager, CommitTxnRenameFail) | |
FRIEND_TEST (T_CacheManager, Open) | |
FRIEND_TEST (T_CacheManager, OpenFromTxn) | |
FRIEND_TEST (T_CacheManager, OpenPinned) | |
FRIEND_TEST (T_CacheManager, Rename) | |
FRIEND_TEST (T_CacheManager, StartTxn) | |
FRIEND_TEST (T_CacheManager, TearDown2ReadOnly) | |
bool | InitCacheDirectory (const string &cache_path) |
PosixCacheManager (const std::string &cache_path, const bool alien_cache, const bool do_refcount=true) | |
std::string | GetPathInCache (const shash::Any &id) |
int | Rename (const char *oldpath, const char *newpath) |
int | Flush (Transaction *transaction) |
Private Attributes | |
std::string | cache_path_ |
std::string | txn_template_path_ |
bool | alien_cache_ |
RenameWorkarounds | rename_workaround_ |
CacheModes | cache_mode_ |
atomic_int32 | no_inflight_txns_ |
bool | reports_correct_filesize_ |
bool | is_tmpfs_ |
bool | do_refcount_ |
UniquePtr< FdRefcountMgr > | fd_mgr_ |
Static Private Attributes | |
static const char | kMagicRefcount = 123 |
static const char | kMagicNoRefcount = '\0' |
Additional Inherited Members | |
![]() | |
QuotaManager * | quota_mgr_ |
Cache manager implementation using a file system (cache directory) as a backing storage.
Definition at line 40 of file cache_posix.h.
Enumerator | |
---|---|
kCacheReadWrite | |
kCacheReadOnly |
Definition at line 51 of file cache_posix.h.
Enumerator | |
---|---|
kRenameNormal | |
kRenameLink | |
kRenameSamedir |
Definition at line 56 of file cache_posix.h.
|
inlinevirtual |
Definition at line 77 of file cache_posix.h.
|
inlineprivate |
Definition at line 142 of file cache_posix.h.
|
virtual |
Implements CacheManager.
Definition at line 113 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_abort_txn(), and anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
virtual |
This should only be used to replace the default NoopQuotaManager by a PosixQuotaManager. The cache manager takes the ownership of the passed quota manager.
Implements CacheManager.
Definition at line 131 of file cache_posix.cc.
|
inline |
Definition at line 106 of file cache_posix.h.
Referenced by FileSystem::SetupNfsMaps().
|
inline |
Definition at line 105 of file cache_posix.h.
Referenced by TalkManager::MainResponder().
|
inline |
Definition at line 107 of file cache_posix.h.
Referenced by FileSystem::SetupNfsMaps().
|
virtual |
Implements CacheManager.
Definition at line 140 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt().
|
virtual |
Implements CacheManager.
Definition at line 148 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
static |
Definition at line 272 of file cache_posix.cc.
Referenced by main(), and FileSystem::SetupPosixCacheMgr().
|
virtual |
Implements CacheManager.
Definition at line 293 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
virtual |
Return a human readable description of the cache instance. Used in cvmfs_talk.
Implements CacheManager.
Definition at line 303 of file cache_posix.cc.
|
inline |
Definition at line 109 of file cache_posix.h.
|
protectedvirtual |
Reimplemented from CacheManager.
Definition at line 361 of file cache_posix.cc.
|
protectedvirtual |
Reimplemented from CacheManager.
Definition at line 331 of file cache_posix.cc.
|
protectedvirtual |
If not refcounting, nothing to do, the kernel keeps the state of open file descriptors. Return a dummy memory location.
Reimplemented from CacheManager.
Definition at line 319 of file cache_posix.cc.
|
virtual |
Implements CacheManager.
Definition at line 376 of file cache_posix.cc.
|
private |
Definition at line 384 of file cache_posix.cc.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
Definition at line 400 of file cache_posix.cc.
|
virtual |
Implements CacheManager.
Definition at line 405 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt(), and anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
inlinevirtual |
Implements CacheManager.
Definition at line 69 of file cache_posix.h.
|
private |
Definition at line 231 of file cache_posix.cc.
Referenced by Create().
|
inline |
Definition at line 108 of file cache_posix.h.
|
virtual |
While not strictly necessary, cache managers often have a directory associated with them. This directory is currently used to find the cached manifest copy, the cvmfschecksum.$reponame file. This is important to make pre-loaded alien caches work, even in a tiered setup.
Reimplemented from CacheManager.
Definition at line 596 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_breadcrumb_load().
|
virtual |
Opening an object might get it from a third-party source, e.g. when the tiered cache manager issues a copy-up operation. In this case it is beneficial to register the object with the accurate meta-data, in the same way it is done during transactions.
Implements CacheManager.
Definition at line 414 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt().
|
virtual |
Implements CacheManager.
Definition at line 434 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
virtual |
Implements CacheManager.
Definition at line 452 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_pread().
|
virtual |
Used by the sqlite vfs in order to preload file catalogs into the file system buffers.
No-op if the fd is to a file that is on a tmpfs, and so already in page cache
Implements CacheManager.
Definition at line 499 of file cache_posix.cc.
|
private |
|
virtual |
Implements CacheManager.
Definition at line 517 of file cache_posix.cc.
|
inlinevirtual |
Implements CacheManager.
Definition at line 87 of file cache_posix.h.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
inlinevirtual |
Implements CacheManager.
Definition at line 98 of file cache_posix.h.
|
virtual |
Implements CacheManager.
Definition at line 531 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
virtual |
Reimplemented from CacheManager.
Definition at line 602 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_breadcrumb_store().
bool PosixCacheManager::StoreBreadcrumb | ( | std::string | fqrn, |
manifest::Breadcrumb | breadcrumb | ||
) |
void PosixCacheManager::TearDown2ReadOnly | ( | ) |
Definition at line 613 of file cache_posix.cc.
Referenced by FileSystem::TearDown2ReadOnly().
|
virtual |
Implements CacheManager.
Definition at line 624 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_write_txn().
|
private |
Definition at line 164 of file cache_posix.h.
Referenced by alien_cache().
|
private |
Definition at line 166 of file cache_posix.h.
Referenced by cache_mode().
|
private |
Definition at line 162 of file cache_posix.h.
Referenced by cache_path().
|
private |
Refcount and return only unique file descriptors
Definition at line 198 of file cache_posix.h.
Referenced by do_refcount().
|
private |
Definition at line 199 of file cache_posix.h.
|
private |
True if posixcache is on tmpfs (and with this already in RAM)
Definition at line 194 of file cache_posix.h.
Referenced by is_tmpfs().
|
static |
As of 25M, a file is considered a "big file", which means it is dangerous to apply asynchronous semantics. On start of a transaction with a big file the cache is cleaned up opportunistically.
Definition at line 67 of file cache_posix.h.
|
staticprivate |
Definition at line 176 of file cache_posix.h.
|
staticprivate |
Definition at line 175 of file cache_posix.h.
|
private |
The cache can only degrade to a read-only cache once all writable file descriptors from transactions are closed. This is indicated by a zero value in this variable.
Definition at line 173 of file cache_posix.h.
Referenced by PosixCacheManager().
|
private |
Definition at line 165 of file cache_posix.h.
Referenced by Create().
|
private |
Hack for HDFS which writes file sizes asynchronously.
Definition at line 189 of file cache_posix.h.
|
private |
Definition at line 163 of file cache_posix.h.