13 #ifndef HERMES_METADATA_MANAGEMENT_H_
14 #define HERMES_METADATA_MANAGEMENT_H_
285 const char *name,
BucketID bucket_id);
297 BucketID bucket_id,
const std::string &blob_name);
303 const std::string &old_name,
const std::string &new_name,
310 const std::string &old_name,
const std::string &new_name);
316 BucketID bucket_id,
const std::string &blob_name);
329 const std::string &name,
BucketID bucket_id,
330 bool track_stats =
true);
347 const std::string &name);
353 const std::string &name);
359 const char *blob_name,
BucketID bucket_id,
360 const std::vector<BufferID> &buffer_ids,
361 TargetID effective_target,
bool is_swap_blob =
false,
362 bool called_from_buffer_organizer =
false);
416 const std::vector<TargetID> &targets);
479 const char *blob_name,
const char *bucket_name,
492 VBucketID vbucket_id,
const char *blob_name,
493 const char *bucket_name);
Definition: adapter_utils.cc:35
BufferIdArray GetBufferIdsFromBlobId(Arena *arena, SharedMemoryContext *context, RpcContext *rpc, BlobID blob_id, u32 **sizes)
Definition: metadata_management.cc:696
bool LocalUnlockBlob(SharedMemoryContext *context, BlobID blob_id)
Definition: metadata_management.cc:1656
constexpr int kMaxDevices
Definition: hermes_types.h:184
void LocalBeginGlobalTicketMutex(MetadataManager *mdm)
MapType
Definition: metadata_management.h:58
SystemViewState * GetLocalSystemViewState(MetadataManager *mdm)
Definition: metadata_management.cc:1018
SwapBlob VecToSwapBlob(std::vector< BufferID > &vec)
Definition: metadata_management.cc:1255
void DecrementRefcount(SharedMemoryContext *context, RpcContext *rpc, BucketID id)
Definition: metadata_management.cc:999
ThresholdViolation
Definition: metadata_management.h:67
bool LockBlob(SharedMemoryContext *context, RpcContext *rpc, BlobID blob_id)
Definition: metadata_management.cc:1680
void BeginGlobalTicketMutex(SharedMemoryContext *context, RpcContext *rpc)
bool IsBucketNameTooLong(const std::string &name)
Definition: metadata_management.cc:55
bool IsNullVBucketId(VBucketID id)
Definition: metadata_management.cc:80
SwapBlob IdArrayToSwapBlob(BufferIdArray ids)
Definition: metadata_management.cc:1272
BucketID GetBucketId(SharedMemoryContext *context, RpcContext *rpc, const char *name)
Definition: metadata_management.cc:170
bool UnlockBlob(SharedMemoryContext *context, RpcContext *rpc, BlobID blob_id)
Definition: metadata_management.cc:1691
std::vector< BlobID > GetBlobIds(SharedMemoryContext *context, RpcContext *rpc, BucketID bucket_id)
Definition: metadata_management.cc:424
const int kIdListChunkSize
Definition: metadata_management.h:86
void RenameBucket(SharedMemoryContext *context, RpcContext *rpc, BucketID id, const std::string &old_name, const std::string &new_name)
Definition: metadata_management.cc:972
TargetID FindTargetIdFromDeviceId(const std::vector< TargetID > &targets, DeviceID device_id)
Definition: metadata_management.cc:1163
bool IsNullBucketId(BucketID id)
Definition: metadata_management.cc:75
static constexpr int kMaxTraitsPerVBucket
Definition: metadata_management.h:145
VBucketID GetOrCreateVBucketId(SharedMemoryContext *context, RpcContext *rpc, const std::string &name)
Definition: metadata_management.cc:573
void RemoveBlobFromBucketInfo(SharedMemoryContext *context, RpcContext *rpc, BucketID bucket_id, BlobID blob_id)
Definition: metadata_management.cc:859
void IncrementBlobStats(SharedMemoryContext *context, RpcContext *rpc, BlobID blob_id)
Definition: metadata_storage_stb_ds.cc:448
void AttachBlobToVBucket(SharedMemoryContext *context, RpcContext *rpc, const char *blob_name, const char *bucket_name, VBucketID vbucket_id)
Definition: metadata_management.cc:1513
void ReplaceBlobIdInBucket(SharedMemoryContext *context, RpcContext *rpc, BucketID bucket_id, BlobID old_blob_id, BlobID new_blob_id)
Definition: metadata_management.cc:596
void EndGlobalTicketMutex(SharedMemoryContext *context, RpcContext *rpc)
uint8_t u8
Definition: hermes_types.h:40
bool IsBlobNameTooLong(const std::string &name)
Definition: metadata_management.cc:48
void LocalIncrementBlobStats(MetadataManager *mdm, BlobID blob_id)
Definition: metadata_storage_stb_ds.cc:439
BlobID GetBlobId(SharedMemoryContext *context, RpcContext *rpc, const std::string &name, BucketID bucket_id, bool track_stats)
Definition: metadata_management.cc:227
void InitNeighborhoodTargets(SharedMemoryContext *context, RpcContext *rpc)
Definition: metadata_storage_stb_ds.cc:952
u16 DeviceID
Definition: hermes_types.h:51
void InitMetadataManager(MetadataManager *mdm, RpcContext *rpc, Arena *arena, Config *config)
Definition: metadata_management.cc:1289
BucketID GetOrCreateBucketId(SharedMemoryContext *context, RpcContext *rpc, const std::string &name)
Definition: metadata_management.cc:502
std::string GetBucketNameById(SharedMemoryContext *context, RpcContext *rpc, BucketID id)
Definition: metadata_management.cc:1557
void RenameBlob(SharedMemoryContext *context, RpcContext *rpc, const std::string &old_name, const std::string &new_name, BucketID bucket_id)
Definition: metadata_management.cc:889
bool IsNullBlobId(BlobID id)
Definition: metadata_management.cc:85
BucketID GetBucketIdFromBlobId(SharedMemoryContext *context, RpcContext *rpc, BlobID id)
Definition: metadata_management.cc:402
bool LocalLockBlob(SharedMemoryContext *context, BlobID blob_id)
Definition: metadata_management.cc:1617
bool BlobIsInSwap(BlobID id)
Definition: metadata_management.cc:652
bool DestroyBucket(SharedMemoryContext *context, RpcContext *rpc, const char *name, BucketID bucket_id)
Definition: metadata_management.cc:933
void LocalEndGlobalTicketMutex(MetadataManager *mdm)
uint32_t u32
Definition: hermes_types.h:42
std::string GetBlobNameFromId(SharedMemoryContext *context, RpcContext *rpc, BlobID blob_id)
Definition: metadata_management.cc:349
std::vector< BufferID > SwapBlobToVec(SwapBlob swap_blob)
Definition: metadata_management.cc:1240
std::vector< TargetID > GetNeighborhoodTargets(SharedMemoryContext *context, RpcContext *rpc)
Definition: metadata_management.cc:1448
void DestroyBlobByName(SharedMemoryContext *context, RpcContext *rpc, BucketID bucket_id, const std::string &blob_name)
Definition: metadata_management.cc:871
std::vector< BlobID > GetBlobsFromVBucketInfo(SharedMemoryContext *context, RpcContext *rpc, VBucketID vbucket_id)
Definition: metadata_management.cc:1531
void RemoveBlobFromVBucketInfo(SharedMemoryContext *context, RpcContext *rpc, VBucketID vbucket_id, const char *blob_name, const char *bucket_name)
Definition: metadata_management.cc:1543
static const u32 kGlobalMutexNodeId
Definition: metadata_management.h:26
u64 TraitID
Definition: hermes_types.h:421
bool ContainsBlob(SharedMemoryContext *context, RpcContext *rpc, BucketID bucket_id, const std::string &blob_name)
Definition: metadata_management.cc:903
bool DestroyVBucket(SharedMemoryContext *context, RpcContext *rpc, const char *name, VBucketID vbucket_id)
Definition: metadata_management.cc:948
uint64_t u64
Definition: hermes_types.h:43
std::string GetShmemString(ShmemString *sms)
Definition: metadata_management.cc:1718
bool IsVBucketNameTooLong(const std::string &name)
Definition: metadata_management.cc:62
void AttachBlobToBucket(SharedMemoryContext *context, RpcContext *rpc, const char *blob_name, BucketID bucket_id, const std::vector< BufferID > &buffer_ids, TargetID effective_target, bool is_swap_blob, bool called_from_buffer_organizer)
Definition: metadata_management.cc:750
void LocalReplaceBlobIdInBucket(SharedMemoryContext *context, BucketID bucket_id, BlobID old_blob_id, BlobID new_blob_id)
Definition: metadata_storage_stb_ds.cc:475
void MakeShmemString(ShmemString *sms, u8 *memory, const char *val, u32 size)
Definition: metadata_management.cc:1704
std::vector< u64 > GetRemainingTargetCapacities(SharedMemoryContext *context, RpcContext *rpc, const std::vector< TargetID > &targets)
Definition: metadata_management.cc:1502
Definition: memory_management.h:84
Definition: metadata_management.h:106
bool stop
Definition: metadata_management.h:111
u32 last
Definition: metadata_management.h:110
BlobInfo & operator=(const BlobInfo &other)
Definition: metadata_management.h:122
TicketMutex lock
Definition: metadata_management.h:108
Stats stats
Definition: metadata_management.h:107
TargetID effective_target
Definition: metadata_management.h:109
Definition: metadata_management.h:137
std::atomic< int > ref_count
Definition: metadata_management.h:140
ChunkedIdList blobs
Definition: metadata_management.h:139
BucketID next_free
Definition: metadata_management.h:138
bool active
Definition: metadata_management.h:141
Definition: metadata_management.h:98
BufferID * ids
Definition: metadata_management.h:99
u32 length
Definition: metadata_management.h:100
Definition: hermes_types.h:56
Definition: hermes_types.h:258
Definition: metadata_management.h:190
Thresholds bo_capacity_thresholds[kMaxDevices]
Definition: metadata_management.h:200
int num_devices
Definition: metadata_management.h:194
std::atomic< u64 > * bytes_available
Definition: metadata_management.h:197
u64 num_targets
Definition: metadata_management.h:192
u64 capacities[kMaxDevices]
Definition: metadata_management.h:195
Definition: metadata_management.h:90
u32 head_offset
Definition: metadata_management.h:91
u32 length
Definition: metadata_management.h:92
Definition: memory_management.h:53
Definition: buffer_pool.h:273
Definition: metadata_management.h:45
u32 offset
Definition: metadata_management.h:47
u32 size
Definition: metadata_management.h:49
Definition: metadata_management.h:81
u32 recency
Definition: metadata_management.h:82
u32 frequency
Definition: metadata_management.h:83
Definition: buffer_pool.h:440
Definition: metadata_management.h:163
int num_devices
Definition: metadata_management.h:172
u64 capacities[kMaxDevices]
Definition: metadata_management.h:165
std::atomic< u64 > bytes_available[kMaxDevices]
Definition: metadata_management.h:167
Thresholds bo_capacity_thresholds[kMaxDevices]
Definition: metadata_management.h:170
Definition: hermes_types.h:250
Definition: memory_management.h:36
std::atomic< u32 > serving
Definition: memory_management.h:38
std::atomic< u32 > ticket
Definition: memory_management.h:37
Definition: metadata_management.h:150
std::atomic< int > ref_count
Definition: metadata_management.h:153
TraitID traits[kMaxTraitsPerVBucket]
Definition: metadata_management.h:156
bool active
Definition: metadata_management.h:157
VBucketID next_free
Definition: metadata_management.h:151
ChunkedIdList blobs
Definition: metadata_management.h:152
std::atomic< int > async_flush_count
Definition: metadata_management.h:154
Definition: metadata_management.h:72
ThresholdViolation violation
Definition: metadata_management.h:74
size_t violation_size
Definition: metadata_management.h:75
TargetID target_id
Definition: metadata_management.h:73
Definition: hermes_types.h:405
Definition: hermes_types.h:358
Definition: buffer_pool.h:93
Definition: hermes_types.h:198
u64 as_int
Definition: hermes_types.h:213
Definition: hermes_types.h:388