neuronjson

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Overview

This file supports the keyspace for the keyvalue data type.

Package neuronjson implements DVID support for neuron JSON annotations

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/neuronjson"
	TypeName = "neuronjson"
)

Variables

View Source
var MaxAnnotationTKey = storage.MaxTKey(keyAnnotation)
View Source
var MinAnnotationTKey = storage.MinTKey(keyAnnotation)

Functions

func DecodeTKey

func DecodeTKey(tk storage.TKey) (string, error)

DecodeTKey returns the string of the bodyid used for this annotation.

func NewJSONSchemaTKey added in v0.9.17

func NewJSONSchemaTKey() (storage.TKey, error)

NewJSONSchemaTKey returns a TKey for JSON validation schema storage.

func NewSchemaBatchTKey

func NewSchemaBatchTKey() (storage.TKey, error)

NewSchemaBatchTKey returns a TKey for batch schema storage.

func NewSchemaTKey

func NewSchemaTKey() (storage.TKey, error)

NewSchemaTKey returns a TKey for schema storage.

func NewTKey

func NewTKey(key string) (storage.TKey, error)

NewTKey returns a TKey for the annotation kv pairs.

Types

type Data

type Data struct {
	*datastore.Data
	// contains filtered or unexported fields
}

Data embeds the datastore's Data and extends it with neuronjson properties.

func GetByUUIDName

func GetByUUIDName(uuid dvid.UUID, name dvid.InstanceName) (*Data, error)

GetByUUIDName returns a pointer to labelblk data given a UUID and data name.

func (*Data) DeleteData

func (d *Data) DeleteData(ctx storage.VersionedCtx, keyStr string) error

DeleteData deletes a key-value pair

func (*Data) DescribeTKeyClass

func (d *Data) DescribeTKeyClass(tkc storage.TKeyClass) string

DescribeTKeyClass returns a string explanation of what a particular TKeyClass is used for. Implements the datastore.TKeyClassDescriber interface.

func (*Data) DoRPC

func (d *Data) DoRPC(request datastore.Request, reply *datastore.Response) error

DoRPC acts as a switchboard for RPC commands.

func (*Data) Equals

func (d *Data) Equals(d2 *Data) bool

func (*Data) GetAll

func (d *Data) GetAll(ctx storage.VersionedCtx, fieldMap map[string]struct{}, showFields Fields) (ListNeuronJSON, error)

func (*Data) GetData

func (d *Data) GetData(ctx storage.VersionedCtx, keyStr string, fieldMap map[string]struct{}, showFields Fields) ([]byte, bool, error)

GetData gets a byte value using a key

func (*Data) GetFields

func (d *Data) GetFields(ctx storage.VersionedCtx) ([]string, error)

func (*Data) GetKeys

func (d *Data) GetKeys(ctx storage.VersionedCtx) (out []string, err error)

func (*Data) GetKeysInRange

func (d *Data) GetKeysInRange(ctx storage.VersionedCtx, keyBeg, keyEnd string) (keys []string, err error)

GetKeysInRange returns all keys in the range [keyBeg, keyEnd]. Results on HEAD are ordered by integer key, while results on other branches are ordered lexicographically.

func (*Data) GobDecode

func (d *Data) GobDecode(b []byte) error

func (*Data) GobEncode

func (d *Data) GobEncode() ([]byte, error)

func (*Data) Help

func (d *Data) Help() string

func (*Data) Initialize added in v0.9.17

func (d *Data) Initialize()

Initialize loads mutable properties of the neuronjson data instance, which in this case is the in-memory neuron json map for the specified versions.

func (*Data) IsMutationRequest added in v1.0.0

func (d *Data) IsMutationRequest(action, endpoint string) bool

IsMutationRequest overrides the default behavior to specify POST /query as an immutable request.

func (*Data) JSONString

func (d *Data) JSONString() (jsonStr string, err error)

JSONString returns the JSON for this Data's configuration

func (*Data) KeyExists

func (d *Data) KeyExists(ctx storage.VersionedCtx, keyStr string) (found bool, err error)

KeyExists returns true if a key is found.

func (*Data) MarshalJSON

func (d *Data) MarshalJSON() ([]byte, error)

func (*Data) PutData

func (d *Data) PutData(ctx *datastore.VersionedCtx, keyStr string, value []byte, conditionals []string, replace bool) error

PutData puts a valid JSON []byte into a neuron key at a given uuid. If replace is true, will use given value instead of updating fields that were given. If field values are given but do not change, the _user and _time fields will not be updated.

func (*Data) Query added in v0.9.17

func (d *Data) Query(ctx *datastore.VersionedCtx, w http.ResponseWriter, uuid dvid.UUID, onlyid bool, fieldMap map[string]struct{}, showFields Fields, in io.ReadCloser) (err error)

Query reads POSTed data and returns JSON.

func (*Data) ServeHTTP

func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, r *http.Request) (activity map[string]interface{})

ServeHTTP handles all incoming HTTP requests for this data.

type FieldExistence added in v1.0.0

type FieldExistence bool // field is present or not

type Fields added in v0.9.17

type Fields uint8
const (
	ShowBasic Fields = iota
	ShowUsers
	ShowTime
	ShowAll
)

func (Fields) Bools added in v1.0.0

func (f Fields) Bools() (showUser, showTime bool)

type ListNeuronJSON added in v0.9.17

type ListNeuronJSON []NeuronJSON

func (*ListNeuronJSON) Len added in v1.0.0

func (lnj *ListNeuronJSON) Len() int

func (*ListNeuronJSON) Less added in v1.0.0

func (lnj *ListNeuronJSON) Less(i, j int) bool

func (*ListNeuronJSON) Swap added in v1.0.0

func (lnj *ListNeuronJSON) Swap(i, j int)

type ListQueryJSON added in v0.9.17

type ListQueryJSON []QueryJSON

type NeuronJSON added in v0.9.17

type NeuronJSON map[string]interface{}

func (*NeuronJSON) UnmarshalJSON added in v0.9.17

func (nj *NeuronJSON) UnmarshalJSON(jsonText []byte) error

UnmarshalJSON parses JSON with numbers preferentially converted to uint64 or int64 if negative.

type QueryJSON added in v0.9.17

type QueryJSON map[string]interface{}

func (*QueryJSON) UnmarshalJSON added in v0.9.17

func (qj *QueryJSON) UnmarshalJSON(jsonText []byte) error

UnmarshalJSON parses JSON with numbers preferentially converted to uint64 or int64 if negative, and strings with "re/" as prefix are compiled as a regular expression.

type Schema added in v1.0.0

type Schema uint8

Schema describe various formats for neuron annotations

const (
	// JSONSchema is validation JSON schema for annotations
	JSONSchema Schema = iota

	// NeuSchema is JSON for neutu/neu3 clients
	NeuSchema

	// NeuSchemaBatch is JSON for neutu/neu3 clients
	NeuSchemaBatch
)

func (Schema) String added in v1.0.0

func (m Schema) String() string

type Type

type Type struct {
	datastore.Type
}

Type embeds the datastore's Type to create a unique type for neuronjson functions.

func NewType

func NewType() *Type

NewType returns a pointer to a new neuronjson Type with default values set.

func (*Type) Help

func (dtype *Type) Help() string

func (*Type) NewDataService

func (dtype *Type) NewDataService(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (datastore.DataService, error)

NewDataService returns a pointer to new neuronjson data with default values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL