25 return "Internal in-memory cache manager (size "
38 , regular_entries_(max_entries,
41 perf::StatisticsTemplate(
"kv.regular", statistics))
42 , volatile_entries_(max_entries,
45 perf::StatisticsTemplate(
"kv.volatile", statistics))
46 , counters_(statistics) {
47 const int retval = pthread_rwlock_init(&
rwlock_, NULL);
52 "DEPRECATION WARNING: The RAM cache manager is depcreated and "
53 "will be removed from future releases.");
61 const int result =
fd_table_.OpenFd(handle);
62 if (result == -ENFILE) {
99 const int fd =
AddFd(generic_handle);
102 id.ToString().c_str(), strerror(-fd));
107 id.ToString().c_str());
111 id.ToString().c_str());
144 const int rc_int =
fd_table_.CloseFd(fd);
164 ->
Read(generic_handle.
handle, buf, size, offset);
177 rc =
AddFd(generic_handle);
206 id.ToString().c_str());
209 transaction->
pos = 0;
215 id.ToString().c_str());
240 const size_t new_size = max(2 * transaction->
buffer.
size,
241 static_cast<size_t>(size + transaction->
pos));
245 void *new_ptr = realloc(transaction->
buffer.
address, new_size);
255 "attempted to write more than requested (%lu>%zu)", size,
275 transaction->
pos = 0;
289 "error while committing transaction on %s: %s",
339 int64_t overrun = regular_size + volatile_size + transaction->
buffer.
size
344 overrun = max(overrun, (int64_t)
max_size_ >> 2);
355 "transaction for %s would overrun the cache limit by %ld",
perf::Counter * n_aborttxn
perf::Counter * n_openmiss
virtual CacheManagerIds id()
RamCacheManager(uint64_t max_size, unsigned max_entries, MemoryKvStore::MemoryAllocator alloc, perf::StatisticsTemplate statistics)
perf::Counter * n_getsize
virtual int OpenFromTxn(void *txn)
std::string GetDescription() const
virtual int Open(const LabeledObject &object)
static const shash::Any kInvalidHandle
static const int kLabelCatalog
bool Contains(const shash::Any &id)
std::string ToString(const bool with_suffix=false) const
int64_t Read(const shash::Any &id, void *buf, size_t size, size_t offset)
virtual int Close(int fd)
perf::Counter * n_committxn
virtual int CommitTxn(void *txn)
assert((mem||(size==0))&&"Out Of Memory")
MemoryKvStore * GetStore(const ReadOnlyHandle &fd)
virtual int AbortTxn(void *txn)
perf::Counter * n_starttxn
virtual void CtrlTxn(const Label &label, const int flags, void *txn)
virtual int StartTxn(const shash::Any &id, uint64_t size, void *txn)
int Commit(const MemoryBuffer &buf)
virtual int64_t Pread(int fd, void *buf, uint64_t size, uint64_t offset)
virtual int Readahead(int fd)
FdTable< ReadOnlyHandle > fd_table_
perf::Counter * n_readahead
perf::Counter * n_overrun
bool IncRef(const shash::Any &id)
perf::Counter * n_realloc
int AddFd(const ReadOnlyHandle &handle)
int64_t CommitToKvStore(Transaction *transaction)
perf::Counter * n_openregular
bool Unref(const shash::Any &id)
static const int kLabelPinned
string StringifyInt(const int64_t value)
bool ShrinkTo(size_t size)
void Inc(class Counter *counter)
virtual int DoOpen(const shash::Any &id)
static const int kLabelVolatile
perf::Counter * n_openvolatile
virtual std::string Describe()
int64_t GetSize(const shash::Any &id)
QuotaManager * quota_mgr()
QuotaManager * quota_mgr_
virtual int64_t GetSize(int fd)
virtual int Reset(void *txn)
virtual ~RamCacheManager()
MemoryKvStore regular_entries_
MemoryKvStore volatile_entries_
virtual int64_t Write(const void *buf, uint64_t size, void *txn)
virtual bool AcquireQuotaManager(QuotaManager *quota_mgr)
static const uint64_t kSizeUnknown
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)