github.com/lbryio/lbcd@v0.22.119/claimtrie/node/repo.go (about) 1 package node 2 3 import ( 4 "github.com/lbryio/lbcd/claimtrie/change" 5 ) 6 7 // Repo defines APIs for Node to access persistence layer. 8 type Repo interface { 9 // AppendChanges saves changes into the repo. 10 // The changes can belong to different nodes, but the chronological 11 // order must be preserved for the same node. 12 AppendChanges(changes []change.Change) error 13 14 // LoadChanges loads changes of a node up to (includes) the specified height. 15 // If no changes found, both returned slice and error will be nil. 16 LoadChanges(name []byte) ([]change.Change, error) 17 18 DropChanges(name []byte, finalHeight int32) error 19 20 // Close closes the repo. 21 Close() error 22 23 // IterateChildren returns change sets for each of name.+ 24 // Return false on f to stop the iteration. 25 IterateChildren(name []byte, f func(changes []change.Change) bool) error 26 27 // IterateAll iterates keys until the predicate function returns false 28 IterateAll(predicate func(name []byte) bool) 29 30 Flush() error 31 }