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
interface-go-dms3-core
Commits
896fb83b
Commit
896fb83b
authored
Aug 06, 2018
by
Whyrusleeping
Committed by
GitHub
Aug 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5340 from ipfs/feat/coreapi/dagbatch
coreapi: dag: Batching interface
parents
24dde488
77b458e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
dag.go
dag.go
+20
-3
No files found.
dag.go
View file @
896fb83b
...
...
@@ -4,21 +4,38 @@ import (
"context"
"io"
options
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
ipld
"gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
)
// Dag
API specifies the interface to IPLD
type
Dag
API
interface
{
// Dag
Ops groups operations that can be batched together
type
Dag
Ops
interface
{
// Put inserts data using specified format and input encoding.
// Unless used with WithCodec or WithHash, the defaults "dag-cbor" and
// "sha256" are used.
Put
(
ctx
context
.
Context
,
src
io
.
Reader
,
opts
...
options
.
DagPutOption
)
(
ResolvedPath
,
error
)
}
// DagBatch is the batching version of DagAPI. All implementations of DagBatch
// should be threadsafe
type
DagBatch
interface
{
DagOps
// Commit commits nodes to the datastore and announces them to the network
Commit
(
ctx
context
.
Context
)
error
}
// DagAPI specifies the interface to IPLD
type
DagAPI
interface
{
DagOps
// Get attempts to resolve and get the node specified by the path
Get
(
ctx
context
.
Context
,
path
Path
)
(
ipld
.
Node
,
error
)
// Tree returns list of paths within a node specified by the path.
Tree
(
ctx
context
.
Context
,
path
Path
,
opts
...
options
.
DagTreeOption
)
([]
Path
,
error
)
// Batch creates new DagBatch
Batch
(
ctx
context
.
Context
)
DagBatch
}
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