Documentation ¶
Overview ¶
Package labels supports label-based data types like labelblk, labelvol, labelsurf, labelsz, etc. Basic 64-bit label data and deltas are kept here so all label-based data types can use them without cyclic package dependencies, especially when writing code to synchronize across data instances.
Index ¶
- Constants
- Variables
- type Counts
- type DeleteBlock
- type DeltaDeleteSize
- type DeltaMerge
- type DeltaMergeEnd
- type DeltaMergeStart
- type DeltaModSize
- type DeltaNewSize
- type DeltaReplaceSize
- type DeltaSparsevol
- type DeltaSplit
- type DeltaSplitEnd
- type DeltaSplitStart
- type DirtyCache
- func (d *DirtyCache) AddMerge(iv dvid.InstanceVersion, op MergeOp)
- func (d *DirtyCache) Decr(iv dvid.InstanceVersion, label uint64)
- func (d *DirtyCache) Empty(iv dvid.InstanceVersion) bool
- func (d *DirtyCache) Incr(iv dvid.InstanceVersion, label uint64)
- func (d *DirtyCache) IsDirty(iv dvid.InstanceVersion, label uint64) bool
- func (d *DirtyCache) RemoveMerge(iv dvid.InstanceVersion, op MergeOp)
- type Mapping
- type MergeOp
- type MergeTuple
- type Set
Constants ¶
const ( ChangeBlockEvent = imageblk.ChangeBlockEvent DeleteBlockEvent = imageblk.DeleteBlockEvent SparsevolStartEvent = "SPARSEVOL_START" SparsevolModEvent = "SPARSEVOL_MOD" SparsevolEndEvent = "SPARSEVOL_END" ChangeSizeEvent = "LABEL_SIZE_CHANGE" MergeStartEvent = "MERGE_START" MergeBlockEvent = "MERGE_BLOCK" MergeEndEvent = "MERGE_END" SplitStartEvent = "SPLIT_START" SplitLabelEvent = "SPLIT_LABEL" SplitEndEvent = "SPLIT_END" )
Label change event identifiers
const ( // MaxAllowedLabel is the largest label that should be allowed by DVID if we want to take // into account the maximum integer size within Javascript (due to its underlying use of // a double float for numbers). // This would circumvent the need to use strings within JSON (e.g., the Google solution) // to represent integer labels that could exceed the max javascript number. It would // require adding a value check on each label voxel of a mutation request, which might // be too much of a hit to handle an edge case. MaxAllowedLabel = 9007199254740991 )
Variables ¶
var ( // MergeCache is a thread-safe cache for merge operations that provides // the current label mapping for any version of a data instance. MergeCache mergeCache )
Functions ¶
This section is empty.
Types ¶
type DeleteBlock ¶
DeleteBlock encapsulates data necessary to delete blocks of labels.
type DeltaDeleteSize ¶
type DeltaDeleteSize struct { Label uint64 OldSize uint64 OldKnown bool // true if OldSize is valid, otherwise delete all size k/v for this label. }
DeltaDeleteSize gives info to delete a label's size.
type DeltaMerge ¶
type DeltaMerge struct { MergeOp Blocks map[dvid.IZYXString]struct{} }
DeltaMerge describes the labels and blocks affected by a merge operation. It is sent during a MergeBlockEvent.
type DeltaMergeEnd ¶
type DeltaMergeEnd struct {
MergeOp
}
DeltaMergeEnd is the data sent during a MergeEndEvent.
type DeltaMergeStart ¶
type DeltaMergeStart struct {
MergeOp
}
DeltaMergeStart is the data sent during a MergeStartEvent.
type DeltaModSize ¶
DeltaModSize gives info to modify an existing label size without knowing the old size.
type DeltaNewSize ¶
DeltaNewSize is a new label being introduced.
type DeltaReplaceSize ¶
DeltaReplaceSize gives info to precisely remove an old label size and add the updated size.
type DeltaSparsevol ¶
DeltaSparsevol describes a change to an existing label.
type DeltaSplit ¶
type DeltaSplit struct { OldLabel uint64 NewLabel uint64 Split dvid.BlockRLEs SortedBlocks dvid.IZYXSlice }
DeltaSplit describes the voxels modified during a split operation. The Split field may be null if this is a coarse split only defined by block indices.
type DeltaSplitEnd ¶
DeltaSplitEnd is the data sent during a SplitEndEvent.
type DeltaSplitStart ¶
DeltaSplitStart is the data sent during a SplitStartEvent.
type DirtyCache ¶
DirtyCache tracks dirty labels across versions
func (*DirtyCache) AddMerge ¶
func (d *DirtyCache) AddMerge(iv dvid.InstanceVersion, op MergeOp)
func (*DirtyCache) Decr ¶
func (d *DirtyCache) Decr(iv dvid.InstanceVersion, label uint64)
func (*DirtyCache) Empty ¶
func (d *DirtyCache) Empty(iv dvid.InstanceVersion) bool
func (*DirtyCache) Incr ¶
func (d *DirtyCache) Incr(iv dvid.InstanceVersion, label uint64)
func (*DirtyCache) IsDirty ¶
func (d *DirtyCache) IsDirty(iv dvid.InstanceVersion, label uint64) bool
func (*DirtyCache) RemoveMerge ¶
func (d *DirtyCache) RemoveMerge(iv dvid.InstanceVersion, op MergeOp)
type Mapping ¶
Mapping is an immutable thread-safe mapping of labels to labels.
func (Mapping) FinalLabel ¶
FinalLabel follows mappings from a start label until a final mapped label is reached.
type MergeTuple ¶
type MergeTuple []uint64
MergeTuple represents a merge of labels. Its first element is the destination label and all later elements in the slice are labels to be merged. It's an easy JSON representation as a list of labels.
func (MergeTuple) Op ¶
func (t MergeTuple) Op() (MergeOp, error)
Op converts a MergeTuple into a MergeOp.