droplet

package module
v0.0.0-...-105113c Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 38 Imported by: 0

README

droplet

Core module of IPFSdrop

Checkout go-ipfsdrop for usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectionManager

func ConnectionManager(r repo.Repo) (libp2p.Option, error)

func Identity

func Identity(r repo.Repo) (libp2p.Option, error)

func Listener

func Listener(r repo.Repo) (libp2p.Option, error)

func RepoAccessOptsOut

func RepoAccessOptsOut(repoAccess func(repo.Repo) (libp2p.Option, error)) fx.Option

Types

type AddParams

type AddParams struct {
	Layout    string
	Chunker   string
	RawLeaves bool
	Hidden    bool
	Shard     bool
	NoCopy    bool
	HashFun   string
}

type Droplet

type Droplet struct {
	Ctx        context.Context
	Host       host.Host
	Store      datastore.Batching
	Bstore     blockstore.Blockstore
	DHT        routing.Routing
	Bserv      blockservice.BlockService
	DAGService ipld.DAGService
	Repo       repo.Repo
	Provider   provider.System
	Reporter   *metrics.BandwidthCounter
	Sender     messenger.Sender
	Listener   *messenger.Listener
	// contains filtered or unexported fields
}

Droplet is an NotSoLite ipfs node

func NewNode

func NewNode(ctx context.Context, r repo.Repo, noti inet.Notifiee) (*Droplet, error)

func (*Droplet) AddFile

func (p *Droplet) AddFile(ctx context.Context, r io.Reader, params *AddParams) (ipld.Node, error)

func (*Droplet) Adder

func (p *Droplet) Adder(ctx context.Context) func(io.Reader) (ipld.Node, error)

func (*Droplet) BlockStore

func (p *Droplet) BlockStore() blockstore.Blockstore

BlockStore offers access to the blockstore underlying the Droplet's DAGService.

func (*Droplet) Close

func (p *Droplet) Close()

func (*Droplet) Connect

func (p *Droplet) Connect(ctx context.Context, pi peer.AddrInfo) error

Connect connects host to a given peer

func (*Droplet) Disconnect

func (p *Droplet) Disconnect(ctx context.Context, addr ma.Multiaddr) error

Disconnect host from a given peer

func (*Droplet) GetFile

func (p *Droplet) GetFile(ctx context.Context, c cid.Cid) (ufsio.ReadSeekCloser, error)

GetFile returns a reader to a file as identified by its root CID. The file must have been added as a UnixFS DAG (default for IPFS).

func (*Droplet) Getter

func (p *Droplet) Getter() ipld.DAGService

func (*Droplet) HasBlock

func (p *Droplet) HasBlock(c cid.Cid) (bool, error)

HasBlock returns whether a given block is available locally. It is a shorthand for .Blockstore().Has().

func (*Droplet) Peers

func (p *Droplet) Peers(ctx context.Context) ([]string, error)

Peers returns a list of connected peers

func (*Droplet) Session

func (p *Droplet) Session(ctx context.Context) ipld.NodeGetter

Session returns a session-based NodeGetter.

type FxLog

type FxLog struct{}

func (*FxLog) Printf

func (f *FxLog) Printf(msg string, args ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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