diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-13 16:25:33 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-19 00:45:10 -0400 |
commit | e5bd082182f410bb46aa7653e8af0b440ec3632b (patch) | |
tree | add8f38ea806c657cf4385e4d3737d1ffb34b56d /lib/btrfs/btrfstree/btree.go | |
parent | 0d6880131e90b43e03e0878dfc2ea2b6f0f2291e (diff) |
btrfstree: btree.go: Move TreeWalkHandler up in the file
Diffstat (limited to 'lib/btrfs/btrfstree/btree.go')
-rw-r--r-- | lib/btrfs/btrfstree/btree.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/btrfs/btrfstree/btree.go b/lib/btrfs/btrfstree/btree.go index e91fcc1..9713295 100644 --- a/lib/btrfs/btrfstree/btree.go +++ b/lib/btrfs/btrfstree/btree.go @@ -22,6 +22,25 @@ type TreeSearcher interface { Search(key btrfsprim.Key, size uint32) int } +type TreeWalkHandler struct { + // Callbacks for entire nodes. + // + // If any of these return an error that is io/fs.SkipDir, the + // node immediately stops getting processed; if PreNode, Node, + // or BadNode return io/fs.SkipDir then key pointers and items + // within the node are not processed. + PreNode func(Path) error + Node func(Path, *Node) error + BadNode func(Path, *Node, error) error + PostNode func(Path, *Node) error + // Callbacks for items on interior nodes + PreKeyPointer func(Path, KeyPointer) error + PostKeyPointer func(Path, KeyPointer) error + // Callbacks for items on leaf nodes + Item func(Path, Item) error + BadItem func(Path, Item) error +} + // TreeOperator is an interface for performing basic btree operations. type TreeOperator interface { // TreeWalk walks a tree, triggering callbacks for every node, @@ -62,25 +81,6 @@ type TreeOperator interface { TreeSearchAll(treeID btrfsprim.ObjID, search TreeSearcher) ([]Item, error) } -type TreeWalkHandler struct { - // Callbacks for entire nodes. - // - // If any of these return an error that is io/fs.SkipDir, the - // node immediately stops getting processed; if PreNode, Node, - // or BadNode return io/fs.SkipDir then key pointers and items - // within the node are not processed. - PreNode func(Path) error - Node func(Path, *Node) error - BadNode func(Path, *Node, error) error - PostNode func(Path, *Node) error - // Callbacks for items on interior nodes - PreKeyPointer func(Path, KeyPointer) error - PostKeyPointer func(Path, KeyPointer) error - // Callbacks for items on leaf nodes - Item func(Path, Item) error - BadItem func(Path, Item) error -} - type TreeError struct { Path Path Err error |