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
- func MergeStart(iv dvid.InstanceVersion, op MergeOp) error
- func MergeStop(iv dvid.InstanceVersion, op MergeOp)
- func SplitStart(iv dvid.InstanceVersion, op DeltaSplitStart) error
- func SplitStop(iv dvid.InstanceVersion, op DeltaSplitEnd)
- 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 Mapping
- type MergeOp
- type MergeTuple
- type Set
Constants ¶
const ( IngestBlockEvent = imageblk.IngestBlockEvent MutateBlockEvent = imageblk.MutateBlockEvent 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, leading to max int = 2^53 - 1). // 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 ¶
This section is empty.
Functions ¶
func MergeStart ¶ added in v0.8.0
func MergeStart(iv dvid.InstanceVersion, op MergeOp) error
MergeStart handles label map caches during an active merge operation. Note that if there are multiple synced label instances, the InstanceVersion will always be the labelblk instance. Multiple merges into a single label are allowed, but chained merges are not. For example, you can merge label 1, 2, and 3 into 4, then later merge 6 into 4. However, you cannot concurrently merge label 4 into some other label because there can be a race condition between 3 -> 4 and 4 -> X.
func MergeStop ¶ added in v0.8.0
func MergeStop(iv dvid.InstanceVersion, op MergeOp)
MergeStop marks the end of a merge operation.
func SplitStart ¶ added in v0.8.0
func SplitStart(iv dvid.InstanceVersion, op DeltaSplitStart) error
SplitStart checks current label map to see if the split conflicts.
func SplitStop ¶ added in v0.8.0
func SplitStop(iv dvid.InstanceVersion, op DeltaSplitEnd)
SplitStop marks the end of a split operation.
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 Mapping ¶
Mapping is a thread-safe, mapping of labels to labels in both forward and backward direction. Mutation of a Mapping instance can only be done through labels.MergeCache.
func LabelMap ¶ added in v0.8.0
func LabelMap(iv dvid.InstanceVersion) *Mapping
LabelMap returns a label mapping for a version of a data instance. If no label mapping is available, a nil is returned.
func (*Mapping) ConstituentLabels ¶ added in v0.8.0
ConstituentLabels returns a set of labels that will be mapped to the given label. The set will always include the given label.
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.