add failing defaults to backend interface

This commit is contained in:
Green Sky 2024-07-18 15:41:44 +02:00
parent a93a89c5db
commit 5d32133630
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -59,6 +59,10 @@ ObjectHandle StorageBackendI::newObject(ByteSpan) {
return {}; return {};
} }
bool StorageBackendI::write(Object, std::function<write_to_storage_fetch_data_cb>&) {
return false;
}
bool StorageBackendI::write(Object o, const ByteSpan data) { bool StorageBackendI::write(Object o, const ByteSpan data) {
std::function<write_to_storage_fetch_data_cb> fn_cb = [read = 0ull, data](uint8_t* request_buffer, uint64_t buffer_size) mutable -> uint64_t { std::function<write_to_storage_fetch_data_cb> fn_cb = [read = 0ull, data](uint8_t* request_buffer, uint64_t buffer_size) mutable -> uint64_t {
uint64_t i = 0; uint64_t i = 0;
@ -72,6 +76,10 @@ bool StorageBackendI::write(Object o, const ByteSpan data) {
return write(o, fn_cb); return write(o, fn_cb);
} }
bool StorageBackendI::read(Object, std::function<read_from_storage_put_data_cb>&) {
return false;
}
std::unique_ptr<File2I> StorageBackendI::file2(Object o, FILE2_FLAGS flags) { std::unique_ptr<File2I> StorageBackendI::file2(Object o, FILE2_FLAGS flags) {
return nullptr; return nullptr;
} }

View File

@ -29,12 +29,12 @@ struct StorageBackendI {
// ========== write object to storage ========== // ========== write object to storage ==========
using write_to_storage_fetch_data_cb = uint64_t(uint8_t* request_buffer, uint64_t buffer_size); using write_to_storage_fetch_data_cb = uint64_t(uint8_t* request_buffer, uint64_t buffer_size);
// calls data_cb with a buffer to be filled in, cb returns actual count of data. if returned < max, its the last buffer. // calls data_cb with a buffer to be filled in, cb returns actual count of data. if returned < max, its the last buffer.
virtual bool write(Object o, std::function<write_to_storage_fetch_data_cb>& data_cb) = 0; virtual bool write(Object o, std::function<write_to_storage_fetch_data_cb>& data_cb);
bool write(Object o, const ByteSpan data); bool write(Object o, const ByteSpan data);
// ========== read object from storage ========== // ========== read object from storage ==========
using read_from_storage_put_data_cb = void(const ByteSpan buffer); using read_from_storage_put_data_cb = void(const ByteSpan buffer);
virtual bool read(Object o, std::function<read_from_storage_put_data_cb>& data_cb) = 0; virtual bool read(Object o, std::function<read_from_storage_put_data_cb>& data_cb);
// ========== File2 interop ========== // ========== File2 interop ==========
enum FILE2_FLAGS : uint32_t { enum FILE2_FLAGS : uint32_t {