neuroglancer_uint64_sharded
Key-Value Store driver¶
The neuroglancer_uint64_sharded
driver implements support for the
Neuroglancer Precomputed sharded format
on top of a base key-value store.
Within the key-value store interface, which uses strings as keys, the uint64 keys are encoded as 8-byte big endian values.
- json kvstore/neuroglancer_uint64_sharded : object¶
Read/write adapter for the Neuroglancer Precomputed sharded format.
JSON specification of the key-value store.
- Required members:¶
-
driver :
"neuroglancer_uint64_sharded"
¶
- metadata : kvstore/neuroglancer_uint64_sharded/ShardingSpec¶
Specifies the sharding format.
-
driver :
- Optional members:¶
- path : string¶
Key prefix within the key-value store.
If the prefix is intended to correspond to a Unix-style directory path, it should end with
"/"
.
-
cache_pool : ContextResource =
"cache_pool"
¶ Specifies or references a previously defined
Context.cache_pool
. It is normally more convenient to specify a defaultcache_pool
in thecontext
.Important
It is very helpful to specify a cache pool with a non-zero
total_bytes_limit
value. Otherwise, every read operation will require 2 additional reads, to read the shard index and the minishard index.
-
data_copy_concurrency : ContextResource =
"data_copy_concurrency"
¶ Specifies or references a previously defined
Context.data_copy_concurrency
. It is normally more convenient to specify a defaultdata_copy_concurrency
in thecontext
.
- json kvstore/neuroglancer_uint64_sharded/ShardingSpec : object¶
Sharding metadata
Specifies the sharded format within the
kvstore/neuroglancer_uint64_sharded.metadata
anddriver/neuroglancer_precomputed.scale_metadata
properties.- Required members:¶
-
@type :
"neuroglancer_uint64_sharded_v1"
¶
-
preshift_bits : integer[
0
,64
]¶ Number of low-order bits of the chunk ID that do not contribute to the hashed chunk ID.
-
hash :
"identity"
|"murmurhash3_x86_128"
¶ Specifies the hash function used to map chunk IDs to shards.
-
minishard_bits : integer[
0
,64
]¶ Number of bits of the hashed chunk ID that determine the minishard number.
The number of minishards within each shard is equal to \(2^{\mathrm{minishard\_bits}}\). The minishard number is equal to bits
[0, minishard_bits)
of the hashed chunk id.
-
shard_bits : integer[
0
,64
]¶ Number of bits of the hashed chunk ID that determine the shard number.
The number of shards is equal to \(2^{\mathrm{shard\_bits}}\). The shard number is equal to bits
[minishard_bits, minishard_bits+shard_bits)
of the hashed chunk ID.
-
@type :
Example JSON specifications¶
{
"driver": "neuroglancer_uint64_sharded",
"kvstore": "gs://my-bucket/path/to/sharded/data/",
"metadata": {
"@type": "neuroglancer_uint64_sharded_v1",
"hash": "identity",
"preshift_bits": 1,
"minishard_bits": 3,
"shard_bits": 3,
"data_encoding": "raw",
"minishard_index_encoding": "gzip",
},
"context": {
"cache_pool": {"total_bytes_limit": 1000000000}
}
}
{
"driver": "neuroglancer_uint64_sharded",
"kvstore": "gs://my-bucket/path/to/sharded/data/",
"metadata": {
"@type": "neuroglancer_uint64_sharded_v1",
"hash": "murmurhash3_x86_128",
"preshift_bits": 0,
"minishard_bits": 3,
"shard_bits": 3,
"data_encoding": "raw",
"minishard_index_encoding": "gzip",
},
"context": {
"cache_pool": {"total_bytes_limit": 1000000000}
}
}
Limitations¶
It is strongly recommended to use a transaction when writing, and group writes by shard (one transaction per shard). Otherwise, there may be significant write amplification due to repeatedly re-writing the entire shard.