Documentation ¶
Index ¶
- Constants
- Variables
- func Add(peer StoragePeer, r io.Reader, cb cid.Builder, l layout) (ipld.Node, error)
- func AddDir(peer StoragePeer) (ufsio.Directory, ipld.Node, error)
- func AddStream(peer StoragePeer, r io.Reader, hfunc string) (ipld.Node, error)
- func AddToDir(peer StoragePeer, dir ufsio.Directory, name string, node ipld.Node) (ufsio.Directory, ipld.Node, error)
- func ConfigureCrdt(sp StoragePeer, name string, crdtOpts *crdt.Options) (*crdt.Datastore, error)
- func CreateDagServices(base core.LibP2PPeer) (ipld.DAGService, blockservice.BlockService, blockstore.Blockstore, error)
- func CreateOfflineDagServices(base core.LibP2PPeer) (ipld.DAGService, blockservice.BlockService, blockstore.Blockstore, error)
- func Get(peer StoragePeer, c cid.Cid) (ufsio.ReadSeekCloser, error)
- func GetBytes(peer StoragePeer, c cid.Cid) ([]byte, error)
- func LoadDir(peer StoragePeer, c cid.Cid) (ufsio.Directory, error)
- func NewCidBuilder(hfunc string) (cid.Builder, error)
- func NewDagSyncer(base ipld.DAGService, bs blockstore.Blockstore) *dagSyncer
- func RemoveFromDir(peer StoragePeer, dir ufsio.Directory, name string) (ufsio.Directory, ipld.Node, error)
- func Session(sp StoragePeer) ipld.NodeGetter
- func SetupReprovider(base core.LibP2PPeer, bstore blockstore.Blockstore, ...) (provider.System, error)
- type MultiStorePeer
- type StoragePeer
Constants ¶
View Source
const ( Chunker string = "" DefaultHashFunc = "sha2-256" )
Variables ¶
View Source
var (
StoreMain = "store_main"
)
Functions ¶
func Add ¶
Add chunks and adds content to the DAGService from a reader. data is stored as a UnixFS DAG (default for IPFS). fallback to balanced layout, large data should be added via AddStream() returns the root ipld.Node
func AddStream ¶
AddStream is suitable for large data using trickle layout which is suitable for streaming
func AddToDir ¶ added in v0.0.8
func AddToDir(peer StoragePeer, dir ufsio.Directory, name string, node ipld.Node) (ufsio.Directory, ipld.Node, error)
AddToDir adds the given child to a dir
func ConfigureCrdt ¶
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(peer 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(peer StoragePeer, c cid.Cid) ([]byte, error)
GetBytes reads the entire dag and return the raw data bytes
func LoadDir ¶ added in v0.0.8
func LoadDir(peer StoragePeer, c cid.Cid) (ufsio.Directory, error)
LoadDir looks for the desired dir
func NewCidBuilder ¶ added in v0.0.8
func NewDagSyncer ¶
func NewDagSyncer(base ipld.DAGService, bs blockstore.Blockstore) *dagSyncer
func RemoveFromDir ¶ added in v0.0.9
func RemoveFromDir(peer StoragePeer, dir ufsio.Directory, name string) (ufsio.Directory, ipld.Node, error)
RemoveFromDir clears the given child from the dir
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 MultiStorePeer ¶ added in v0.0.9
type MultiStorePeer struct { StoragePeer // contains filtered or unexported fields }
func NewMultiStorePeer ¶ added in v0.0.9
func NewMultiStorePeer(sp StoragePeer) *MultiStorePeer
func (*MultiStorePeer) Crdt ¶ added in v0.0.9
func (msp *MultiStorePeer) Crdt(name string) *crdt.Datastore
func (*MultiStorePeer) Datastore ¶ added in v0.0.9
func (msp *MultiStorePeer) Datastore(name string) datastore.Batching
func (*MultiStorePeer) UseCrdt ¶ added in v0.0.9
func (msp *MultiStorePeer) UseCrdt(name string, store *crdt.Datastore) bool
func (*MultiStorePeer) UseDatastore ¶ added in v0.0.9
func (msp *MultiStorePeer) UseDatastore(name string, store datastore.Batching) bool
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
Click to show internal directories.
Click to hide internal directories.