Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PersistentSlabStorage.GetAllChildReferences() #391

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,23 @@ func (s *PersistentSlabStorage) existIfLoaded(id StorageID) bool {
return false
}

// GetAllChildReferences returns child references of given slab (all levels),
// including nested container and theirs child references.
func (s *PersistentSlabStorage) GetAllChildReferences(id StorageID) (
references []StorageID,
brokenReferences []StorageID,
err error,
) {
slab, found, err := s.Retrieve(id)
if err != nil {
return nil, nil, err
}
if !found {
return nil, nil, NewSlabNotFoundErrorf(id, fmt.Sprintf("failed to get root slab by id %s", id))
}
return s.getAllChildReferences(slab)
}

// getAllChildReferences returns child references of given slab (all levels).
func (s *PersistentSlabStorage) getAllChildReferences(slab Slab) (
references []StorageID,
Expand Down
Loading
Loading