storage

package
v0.0.61-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Chunker         string = ""
	DefaultHashFunc        = "sha2-256"
)

Variables

This section is empty.

Functions

func Add

func Add(node StoragePeer, k []byte, r io.Reader, cb cid.Builder, l layout) (ipld.Node, error)

Add chunks and adds content to the DAGService from a reader. Data is stored as a UnixFS DAG (default for IPFS). returs the root ipld.Node

func AddStream

func AddStream(node StoragePeer, k []byte, r io.Reader, hfunc string) (ipld.Node, error)

func ConfigureCrdt

func ConfigureCrdt(sp StoragePeer, topicName string, crdtOpts *crdt.Options) (*crdt.Datastore, error)

func CreateDagServices

func CreateDagServices(base core.LibP2PPeer) (ipld.DAGService, blockservice.BlockService, blockstore.Blockstore, error)

func CreateOfflineDagServices

func CreateOfflineDagServices(base core.LibP2PPeer) (ipld.DAGService, blockservice.BlockService, blockstore.Blockstore, error)

func Get

func Get(node StoragePeer, c cid.Cid) (ufsio.ReadSeekCloser, error)

Get returns a reader to a file (must be a UnixFS DAG) as identified by its root CID.

func GetBytes

func GetBytes(node StoragePeer, c cid.Cid) ([]byte, error)

Get returns a reader to a file (must be a UnixFS DAG) as identified by its root CID.

func NewDagSyncer

func NewDagSyncer(base ipld.DAGService, bs blockstore.Blockstore) *dagSyncer

func Session

func Session(sp StoragePeer) ipld.NodeGetter

Session returns a session-based NodeGetter.

func SetupReprovider

func SetupReprovider(base core.LibP2PPeer, bstore blockstore.Blockstore, reprovideInterval time.Duration) (provider.System, error)

Types

type StoragePeer

type StoragePeer interface {
	core.LibP2PPeer

	DagService() ipld.DAGService
	BlockService() blockservice.BlockService
	Reprovider() provider.System
}

func NewStoragePeer

func NewStoragePeer(base *core.BasePeer, offline bool) StoragePeer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL