Commit dbf02a67 authored by Eric Myhre's avatar Eric Myhre

Add context params to link load and build.

These belong in load and build since those are at the top of the stack;
they also (perhaps surprisingly) aren't necessary as params to the
Loader and Storer function interfaces (since those just return readers
and writers, and thus 'cancel' for those is 'stop using it').
Signed-off-by: default avatarEric Myhre <hash@exultant.us>
parent 6950c5cf
package ipld
import "io"
import (
"context"
"io"
)
// Link is a special kind of value in IPLD which can be "loaded" to access
// more nodes.
......@@ -33,7 +36,7 @@ type Link interface {
// The provided Loader function is used to get a reader for the raw
// serialized content; the Link contains an understanding of how to
// select a decoder (and hasher for verification, etc).
Load(loader Loader) (Node, error)
Load(context.Context, Loader) (Node, error)
// LinkBuilder returns a handle to any parameters of the Link which
// are needed to create a new Link of the same style but with new content.
......@@ -63,7 +66,7 @@ type Link interface {
// If using CIDs as an implementation, LinkBuilder will encapsulate things
// like multihashType, multicodecType, and cidVersion, for example.
type LinkBuilder interface {
Build(content Node, storer Storer) (Link, error)
Build(ctx context.Context, content Node, storer Storer) (Link, error)
}
// Loader functions are used to get a reader for raw serialized content
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment