21 #include <pybind11/pytypes.h>
37 std::map<std::string, pybind11::buffer>
data;
42 inline pybind11::buffer&
operator[](
const std::string&
id) {
49 inline size_t size()
const {
return data.size(); }
A key-value pair set storing pieces of arbitrary data (chunks) under string keys.
Writable ChunkCollection implementation for Python.
pybind11::buffer & operator[](const std::string &id)
void open()
Opens the collection to read chunks from it.
bool chunkExists(const std::string &id) const
Check if a specific chunk exists.
size_t size() const
Returns the number of chunks available in the collection after it is opened.
std::map< std::string, pybind11::buffer > data
chunksize_t chunkSize(const std::string &id) const
Retrieves size of a specific chunk.
chunksize_t fetch(const std::string &id, void *data, const chunksize_t limit)
Reads a chunk.
WritableChunkCollection()
void close()
Closes the collection after a reading session.
void save(const std::string &filename, bool append=false)
Saves the collection to a file.
JNIEnv jlong jstring filename
JNIEnv jlong jstring jboolean append