Documentation
¶
Index ¶
- Variables
- func DefaultBootstrapPeers() []peer.AddrInfo
- func NewInMemoryDatastore() datastore.Batching
- func NewResourceManager() (network.ResourceManager, error)
- type AddParams
- type BitswapConfig
- type Config
- type ConnectionManager
- type DeleteManyBlockstore
- type NewNodeParams
- type Node
- func (p *Node) AddPinDirectory(ctx context.Context, path string) (ipld.Node, error)
- func (p *Node) AddPinFile(ctx context.Context, r io.Reader, params *AddParams) (ipld.Node, error)
- func (p *Node) BlockStore() blockstore.Blockstore
- func (p *Node) BootstrapPeers(peers []peer.AddrInfo)
- func (p *Node) GetDirectory(ctx context.Context, c ipld.Node) (ufsio.Directory, error)
- func (p *Node) GetDirectoryWithCid(ctx context.Context, c cid.Cid) (ufsio.Directory, error)
- func (p *Node) GetFile(ctx context.Context, c cid.Cid) (ufsio.ReadSeekCloser, error)
- func (p *Node) HasBlock(ctx context.Context, c cid.Cid) (bool, error)
- func (p *Node) Session(ctx context.Context) ipld.NodeGetter
Constants ¶
This section is empty.
Variables ¶
var BootstrapPeers []peer.AddrInfo
var Libp2pOptionsExtra = []libp2p.Option{ libp2p.NATPortMap(), libp2p.ConnectionManager(connMgr), libp2p.EnableAutoRelay(), libp2p.EnableNATService(), }
Libp2pOptionsExtra provides some useful libp2p options to create a fully featured libp2p Host. It can be used with SetupLibp2p.
Functions ¶
func DefaultBootstrapPeers ¶
Creating a list of multiaddresses that are used to bootstrap the network.
func NewInMemoryDatastore ¶
NewInMemoryDatastore provides a sync Datastore that lives in-memory only and is not persisted.
func NewResourceManager ¶ added in v0.2.0
func NewResourceManager() (network.ResourceManager, error)
Types ¶
type AddParams ¶
type AddParams struct {
Layout string
Chunker string
RawLeaves bool
Hidden bool
Shard bool
NoCopy bool
HashFun string
}
AddParams contains all of the configurable parameters needed to specify the importing process of a file.
type BitswapConfig ¶
type Config ¶
type Config struct {
// The DAGService will not announce or retrieve blocks from the network
Offline bool
// ReprovideInterval sets how often to reprovide records to the DHT
ReprovideInterval time.Duration
Libp2pKeyFile string
ListenAddrs []string
AnnounceAddrs []string
DatastoreDir struct {
Directory string
Options levelds.Options
}
Blockstore string
NoBlockstoreCache bool
NoAnnounceContent bool
NoLimiter bool
BitswapConfig BitswapConfig
Limits rcmgr.ScalingLimitConfig
ConnectionManagerConfig ConnectionManager
}
func SetConfigDefaults ¶
func SetConfigDefaults() *Config
type ConnectionManager ¶
type DeleteManyBlockstore ¶
type DeleteManyBlockstore interface {
blockstore.Blockstore
DeleteMany(context.Context, []cid.Cid) error
}
type NewNodeParams ¶
type NewNodeParams struct {
// Context is the context to use for the node.
Ctx context.Context
Repo string
Datastore datastore.Batching
Blockstore blockstore.Blockstore
Dht *dht.IpfsDHT
Config *Config
}
func (NewNodeParams) ConfigurationBuilder ¶
func (n NewNodeParams) ConfigurationBuilder(config *Config) *Config
type Node ¶
type Node struct {
// node context
Ctx context.Context
// Node configuration
Config *Config
// hosts
Host host.Host
Dht *dht.IpfsDHT
StorageDir string
// dag service
ipld.DAGService
Blockstore blockstore.Blockstore
Blockservice blockservice.BlockService
Datastore datastore.Batching
Reprovider provider.System
Exchange exchange.Interface
Bitswap *bitswap.Bitswap
FilDht *dht.IpfsDHT
FullRt *fullrt.FullRT
}
func NewNode ¶
func NewNode(nodeParams NewNodeParams) (*Node, error)
NewNode creates a new WhyPFS node with the given configuration.
func (*Node) AddPinDirectory ¶
Adding the directory of the pin to the path.
func (*Node) AddPinFile ¶
AddPinFile chunks and adds content to the DAGService from a reader. The content is stored as a UnixFS DAG (default for IPFS). It returns the root ipld.Node.
func (*Node) BlockStore ¶
func (p *Node) BlockStore() blockstore.Blockstore
BlockStore offers access to the Blockstore underlying the Peer's DAGService.
func (*Node) BootstrapPeers ¶
Helper function to bootstrap peers
Bootstrapping the node to the network.
func (*Node) GetDirectory ¶
Getting the directory from the node.
func (*Node) GetDirectoryWithCid ¶
Getting the directory with the cid.
func (*Node) GetFile ¶
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).