github.com/sunrise-zone/sunrise-node@v0.13.1-sr2/share/ipld/utils.go (about) 1 package ipld 2 3 import ( 4 "github.com/ipfs/go-cid" 5 6 "github.com/sunrise-zone/sunrise-node/share" 7 ) 8 9 // FilterRootByNamespace returns the row roots from the given share.Root that contain the namespace. 10 func FilterRootByNamespace(root *share.Root, namespace share.Namespace) []cid.Cid { 11 rowRootCIDs := make([]cid.Cid, 0, len(root.RowRoots)) 12 for _, row := range root.RowRoots { 13 if !namespace.IsOutsideRange(row, row) { 14 rowRootCIDs = append(rowRootCIDs, MustCidFromNamespacedSha256(row)) 15 } 16 } 17 return rowRootCIDs 18 }