Commit 0f57633a authored by tavit ohanian's avatar tavit ohanian

Merge branch 'port-2021-04-19'

parents 70c42886 6061d83b
Pipeline #930 passed with stages
in 12 seconds
......@@ -5,7 +5,7 @@ import (
"errors"
"runtime"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
// parallelBatchCommits is the number of batch commits that can be in-flight before blocking.
......
......@@ -5,7 +5,7 @@ import (
"sync"
"testing"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
// Test dag
......
......@@ -4,7 +4,7 @@ import (
"fmt"
"sync"
blocks "gitlab.dms3.io/dms3/public/go-block-format"
blocks "gitlab.dms3.io/dms3/go-block-format"
)
// DecodeBlockFunc functions decode blocks into nodes.
......
......@@ -5,8 +5,8 @@ import (
"testing"
mh "github.com/multiformats/go-multihash"
blocks "gitlab.dms3.io/dms3/public/go-block-format"
cid "gitlab.dms3.io/dms3/public/go-cid"
blocks "gitlab.dms3.io/dms3/go-block-format"
cid "gitlab.dms3.io/dms3/go-cid"
)
func init() {
......
......@@ -3,7 +3,7 @@ package format
import (
"context"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
// GetLinks returns the CIDs of the children of the given node. Prefer this
......
......@@ -5,7 +5,7 @@ import (
"testing"
mh "github.com/multiformats/go-multihash"
"gitlab.dms3.io/dms3/public/go-cid"
"gitlab.dms3.io/dms3/go-cid"
)
type TestNode struct {
......
......@@ -4,9 +4,9 @@ import (
"context"
"fmt"
blocks "gitlab.dms3.io/dms3/public/go-block-format"
blocks "gitlab.dms3.io/dms3/go-block-format"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
type Resolver interface {
......@@ -19,7 +19,7 @@ type Resolver interface {
Tree(path string, depth int) []string
}
// Node is the base interface all DMS3LD nodes must implement.
// Node is the base interface all LD nodes must implement.
//
// Nodes are **Immutable** and all methods defined on the interface are
// **Thread Safe**.
......
......@@ -5,7 +5,7 @@ import (
"testing"
mh "github.com/multiformats/go-multihash"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
type EmptyNode struct{}
......
github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50=
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs=
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ=
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo=
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ=
......@@ -26,12 +10,8 @@ github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp
github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA=
github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4=
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA=
github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs=
github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk=
github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc=
github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ=
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
github.com/multiformats/go-multihash v0.0.14 h1:QoBceQYQQtNUuf6s7wHxnE2c8bhbMqhfGzNI032se/I=
github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
......@@ -40,22 +20,21 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
gitlab.dms3.io/dms3/public/go-block-format v0.0.1 h1:PQ6+E7zY6kUIHET86uJTQHTTj4Z9ZNfP7w281ZdExgk=
gitlab.dms3.io/dms3/public/go-block-format v0.0.1/go.mod h1:xlvtW/OF72rOzLa2RVWXX2Uw18qTAWTQEs/Xp7SCnuY=
gitlab.dms3.io/dms3/public/go-cid v0.0.0 h1:DKvGTYv5GqSEeVLfQAHBbsFZuWCZFNK5BHdBFykF45E=
gitlab.dms3.io/dms3/public/go-cid v0.0.1 h1:qs4dtkDigcLGY/58dIZaFjKLt+orrTcmTBvtqaM3570=
gitlab.dms3.io/dms3/public/go-cid v0.0.1/go.mod h1:GQw3gc4CSrFY+aX6M+OBQDlg0p5/eQJoRrayaZzkAOQ=
gitlab.dms3.io/dms3/public/go-dms3-util v0.0.1 h1:Gd+kJl1Rc+ZEUb9CIS1ZctQnF9G1oruNFyxUC//QBUQ=
gitlab.dms3.io/dms3/public/go-dms3-util v0.0.1/go.mod h1:ymlwtzTNMq8Ug+gVtPAMxXKCKTXwXJAzXS+SUihfKgo=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
gitlab.dms3.io/dms3/go-block-format v0.0.3 h1:3gPZUNu5UavbZxbMNd4NDTLG53O7MbmYSwntQwZGKxI=
gitlab.dms3.io/dms3/go-block-format v0.0.3/go.mod h1:IbZAFf3fFJa8YW98gaSg/iO9GKtsgVs6+N8OVHmFw1I=
gitlab.dms3.io/dms3/go-cid v0.0.3 h1:5qZ1sl1Bi26naLz7Vsc8fjWcJKX8bR6njt3WPCteXac=
gitlab.dms3.io/dms3/go-cid v0.0.3/go.mod h1:qT/Q1NZD31UnWQ+rwsQgzGrrsQhpq7dYSlXf7ulDgtk=
gitlab.dms3.io/dms3/go-dms3-util v0.0.2 h1:xXHeLaht5szd3QPdQp5KcfmXbIyRvRPSdQnMkJPRgPo=
gitlab.dms3.io/dms3/go-dms3-util v0.0.2/go.mod h1:5hPwxzo5zK4NeHE/anWIQGHcIoG7aTl9/Pp0j2zg0l8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0=
golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8=
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
......@@ -4,7 +4,7 @@ import (
"context"
"fmt"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
var ErrNotFound = fmt.Errorf("merkledag: not found")
......@@ -43,7 +43,7 @@ type NodeAdder interface {
type LinkGetter interface {
NodeGetter
// TODO(dms3/go-dms3ld-format#9): This should return []cid.Cid
// TODO(dms3/go-ld-format#9): This should return []cid.Cid
// GetLinks returns the children of the node refered to by the given
// CID.
......
......@@ -3,12 +3,12 @@ package format
import (
"context"
cid "gitlab.dms3.io/dms3/public/go-cid"
cid "gitlab.dms3.io/dms3/go-cid"
)
// NavigableDMS3LDNode implements the `NavigableNode` interface wrapping
// an DMS3LD `Node` and providing support for node promises.
type NavigableDMS3LDNode struct {
// NavigableLDNode implements the `NavigableNode` interface wrapping
// an LD `Node` and providing support for node promises.
type NavigableLDNode struct {
node Node
// The CID of each child of the node.
......@@ -24,10 +24,10 @@ type NavigableDMS3LDNode struct {
// to be replicated (the entire DAG will use the same `NodeGetter`).
}
// NewNavigableDMS3LDNode returns a `NavigableDMS3LDNode` wrapping the provided
// NewNavigableLDNode returns a `NavigableLDNode` wrapping the provided
// `node`.
func NewNavigableDMS3LDNode(node Node, nodeGetter NodeGetter) *NavigableDMS3LDNode {
nn := &NavigableDMS3LDNode{
func NewNavigableLDNode(node Node, nodeGetter NodeGetter) *NavigableLDNode {
nn := &NavigableLDNode{
node: node,
nodeGetter: nodeGetter,
}
......@@ -41,7 +41,7 @@ func NewNavigableDMS3LDNode(node Node, nodeGetter NodeGetter) *NavigableDMS3LDNo
// FetchChild implements the `NavigableNode` interface using node promises
// to preload the following child nodes to `childIndex` leaving them ready
// for subsequent `FetchChild` calls.
func (nn *NavigableDMS3LDNode) FetchChild(ctx context.Context, childIndex uint) (NavigableNode, error) {
func (nn *NavigableLDNode) FetchChild(ctx context.Context, childIndex uint) (NavigableNode, error) {
// This function doesn't check that `childIndex` is valid, that's
// the `Walker` responsibility.
......@@ -76,7 +76,7 @@ func (nn *NavigableDMS3LDNode) FetchChild(ctx context.Context, childIndex uint)
return nil, err
}
return NewNavigableDMS3LDNode(child, nn.nodeGetter), nil
return NewNavigableLDNode(child, nn.nodeGetter), nil
}
// Number of nodes to preload every time a child is requested.
......@@ -86,7 +86,7 @@ const preloadSize = 10
// Preload at most `preloadSize` child nodes from `beg` through promises
// created using this `ctx`.
func (nn *NavigableDMS3LDNode) preload(ctx context.Context, beg uint) {
func (nn *NavigableLDNode) preload(ctx context.Context, beg uint) {
end := beg + preloadSize
if end >= uint(len(nn.childCIDs)) {
end = uint(len(nn.childCIDs))
......@@ -101,7 +101,7 @@ func (nn *NavigableDMS3LDNode) preload(ctx context.Context, beg uint) {
//
// TODO: Include `preload` into the beginning of this function?
// (And collapse the two calls in `FetchChild`).
func (nn *NavigableDMS3LDNode) getPromiseValue(ctx context.Context, childIndex uint) (Node, error) {
func (nn *NavigableLDNode) getPromiseValue(ctx context.Context, childIndex uint) (Node, error) {
value, err := nn.childPromises[childIndex].Get(ctx)
nn.childPromises[childIndex] = nil
return value, err
......@@ -118,32 +118,32 @@ func getLinkCids(node Node) []cid.Cid {
return out
}
// GetDMS3LDNode returns the DMS3LD `Node` wrapped into this structure.
func (nn *NavigableDMS3LDNode) GetDMS3LDNode() Node {
// GetLDNode returns the LD `Node` wrapped into this structure.
func (nn *NavigableLDNode) GetLDNode() Node {
return nn.node
}
// ChildTotal implements the `NavigableNode` returning the number
// of links (of child nodes) in this node.
func (nn *NavigableDMS3LDNode) ChildTotal() uint {
return uint(len(nn.GetDMS3LDNode().Links()))
func (nn *NavigableLDNode) ChildTotal() uint {
return uint(len(nn.GetLDNode().Links()))
}
// ExtractDMS3LDNode is a helper function that takes a `NavigableNode`
// and returns the DMS3LD `Node` wrapped inside. Used in the `Visitor`
// ExtractLDNode is a helper function that takes a `NavigableNode`
// and returns the LD `Node` wrapped inside. Used in the `Visitor`
// function.
// TODO: Check for errors to avoid a panic?
func ExtractDMS3LDNode(node NavigableNode) Node {
return node.GetDMS3LDNode()
func ExtractLDNode(node NavigableNode) Node {
return node.GetLDNode()
}
// TODO: `Cleanup` is not supported at the moment in the `Walker`.
//
// Called in `Walker.up()` when the node is not part of the path anymore.
//func (nn *NavigableDMS3LDNode) Cleanup() {
//func (nn *NavigableLDNode) Cleanup() {
// // TODO: Ideally this would be the place to issue a context `cancel()`
// // but since the DAG reader uses multiple contexts in the same session
// // (through `Read` and `CtxReadFull`) we would need to store an array
// // with the multiple contexts in `NavigableDMS3LDNode` with its corresponding
// // with the multiple contexts in `NavigableLDNode` with its corresponding
// // cancel functions.
//}
......@@ -16,7 +16,7 @@ import (
// read data from those nodes and, optionally, direct the movement of
// the Walker by calling `Pause` (to stop traversing and return) or
// `NextChild` (to skip a child and its descendants). See the DAG reader
// in `gitlab.dms3.io/dms3/public/go-unixfs/io/dagreader.go` for a usage example.
// in `gitlab.dms3.io/dms3/go-unixfs/io/dagreader.go` for a usage example.
// TODO: This example isn't merged yet.
type Walker struct {
......@@ -64,7 +64,7 @@ type Walker struct {
// Used to pass information from the central `Walker` structure to the
// distributed `NavigableNode`s (to have a centralized configuration
// structure to control the behavior of all of them), e.g., to tell
// the `NavigableDMS3LDNode` which context should be used to load node
// the `NavigableLDNode` which context should be used to load node
// promises (but this could later be used in more elaborate ways).
ctx context.Context
}
......@@ -116,8 +116,8 @@ type NavigableNode interface {
// ChildTotal returns the number of children of the `ActiveNode`.
ChildTotal() uint
// GetDMS3LDNode returns actual DMS3LD Node
GetDMS3LDNode() Node
// GetLDNode returns actual LD Node
GetLDNode() Node
// TODO: Evaluate providing the `Cleanup` and `Reset` methods.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment