Return version number from reads

This commit is contained in:
Vitaliy Filippov
2020-02-12 12:30:50 +03:00
parent 1100ad44bd
commit b7ccd63104
6 changed files with 26 additions and 7 deletions
+10 -3
View File
@@ -55,8 +55,15 @@ struct blockstore_op_t
std::function<void (blockstore_op_t*)> callback;
// For reads, writes & deletes: oid is the requested object
object_id oid;
// For reads: version=0 -> last stable, version=UINT64_MAX -> last unstable, version=X -> specific version
// For writes & deletes: a new version is assigned automatically
// For reads:
// version == 0 -> read the last stable version,
// version == UINT64_MAX -> read the last version,
// otherwise -> read the newest version that is <= the specified version
// after execution, version is equal to the version that was read from the blockstore
// For writes & deletes:
// if version == 0, a new version is assigned automatically
// if version != 0, it is assigned for the new write if possible, otherwise -EINVAL is returned
// after execution, version is equal to the version that was written to the blockstore
uint64_t version;
// For reads & writes: offset & len are the requested part of the object, buf is the buffer
uint32_t offset;
@@ -102,7 +109,7 @@ public:
void enqueue_op_first(blockstore_op_t *op);
// Unstable writes are added here (map of object_id -> version)
std::map<object_id, uint64_t> & get_unstable_writes();
std::unordered_map<object_id, uint64_t> & get_unstable_writes();
// FIXME rename to object_size
uint32_t get_block_size();