-
Notifications
You must be signed in to change notification settings - Fork 33
Adding a new Datatype
DVID Datatypes allow customization of both the REST API and the way data is stored persistently. All current datatypes store data via key-value pairs. The developer chooses appropriate type-specific keys (storage.TKey), e.g., the labelblk datatype uses an encoded ZYX block coordinate as a type-specific key where its value is the serialized (compressed) slice of bytes representing the 64-bit labels for the 32 x 32 x 32 voxel block.
Please see the keyvalue datatype as a simple example of how to build a datatype. You create new datatype implementations by adding a Go package for the new datatype under the datatype directory. The keyvalue datatype is implemented with just three small files:
-
keyvalue.go
is the main file and includes the ServeHTTP() function that accepts the datatype-specific HTTP API requests, does computation, and returns the result. -
key.go
shows how keys encode a (X,Y,Z) block coordinate into a TKey. -
keyvalue_test.go
provides unit tests for the keyvalue datatype.
Note that when designing a TKey, the possible type-specific keys must be the same length or have a unique terminator that prevents one TKey being a prefix of another TKey.
Table of Contents
- DVID Overview
- Features
- Philosophy
- DVID Flexibility and Comparisons
- External Use of DVID
- Installation
- User's Guide
- Developer's Guide