本文整理汇总了Golang中github.com/timtadh/goiso.SubGraph.Serialize方法的典型用法代码示例。如果您正苦于以下问题:Golang SubGraph.Serialize方法的具体用法?Golang SubGraph.Serialize怎么用?Golang SubGraph.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/timtadh/goiso.SubGraph
的用法示例。
在下文中一共展示了SubGraph.Serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Has
func (self *Fs2UniqueIndex) Has(sg *goiso.SubGraph) bool {
self.mutex.Lock()
defer self.mutex.Unlock()
key := sg.Serialize()
if len(key) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(key), sg, key))
}
has, err := self.bpt.Has(key)
assert_ok(err)
return has
}
示例2: Add
func (self *Fs2UniqueIndex) Add(sg *goiso.SubGraph) {
self.mutex.Lock()
defer self.mutex.Unlock()
if sg == nil {
panic(fmt.Errorf("sg was a nil\n%p", sg))
}
key := sg.Serialize()
if len(key) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(key), sg, key))
}
assert_ok(self.bpt.Add(key, []byte{}))
has, err := self.bpt.Has(key)
assert_ok(err)
if !has {
panic("didn't have key just added")
}
// assert_ok(self.bf.Sync())
}
示例3: Add
func (self *Fs2BpTree) Add(key []byte, sg *goiso.SubGraph) {
self.mutex.Lock()
defer self.mutex.Unlock()
if len(key) < 0 {
panic(fmt.Errorf("Key was a bad value %d %v %p\n%p", len(key), key, key, sg))
}
if sg == nil {
panic(fmt.Errorf("sg was a nil %d %v %p\n%p", len(key), key, key, sg))
}
value := sg.Serialize()
if len(value) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(value), sg, value))
}
assert_ok(self.bpt.Add(key, value))
has, err := self.bpt.Has(key)
assert_ok(err)
if !has {
panic("didn't have key just added")
}
// assert_ok(self.bf.Sync())
}
示例4: serializeValue
func serializeValue(value *goiso.SubGraph) []byte {
return value.Serialize()
}
示例5: SerializeSubGraph
func SerializeSubGraph(sg *goiso.SubGraph) []byte {
return sg.Serialize()
}