func (self *Fs2BpTree) Remove(key []byte, where func(*goiso.SubGraph) bool) error { self.mutex.Lock() defer self.mutex.Unlock() return self.bpt.Remove(key, func(bytes []byte) bool { sg := goiso.DeserializeSubGraph(self.g, bytes) return where(sg) }) }
func (self *Fs2BpTree) kvIter(kvi fs2.Iterator) (it Iterator) { it = func() ([]byte, *goiso.SubGraph, Iterator) { self.mutex.Lock() defer self.mutex.Unlock() var key []byte var bytes []byte var err error key, bytes, err, kvi = kvi() // log.Println("kv iter", bytes, err, kvi) assert_ok(err) if kvi == nil { return nil, nil, nil } sg := goiso.DeserializeSubGraph(self.g, bytes) return key, sg, it } return it }
func DeserializeParentedSg(g *goiso.Graph, bytes []byte) *ParentedSg { lenP := binary.LittleEndian.Uint32(bytes[0:4]) lenSG := binary.LittleEndian.Uint32(bytes[4:8]) off := 8 parent := make([]byte, lenP) { s := off e := s + len(parent) copy(parent, bytes[s:e]) } off += len(parent) var sg *goiso.SubGraph { s := off e := s + int(lenSG) sg = goiso.DeserializeSubGraph(g, bytes[s:e]) } return NewParentedSg(parent, sg) }
func DeserializeSubGraph(g *goiso.Graph) func([]byte) *goiso.SubGraph { return func(bytes []byte) *goiso.SubGraph { return goiso.DeserializeSubGraph(g, bytes) } }