17 #ifndef FOXXLL_MNG_BID_HEADER 18 #define FOXXLL_MNG_BID_HEADER 38 template <
size_t Size>
43 static constexpr
size_t size = Size;
45 static constexpr
size_t t_size = Size;
57 template <
size_t BlockSize>
59 : storage(obj.storage), offset(obj.offset) { }
62 template <
size_t BlockSize>
72 return storage !=
nullptr;
84 return storage->
awrite(data, offset, data_size, on_complete);
91 return storage->
aread(data, offset, data_size, on_complete);
123 static constexpr
size_t t_size = 0;
128 : storage(f), offset(o), size(s) { }
132 return (storage !=
nullptr);
144 return storage->
awrite(data, offset, data_size, on_complete);
151 return storage->
aread(data, offset, data_size, on_complete);
175 template <
size_t BlockSize>
176 std::ostream& operator << (std::ostream& s, const BID<BlockSize>& bid)
178 std::stringstream ss;
180 ss <<
"[" <<
static_cast<void*
>(bid.storage) <<
"|";
183 ss << bid.storage->get_allocator_id();
189 ss <<
"]0x" << std::hex << std::setfill(
'0') << std::setw(8) << bid.offset
190 <<
"/0x" << std::setw(8) << bid.size << std::dec;
197 template <
size_t BlockSize>
204 #endif // !FOXXLL_MNG_BID_HEADER
request_ptr write(void *data, size_t data_size, completion_handler on_complete=completion_handler())
Writes data to the disk(s).
request_ptr read(void *data, size_t data_size, completion_handler on_complete=completion_handler())
Reads data from the disk(s).
BID(file *s, const external_size_type &o)
virtual int get_allocator_id() const =0
Returns the file's parallel disk block allocator number.
external_size_type offset
offset within the file of the block (uint64_t)
Specialization of block identifier class (BID) for variable size block size.
virtual request_ptr awrite(void *buffer, offset_type pos, size_type bytes, const completion_handler &on_complete=completion_handler())=0
Simpler non-growing vector without initialization.
request_ptr read(void *data, size_t data_size, completion_handler on_complete=completion_handler())
Reads data from the disk(s).
external_size_type offset
offset within the file of the block (uint64_t)
bool operator!=(const BID< Size > &b) const
BID(file *f, const external_size_type &o, size_t s)
request_ptr write(void *data, size_t data_size, completion_handler on_complete=completion_handler())
Writes data to the disk(s).
virtual request_ptr aread(void *buffer, offset_type pos, size_type bytes, const completion_handler &on_complete=completion_handler())=0
tlx::delegate< void(request *r, bool success)> completion_handler
completion handler
bool operator==(const BID< Size > &b) const
file * storage
pointer to the file of the block
High-performance smart pointer used as a wrapping reference counting pointer.
static constexpr size_t t_size
Blocks size, given by the parameter.
BID & operator=(const BID< BlockSize > &obj)
assignment from another block size
static const int NO_ALLOCATOR
BID(const BID< BlockSize > &obj)
construction from another block size
size_t size
size of the block in bytes
file * storage
pointer to the file of the block
uint64_t external_size_type
static constexpr size_t size
Block size.