Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
e6091be0
Commit
e6091be0
authored
Nov 19, 2014
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pin: Return copies of pinned keys, of each type (direct/indirect/recursive)
parent
ae6f00d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
pin/indirect.go
pin/indirect.go
+4
-0
pin/pin.go
pin/pin.go
+16
-4
No files found.
pin/indirect.go
View file @
e6091be0
...
...
@@ -65,3 +65,7 @@ func (i *indirectPin) Decrement(k util.Key) {
func
(
i
*
indirectPin
)
HasKey
(
k
util
.
Key
)
bool
{
return
i
.
blockset
.
HasKey
(
k
)
}
func
(
i
*
indirectPin
)
Set
()
set
.
BlockSet
{
return
i
.
blockset
}
pin/pin.go
View file @
e6091be0
...
...
@@ -33,7 +33,9 @@ type Pinner interface {
Unpin
(
util
.
Key
,
bool
)
error
Flush
()
error
GetManual
()
ManualPinner
Set
()
set
.
BlockSet
DirectKeys
()
[]
util
.
Key
IndirectKeys
()
[]
util
.
Key
RecursiveKeys
()
[]
util
.
Key
}
// ManualPinner is for manually editing the pin structure
...
...
@@ -208,9 +210,19 @@ func LoadPinner(d ds.Datastore, dserv mdag.DAGService) (Pinner, error) {
return
p
,
nil
}
// Set returns a blockset of directly pinned keys
func
(
p
*
pinner
)
Set
()
set
.
BlockSet
{
return
p
.
directPin
// DirectKeys returns a slice containing the directly pinned keys
func
(
p
*
pinner
)
DirectKeys
()
[]
util
.
Key
{
return
p
.
directPin
.
GetKeys
()
}
// IndirectKeys returns a slice containing the indirectly pinned keys
func
(
p
*
pinner
)
IndirectKeys
()
[]
util
.
Key
{
return
p
.
indirPin
.
Set
()
.
GetKeys
()
}
// RecursiveKeys returns a slice containing the recursively pinned keys
func
(
p
*
pinner
)
RecursiveKeys
()
[]
util
.
Key
{
return
p
.
recursePin
.
GetKeys
()
}
// Flush encodes and writes pinner keysets to the datastore
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment