From 5d321336308867348eefa9659289e8879709803d Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 18 Jul 2024 15:41:44 +0200 Subject: [PATCH] add failing defaults to backend interface --- src/solanaceae/object_store/object_store.cpp | 8 ++++++++ src/solanaceae/object_store/object_store.hpp | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/solanaceae/object_store/object_store.cpp b/src/solanaceae/object_store/object_store.cpp index 26ed0c9..15ca98c 100644 --- a/src/solanaceae/object_store/object_store.cpp +++ b/src/solanaceae/object_store/object_store.cpp @@ -59,6 +59,10 @@ ObjectHandle StorageBackendI::newObject(ByteSpan) { return {}; } +bool StorageBackendI::write(Object, std::function&) { + return false; +} + bool StorageBackendI::write(Object o, const ByteSpan data) { std::function fn_cb = [read = 0ull, data](uint8_t* request_buffer, uint64_t buffer_size) mutable -> uint64_t { uint64_t i = 0; @@ -72,6 +76,10 @@ bool StorageBackendI::write(Object o, const ByteSpan data) { return write(o, fn_cb); } +bool StorageBackendI::read(Object, std::function&) { + return false; +} + std::unique_ptr StorageBackendI::file2(Object o, FILE2_FLAGS flags) { return nullptr; } diff --git a/src/solanaceae/object_store/object_store.hpp b/src/solanaceae/object_store/object_store.hpp index 3d36410..7e4b256 100644 --- a/src/solanaceae/object_store/object_store.hpp +++ b/src/solanaceae/object_store/object_store.hpp @@ -29,12 +29,12 @@ struct StorageBackendI { // ========== write object to storage ========== 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. - virtual bool write(Object o, std::function& data_cb) = 0; + virtual bool write(Object o, std::function& data_cb); bool write(Object o, const ByteSpan data); // ========== read object from storage ========== using read_from_storage_put_data_cb = void(const ByteSpan buffer); - virtual bool read(Object o, std::function& data_cb) = 0; + virtual bool read(Object o, std::function& data_cb); // ========== File2 interop ========== enum FILE2_FLAGS : uint32_t {