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 }
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()) }
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()) }
func serializeValue(value *goiso.SubGraph) []byte { return value.Serialize() }
func SerializeSubGraph(sg *goiso.SubGraph) []byte { return sg.Serialize() }