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-merkledag
Commits
b7b352fe
Commit
b7b352fe
authored
Oct 05, 2016
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make BlockService an interface.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
dbebd417
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
merkledag.go
merkledag.go
+4
-4
merkledag_test.go
merkledag_test.go
+1
-1
No files found.
merkledag.go
View file @
b7b352fe
...
...
@@ -41,7 +41,7 @@ type LinkService interface {
GetOfflineLinkService
()
LinkService
}
func
NewDAGService
(
bs
*
bserv
.
BlockService
)
*
dagService
{
func
NewDAGService
(
bs
bserv
.
BlockService
)
*
dagService
{
return
&
dagService
{
Blocks
:
bs
}
}
...
...
@@ -51,7 +51,7 @@ func NewDAGService(bs *bserv.BlockService) *dagService {
// TODO: should cache Nodes that are in memory, and be
// able to free some of them when vm pressure is high
type
dagService
struct
{
Blocks
*
bserv
.
BlockService
Blocks
bserv
.
BlockService
}
// Add adds a node to the dagService, storing the block in the BlockService
...
...
@@ -113,8 +113,8 @@ func (n *dagService) GetLinks(ctx context.Context, c *cid.Cid) ([]*Link, error)
}
func
(
n
*
dagService
)
GetOfflineLinkService
()
LinkService
{
if
n
.
Blocks
.
Exchange
.
IsOnline
()
{
bsrv
:=
bserv
.
New
(
n
.
Blocks
.
Blockstore
,
offline
.
Exchange
(
n
.
Blocks
.
Blockstore
))
if
n
.
Blocks
.
Exchange
()
.
IsOnline
()
{
bsrv
:=
bserv
.
New
(
n
.
Blocks
.
Blockstore
()
,
offline
.
Exchange
(
n
.
Blocks
.
Blockstore
()
))
return
NewDAGService
(
bsrv
)
}
else
{
return
n
...
...
merkledag_test.go
View file @
b7b352fe
...
...
@@ -237,7 +237,7 @@ func TestFetchGraph(t *testing.T) {
}
// create an offline dagstore and ensure all blocks were fetched
bs
:=
bserv
.
New
(
bsis
[
1
]
.
Blockstore
,
offline
.
Exchange
(
bsis
[
1
]
.
Blockstore
))
bs
:=
bserv
.
New
(
bsis
[
1
]
.
Blockstore
()
,
offline
.
Exchange
(
bsis
[
1
]
.
Blockstore
()
))
offline_ds
:=
NewDAGService
(
bs
)
...
...
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