2014-12-09 17:45:33 +01:00
|
|
|
#pragma once
|
2015-10-15 13:10:20 +02:00
|
|
|
#ifndef MESSMER_BLOBSTORE_INTERFACE_BLOB_H_
|
|
|
|
#define MESSMER_BLOBSTORE_INTERFACE_BLOB_H_
|
2014-12-09 17:45:33 +01:00
|
|
|
|
|
|
|
#include <cstring>
|
2015-02-26 17:33:47 +01:00
|
|
|
#include <cstdint>
|
2015-04-09 20:07:21 +02:00
|
|
|
#include <messmer/blockstore/utils/Key.h>
|
2015-10-05 03:45:00 +02:00
|
|
|
#include <messmer/cpp-utils/data/Data.h>
|
2015-02-27 00:18:26 +01:00
|
|
|
|
2014-12-09 17:45:33 +01:00
|
|
|
namespace blobstore {
|
|
|
|
|
|
|
|
class Blob {
|
|
|
|
public:
|
|
|
|
virtual ~Blob() {}
|
|
|
|
|
2015-02-27 00:18:26 +01:00
|
|
|
//TODO Use own Key class for blobstore
|
2015-10-04 17:14:02 +02:00
|
|
|
virtual const blockstore::Key &key() const = 0;
|
2015-02-27 00:18:26 +01:00
|
|
|
|
2015-02-26 17:33:47 +01:00
|
|
|
virtual uint64_t size() const = 0;
|
|
|
|
virtual void resize(uint64_t numBytes) = 0;
|
2015-01-28 01:02:32 +01:00
|
|
|
|
2015-10-05 03:45:00 +02:00
|
|
|
virtual cpputils::Data readAll() const = 0;
|
2015-02-27 00:21:17 +01:00
|
|
|
virtual void read(void *target, uint64_t offset, uint64_t size) const = 0;
|
2015-03-11 01:04:48 +01:00
|
|
|
virtual uint64_t tryRead(void *target, uint64_t offset, uint64_t size) const = 0;
|
2015-02-27 00:21:17 +01:00
|
|
|
virtual void write(const void *source, uint64_t offset, uint64_t size) = 0;
|
2015-03-11 01:04:48 +01:00
|
|
|
|
2015-04-09 23:41:51 +02:00
|
|
|
virtual void flush() = 0;
|
|
|
|
|
2015-03-11 01:04:48 +01:00
|
|
|
//TODO Test tryRead
|
2014-12-09 17:45:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|