-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
errservice.go
47 lines (37 loc) · 1.14 KB
/
errservice.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package merkledag
import (
"context"
ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format"
cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid"
)
// ErrorService implements ipld.DAGService, returning 'Err' for every call.
type ErrorService struct {
Err error
}
var _ ipld.DAGService = (*ErrorService)(nil)
// Add returns the cs.Err.
func (cs *ErrorService) Add(ctx context.Context, nd ipld.Node) error {
return cs.Err
}
// AddMany returns the cs.Err.
func (cs *ErrorService) AddMany(ctx context.Context, nds []ipld.Node) error {
return cs.Err
}
// Get returns the cs.Err.
func (cs *ErrorService) Get(ctx context.Context, c *cid.Cid) (ipld.Node, error) {
return nil, cs.Err
}
// GetMany many returns the cs.Err.
func (cs *ErrorService) GetMany(ctx context.Context, cids []*cid.Cid) <-chan *ipld.NodeOption {
ch := make(chan *ipld.NodeOption)
close(ch)
return ch
}
// Remove returns the cs.Err.
func (cs *ErrorService) Remove(ctx context.Context, c *cid.Cid) error {
return cs.Err
}
// RemoveMany returns the cs.Err.
func (cs *ErrorService) RemoveMany(ctx context.Context, cids []*cid.Cid) error {
return cs.Err
}