completed redb package

This commit is contained in:
pippellia-btc
2025-05-29 12:53:08 +02:00
parent 921b21d6c1
commit 28be0dbfbd
7 changed files with 315 additions and 17 deletions

View File

@@ -11,11 +11,17 @@ type cachedWalker struct {
fallback walks.Walker
}
func newCachedWalker(followsMap map[graph.ID][]graph.ID, fallback walks.Walker) *cachedWalker {
return &cachedWalker{
follows: followsMap,
func newCachedWalker(nodes []graph.ID, follows [][]graph.ID, fallback walks.Walker) *cachedWalker {
w := cachedWalker{
follows: make(map[graph.ID][]graph.ID, len(nodes)),
fallback: fallback,
}
for i, node := range nodes {
w.follows[node] = follows[i]
}
return &w
}
func (w *cachedWalker) Follows(ctx context.Context, node graph.ID) ([]graph.ID, error) {