本文整理汇总了Golang中github.com/janelia-flyem/dvid/storage.TKey类的典型用法代码示例。如果您正苦于以下问题:Golang TKey类的具体用法?Golang TKey怎么用?Golang TKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TKey类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: DecodeLabelTKey
func DecodeLabelTKey(tk storage.TKey) (label uint64, err error) {
ibytes, err := tk.ClassBytes(keyLabel)
if err != nil {
return
}
label = binary.BigEndian.Uint64(ibytes[0:8])
return
}
开发者ID:tartavull,项目名称:dvid,代码行数:8,代码来源:keys.go
示例2: DecodeSizeLabelTKey
// DecodeSizeLabelTKey returns a size and a label from a size+label key component.
func DecodeSizeLabelTKey(tk storage.TKey) (label, size uint64, err error) {
ibytes, err := tk.ClassBytes(keySizeLabel)
if err != nil {
return
}
size = binary.BigEndian.Uint64(ibytes[0:8])
label = binary.BigEndian.Uint64(ibytes[8:16])
return
}
开发者ID:hanslovsky,项目名称:dvid,代码行数:10,代码来源:keys.go
示例3: DecodeTKey
// DecodeTKey returns a label and block index bytes from a label block RLE key.
// The block index bytes are returned because different block indices may be used (e.g., CZYX),
// and its up to caller to determine which one is used for this particular key.
func DecodeTKey(tk storage.TKey) (label uint64, block dvid.IZYXString, err error) {
ibytes, err := tk.ClassBytes(keyLabelBlockRLE)
if err != nil {
return
}
label = binary.BigEndian.Uint64(ibytes[0:8])
block = dvid.IZYXString(ibytes[8:])
return
}
开发者ID:hanslovsky,项目名称:dvid,代码行数:12,代码来源:keys.go
示例4: DecodeBlockTKey
func DecodeBlockTKey(tk storage.TKey) (pt dvid.ChunkPoint3d, err error) {
ibytes, err := tk.ClassBytes(keyBlock)
if err != nil {
return
}
var idx dvid.IndexZYX
if err = idx.IndexFromBytes(ibytes); err != nil {
return
}
pt = dvid.ChunkPoint3d(idx)
return
}
开发者ID:tartavull,项目名称:dvid,代码行数:12,代码来源:keys.go
示例5: DecodeTypeLabelTKey
// DecodeTypeLabelTKey decodes a type-specific key into a (index type, label) tuple.
func DecodeTypeLabelTKey(tk storage.TKey) (i IndexType, label uint64, err error) {
var ibytes []byte
ibytes, err = tk.ClassBytes(keyTypeLabel)
if err != nil {
return
}
if len(ibytes) != 9 {
err = fmt.Errorf("labelsz label size type-specific key is wrong size: expected 9, got %d bytes", len(ibytes))
return
}
i = IndexType(ibytes[0])
label = binary.BigEndian.Uint64(ibytes[1:])
return
}
开发者ID:tartavull,项目名称:dvid,代码行数:15,代码来源:keys.go
示例6: DecodeTagTKey
// DecodeTagTKey returns the Tag corresponding to this type-specific key.
func DecodeTagTKey(tk storage.TKey) (Tag, error) {
ibytes, err := tk.ClassBytes(keyTag)
if err != nil {
return "", err
}
sz := len(ibytes) - 1
if sz <= 0 {
return "", fmt.Errorf("empty tag")
}
if ibytes[sz] != 0 {
return "", fmt.Errorf("expected 0 byte ending tag key, got %d", ibytes[sz])
}
return Tag(ibytes[:sz]), nil
}
开发者ID:tartavull,项目名称:dvid,代码行数:15,代码来源:keys.go
示例7: DecodeTypeSizeLabelTKey
// DecodeTypeSizeLabelTKey decodes a type-specific key into a (index type, size, label) tuple.
func DecodeTypeSizeLabelTKey(tk storage.TKey) (i IndexType, sz uint32, label uint64, err error) {
var ibytes []byte
ibytes, err = tk.ClassBytes(keyTypeSizeLabel)
if err != nil {
return
}
if len(ibytes) != 13 {
err = fmt.Errorf("labelsz element size type-specific key is wrong size: expected 13, got %d bytes", len(ibytes))
return
}
i = IndexType(ibytes[0])
sz = math.MaxUint32 - binary.BigEndian.Uint32(ibytes[1:5])
label = binary.BigEndian.Uint64(ibytes[5:])
return
}
开发者ID:tartavull,项目名称:dvid,代码行数:16,代码来源:keys.go
注:本文中的github.com/janelia-flyem/dvid/storage.TKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论