Developing new storage backends

One advantage of the zarr data model is that it can be used in combiantion with a variety of storage backends. Currently in this package there is support for a DictStore (keeping data in memory), DirectoryStore (writing data to a local disk) and an S3Store for S3-compatible object store which is currently read-only. In oder to implement a new storage backend, you would have to create a subtype of Zarr.AbstractStore and implement the following methods:

Zarr.storagesizeFunction

storagesize(d::AbstractStore)

This function shall return the size of all data files in a store.

source
Zarr.znameFunction
zname(d::AbstractStore)

Returns the name of the current variable.

source
Base.getindexMethod
Base.getindex(d::AbstractStore,i::String)

Returns the data stored in the given key as a Vector{UInt8}

source
Base.setindex!Method
Base.setindex!(d::AbstractStore,v,i::String)

Writes the values in v to the given store and key.

source
Zarr.subdirsFunction
subdirs(d::AbstractStore)

Returns a list of keys for children stores in the given store.

source
Base.keysMethod
Base.keys(d::AbstractStore)

Returns the keys of files in the given store.

source
Zarr.newsubFunction
newsub(d::AbstractStore, name::String)

Create a new Store as a child of the given store d with given name. Returns the new created substore.

source
Zarr.getsubFunction
getsub(d::AbstractStore, name::String)

Returns the child store of name name.

source

You can get some inspiration on how to implement this by looking at the source code of existing storage backends.