Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
go-ipfs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
ipfs
go-ipfs
Commits
ce57a766
Commit
ce57a766
authored
7 years ago
by
Jeromy Johnson
Browse files
Options
Downloads
Patches
Plain Diff
interface docs for pinner
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
2140aa95
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pin/pin.go
+31
-2
31 additions, 2 deletions
pin/pin.go
with
31 additions
and
2 deletions
pin/pin.go
+
31
−
2
View file @
ce57a766
...
...
@@ -46,11 +46,22 @@ const (
type
PinMode
int
const
(
// Recursive pins pin the target cids along with any reachable children.
Recursive
PinMode
=
iota
// Direct pins pin just the target cid.
Direct
// Indirect pins are cids who have some ancestor pinned recursively.
Indirect
// Internal pins are cids used to keep the internal state of the pinner.
Internal
// NotPinned
NotPinned
// Any refers to any pinned cid
Any
)
...
...
@@ -82,10 +93,20 @@ func StringToPinMode(s string) (PinMode, bool) {
}
type
Pinner
interface
{
// IsPinned returns whether or not the given cid is pinned
// and an explanation of why its pinned
IsPinned
(
*
cid
.
Cid
)
(
string
,
bool
,
error
)
// IsPinnedWithType returns whether or not the given cid is pinned with the
// given pin type, as well as returning the type of pin its pinned with.
IsPinnedWithType
(
*
cid
.
Cid
,
PinMode
)
(
string
,
bool
,
error
)
Pin
(
context
.
Context
,
node
.
Node
,
bool
)
error
Unpin
(
context
.
Context
,
*
cid
.
Cid
,
bool
)
error
// Pin the given node, optionally recursively.
Pin
(
ctx
context
.
Context
,
node
node
.
Node
,
recursive
bool
)
error
// Unpin the given cid. If recursive is true, removes either a recursive or
// a direct pin. If recursive is false, only removes a direct pin.
Unpin
(
ctx
context
.
Context
,
cid
*
cid
.
Cid
,
recursive
bool
)
error
// Update updates a recursive pin from one cid to another
// this is more efficient than simply pinning the new one and unpinning the
...
...
@@ -106,9 +127,17 @@ type Pinner interface {
// be successful.
RemovePinWithMode
(
*
cid
.
Cid
,
PinMode
)
// Flush writes the pin state to the backing datastore
Flush
()
error
// DirectKeys returns all directly pinned cids
DirectKeys
()
[]
*
cid
.
Cid
// DirectKeys returns all recursively pinned cids
RecursiveKeys
()
[]
*
cid
.
Cid
// InternalPins returns all cids kept pinned for the internal state of the
// pinner
InternalPins
()
[]
*
cid
.
Cid
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment