This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathpin.go
71 lines (55 loc) · 1.99 KB
/
pin.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package iface
import (
"context"
path "github.com/ipfs/interface-go-ipfs-core/path"
"github.com/ipfs/interface-go-ipfs-core/options"
)
// Pin holds information about pinned resource
//
// Deprecated: use github.com/ipfs/boxo/coreiface.Pin
type Pin interface {
// Path to the pinned object
Path() path.Resolved
// Type of the pin
Type() string
// if not nil, an error happened. Everything else should be ignored.
Err() error
}
// PinStatus holds information about pin health
//
// Deprecated: use github.com/ipfs/boxo/coreiface.PinStatus
type PinStatus interface {
// Ok indicates whether the pin has been verified to be correct
Ok() bool
// BadNodes returns any bad (usually missing) nodes from the pin
BadNodes() []BadPinNode
}
// BadPinNode is a node that has been marked as bad by Pin.Verify
//
// Deprecated: use github.com/ipfs/boxo/coreiface.BadPinNode
type BadPinNode interface {
// Path is the path of the node
Path() path.Resolved
// Err is the reason why the node has been marked as bad
Err() error
}
// PinAPI specifies the interface to pining
//
// Deprecated: use github.com/ipfs/boxo/coreiface.PinAPI
type PinAPI interface {
// Add creates new pin, be default recursive - pinning the whole referenced
// tree
Add(context.Context, path.Path, ...options.PinAddOption) error
// Ls returns list of pinned objects on this node
Ls(context.Context, ...options.PinLsOption) (<-chan Pin, error)
// IsPinned returns whether or not the given cid is pinned
// and an explanation of why its pinned
IsPinned(context.Context, path.Path, ...options.PinIsPinnedOption) (string, bool, error)
// Rm removes pin for object specified by the path
Rm(context.Context, path.Path, ...options.PinRmOption) error
// Update changes one pin to another, skipping checks for matching paths in
// the old tree
Update(ctx context.Context, from path.Path, to path.Path, opts ...options.PinUpdateOption) error
// Verify verifies the integrity of pinned objects
Verify(context.Context) (<-chan PinStatus, error)
}