4 #ifndef CVMFS_CACHE_EXTERN_H_
5 #define CVMFS_CACHE_EXTERN_H_
7 #ifndef __STDC_FORMAT_MACROS
8 #define __STDC_FORMAT_MACROS
23 #include "gtest/gtest_prod.h"
31 FRIEND_TEST(T_ExternalCacheManager, TransactionAbort);
57 const std::string &locator,
58 const std::vector<std::string> &cmd_line);
61 unsigned max_open_fds,
62 const std::string &ident);
69 virtual int Open(
const LabeledObject &
object);
70 virtual int64_t
GetSize(
int fd);
71 virtual int Close(
int fd);
72 virtual int64_t
Pread(
int fd,
void *buf, uint64_t
size, uint64_t offset);
73 virtual int Dup(
int fd);
84 virtual void CtrlTxn(
const Label &label,
87 virtual int64_t
Write(
const void *buf, uint64_t
size,
void *txn);
88 virtual int Reset(
void *txn);
160 return this->
id == other.
id;
163 return this->
id != other.
id;
170 explicit RpcJob(cvmfs::MsgRefcountReq *msg)
172 explicit RpcJob(cvmfs::MsgObjectInfoReq *msg)
179 explicit RpcJob(cvmfs::MsgStoreAbortReq *msg)
184 explicit RpcJob(cvmfs::MsgShrinkReq *msg)
188 explicit RpcJob(cvmfs::MsgBreadcrumbLoadReq *msg)
190 explicit RpcJob(cvmfs::MsgBreadcrumbStoreReq *msg)
204 cvmfs::MsgRefcountReply *m =
reinterpret_cast<cvmfs::MsgRefcountReply *
>(
210 cvmfs::MsgObjectInfoReply *m =
211 reinterpret_cast<cvmfs::MsgObjectInfoReply *
>(
217 cvmfs::MsgReadReply *m =
reinterpret_cast<cvmfs::MsgReadReply *
>(
223 cvmfs::MsgStoreReply *m =
reinterpret_cast<cvmfs::MsgStoreReply *
>(
230 cvmfs::MsgInfoReply *m =
reinterpret_cast<cvmfs::MsgInfoReply *
>(
236 cvmfs::MsgShrinkReply *m =
reinterpret_cast<cvmfs::MsgShrinkReply *
>(
242 cvmfs::MsgListReply *m =
reinterpret_cast<cvmfs::MsgListReply *
>(
248 cvmfs::MsgBreadcrumbReply *m =
249 reinterpret_cast<cvmfs::MsgBreadcrumbReply *
>(
277 static int ConnectLocator(
const std::string &locator,
bool print_error);
278 static bool SpawnPlugin(
const std::vector<std::string> &cmd_line);
315 const std::string &description)
319 const std::string &description)
323 const std::string &description,
const bool is_catalog)
324 {
return is_catalog; }
329 virtual bool Cleanup(
const uint64_t leave_size);
332 const std::string &channel_id);
334 const std::string &channel_id);
336 virtual std::vector<std::string>
List();
337 virtual std::vector<std::string>
ListPinned();
361 int GetInfo(QuotaInfo *quota_info);
363 std::vector<cvmfs::MsgListRecord> *result);
368 #endif // CVMFS_CACHE_EXTERN_H_
CacheTransport transport_
int Flush(bool do_commit, Transaction *transaction)
pthread_mutex_t lock_inflight_rpcs_
virtual ~ExternalCacheManager()
virtual uint64_t GetSizePinned()
int ChangeRefcount(const shash::Any &id, int change_by)
void set_attachment_recv(void *data, unsigned size)
const manifest::Manifest * manifest() const
virtual int64_t Pread(int fd, void *buf, uint64_t size, uint64_t offset)
virtual bool Pin(const shash::Any &hash, const uint64_t size, const std::string &description, const bool is_catalog)
int64_t session_id() const
virtual uint64_t GetCleanupRate(uint64_t period_s)
bool DoListing(cvmfs::EnumObjectType type, std::vector< cvmfs::MsgListRecord > *result)
virtual int64_t Write(const void *buf, uint64_t size, void *txn)
RpcInFlight(RpcJob *r, Signal *s)
virtual CacheManagerIds id()
virtual int Readahead(int fd)
static const unsigned kMaxSupportedObjectSize
virtual void Touch(const shash::Any &hash)
virtual bool Cleanup(const uint64_t leave_size)
RpcJob(cvmfs::MsgListReq *msg)
pthread_rwlock_t rwlock_fd_table_
cvmfs::MsgShrinkReply * msg_shrink_reply()
cvmfs::MsgRefcountReply * msg_refcount_reply()
int fd_connection() const
virtual void Insert(const shash::Any &hash, const uint64_t size, const std::string &description)
virtual uint64_t GetMaxFileSize()
cvmfs::MsgReadReply * msg_read_reply()
RpcJob(cvmfs::MsgReadReq *msg)
RpcJob(cvmfs::MsgObjectInfoReq *msg)
virtual int AbortTxn(void *txn)
virtual std::string Describe()
Transaction(const shash::Any &id)
virtual bool AcquireQuotaManager(QuotaManager *quota_mgr)
virtual std::vector< std::string > ListCatalogs()
std::vector< RpcInFlight > inflight_rpcs_
static void * MainRead(void *data)
virtual uint32_t SizeOfTxn()
uint64_t capabilities() const
atomic_int64 next_request_id_
RpcJob(cvmfs::MsgStoreReq *msg)
virtual int Reset(void *txn)
assert((mem||(size==0))&&"Out Of Memory")
uint32_t max_object_size() const
virtual void UnregisterBackChannel(int back_channel[2], const std::string &channel_id)
FRIEND_TEST(T_ExternalCacheManager, TransactionAbort)
virtual void Remove(const shash::Any &file)
RpcJob(cvmfs::MsgStoreAbortReq *msg)
virtual std::vector< std::string > ListPinned()
virtual std::vector< std::string > List()
void set_attachment_send(void *data, unsigned size)
virtual void InsertVolatile(const shash::Any &hash, const uint64_t size, const std::string &description)
bool operator!=(const ReadOnlyHandle &other) const
cvmfs::MsgListReply * msg_list_reply()
ExternalCacheManager(int fd_connection, unsigned max_open_fds)
RpcJob(cvmfs::MsgBreadcrumbStoreReq *msg)
virtual void Unpin(const shash::Any &hash)
virtual int Close(int fd)
ExternalCacheManager * cache_mgr_
cvmfs::MsgStoreReply * msg_store_reply()
FdTable< ReadOnlyHandle > fd_table_
cvmfs::MsgBreadcrumbReply * msg_breadcrumb_reply()
uint32_t max_object_size_
virtual void * DoSaveState()
virtual void RegisterBackChannel(int back_channel[2], const std::string &channel_id)
RpcJob(cvmfs::MsgRefcountReq *msg)
google::protobuf::MessageLite * msg_req_
virtual bool StoreBreadcrumb(const manifest::Manifest &manifest)
RpcJob(cvmfs::MsgInfoReq *msg)
CacheTransport::Frame * frame_send()
static const shash::Any kInvalidHandle
CacheTransport::Frame frame_send_
cvmfs::MsgObjectInfoReply * msg_object_info_reply()
int GetInfo(QuotaInfo *quota_info)
virtual uint32_t GetProtocolRevision()
google::protobuf::MessageLite * GetMsgTyped()
virtual void CtrlTxn(const Label &label, const int flags, void *txn)
ExternalQuotaManager(ExternalCacheManager *cache_mgr)
static bool SpawnPlugin(const std::vector< std::string > &cmd_line)
cvmfs::MsgInfoReply * msg_info_reply()
QuotaManager * quota_mgr()
bool operator==(const ReadOnlyHandle &other) const
CacheTransport::Frame * frame_recv()
shash::Any GetHandle(int fd)
std::string error_msg() const
virtual int64_t GetSize(int fd)
static ExternalCacheManager * Create(int fd_connection, unsigned max_open_fds, const std::string &ident)
pthread_mutex_t lock_send_fd_
static const unsigned kMinSupportedObjectSize
static ExternalQuotaManager * Create(ExternalCacheManager *cache_mgr)
virtual bool DoFreeState(void *data)
virtual manifest::Breadcrumb LoadBreadcrumb(const std::string &fqrn)
ReadOnlyHandle(const shash::Any &h)
CacheTransport::Frame frame_recv_
RpcJob(cvmfs::MsgShrinkReq *msg)
virtual bool HasCapability(Capabilities capability)
void set_attachment(void *attachment, uint32_t att_size)
google::protobuf::MessageLite * msg_req()
void CallRemotely(RpcJob *rpc_job)
virtual std::vector< std::string > ListVolatile()
virtual int OpenFromTxn(void *txn)
static int ConnectLocator(const std::string &locator, bool print_error)
static PluginHandle * CreatePlugin(const std::string &locator, const std::vector< std::string > &cmd_line)
virtual int StartTxn(const shash::Any &id, uint64_t size, void *txn)
virtual uint64_t GetCapacity()
virtual int CommitTxn(void *txn)
virtual int DoRestoreState(void *data)
RpcJob(cvmfs::MsgBreadcrumbLoadReq *msg)
static const unsigned kPbProtocolVersion
virtual uint64_t GetSize()
int DoOpen(const shash::Any &id)
static const uint64_t kSizeUnknown
virtual int Open(const LabeledObject &object)