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
dda5735c
Commit
dda5735c
authored
Jan 21, 2018
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
data storage interfaces
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
8b810ae1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
blockservice.go
blockservice.go
+14
-1
No files found.
blockservice.go
View file @
dda5735c
...
...
@@ -25,13 +25,26 @@ var ErrNotFound = errors.New("blockservice: key not found")
// datastore and may retrieve data from a remote Exchange.
// It uses an internal `datastore.Datastore` instance to store values.
type
BlockService
interface
{
// Blockstore returns a reference to the underlying blockstore
Blockstore
()
blockstore
.
Blockstore
// Exchange returns a reference to the underlying exchange (usually bitswap)
Exchange
()
exchange
.
Interface
// AddBlock puts a given block to the underlying datastore
AddBlock
(
o
blocks
.
Block
)
(
*
cid
.
Cid
,
error
)
// AddBlocks adds a slice of blocks at the same time using batching
// capabilities of the underlying datastore whenever possible.
AddBlocks
(
bs
[]
blocks
.
Block
)
([]
*
cid
.
Cid
,
error
)
GetBlock
(
ctx
context
.
Context
,
c
*
cid
.
Cid
)
(
blocks
.
Block
,
error
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
DeleteBlock
(
o
blocks
.
Block
)
error
// GetBlocks does a batch request for the given cids, returning blocks as
// they are found, in no particular order.
GetBlocks
(
ctx
context
.
Context
,
ks
[]
*
cid
.
Cid
)
<-
chan
blocks
.
Block
Close
()
error
}
...
...
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