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-blockservice
Commits
5b4cb569
Commit
5b4cb569
authored
Jul 05, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make NewSession in the blockservice be a function, not a method
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
d27d0fef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
blockservice.go
blockservice.go
+6
-7
No files found.
blockservice.go
View file @
5b4cb569
...
@@ -32,7 +32,6 @@ type BlockService interface {
...
@@ -32,7 +32,6 @@ type BlockService interface {
GetBlock
(
ctx
context
.
Context
,
c
*
cid
.
Cid
)
(
blocks
.
Block
,
error
)
GetBlock
(
ctx
context
.
Context
,
c
*
cid
.
Cid
)
(
blocks
.
Block
,
error
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
DeleteBlock
(
o
blocks
.
Block
)
error
DeleteBlock
(
o
blocks
.
Block
)
error
NewSession
(
context
.
Context
)
*
Session
Close
()
error
Close
()
error
}
}
...
@@ -79,18 +78,18 @@ func (bs *blockService) Exchange() exchange.Interface {
...
@@ -79,18 +78,18 @@ func (bs *blockService) Exchange() exchange.Interface {
return
bs
.
exchange
return
bs
.
exchange
}
}
func
(
bs
*
blockService
)
NewSession
(
ctx
context
.
Context
)
*
Session
{
func
NewSession
(
ctx
context
.
Context
,
bs
BlockService
)
*
Session
{
bswap
,
ok
:=
bs
.
Exchange
()
.
(
*
bitswap
.
Bitswap
)
exchange
:=
bs
.
Exchange
()
if
ok
{
if
bswap
,
ok
:=
exchange
.
(
*
bitswap
.
Bitswap
);
ok
{
ses
:=
bswap
.
NewSession
(
ctx
)
ses
:=
bswap
.
NewSession
(
ctx
)
return
&
Session
{
return
&
Session
{
ses
:
ses
,
ses
:
ses
,
bs
:
bs
.
b
lockstore
,
bs
:
bs
.
B
lockstore
()
,
}
}
}
}
return
&
Session
{
return
&
Session
{
ses
:
bs
.
exchange
,
ses
:
exchange
,
bs
:
bs
.
b
lockstore
,
bs
:
bs
.
B
lockstore
()
,
}
}
}
}
...
...
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