MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Persist

Method Persist

main.go:136–152  ·  view source on GitHub ↗
(wr io.Writer)

Source from the content-addressed store, hash-verified

134func (s *snap) Done(path string) {}
135
136func (s *snap) Persist(wr io.Writer) error {
137 sw := sds.NewWriter(wr)
138 iter := s.s.NewIterator(nil, nil)
139 for ok := iter.First(); ok; ok = iter.Next() {
140 if err := sw.WriteBytes(iter.Key()); err != nil {
141 return err
142 }
143 if err := sw.WriteBytes(iter.Value()); err != nil {
144 return err
145 }
146 }
147 iter.Release()
148 if err := iter.Error(); err != nil {
149 return err
150 }
151 return sw.Flush()
152}
153
154func snapshot(data interface{}) (rafthub.Snapshot, error) {
155 s, err := db.GetSnapshot()

Callers

nothing calls this directly

Calls 6

FirstMethod · 0.95
NextMethod · 0.95
KeyMethod · 0.95
ValueMethod · 0.95
NewIteratorMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected