node

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 58 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultEngineBlockstoreWorkerCount = 128
	DefaultTaskWorkerCount             = 8
	DefaultEngineTaskWorkerCount       = 8
	DefaultMaxOutstandingBytesPerPeer  = 1 << 20
	DefaultProviderSearchDelay         = 1000 * time.Millisecond
)

Docs: https://github.com/ipfs/kubo/blob/master/docs/config.md#internalbitswap

View Source
const DefaultIpnsCacheSize = 128

Variables

Core groups basic IPFS services

IPNS groups namesys related units

Functions

func BaseBlockstoreCtor

func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, hashOnRead bool) func(mctx helpers.MetricsCtx, repo repo.Repo, lc fx.Lifecycle) (bs BaseBlocks, err error)

BaseBlockstoreCtor creates cached blockstore backed by the provided datastore

func BitswapOptions added in v0.16.0

func BitswapOptions(cfg *config.Config, provide bool) interface{}

BitswapOptions creates configuration options for Bitswap from the config file and whether to provide data.

func BlockService

BlockService creates new blockservice which provides an interface to fetch content-addressable blocks

func DNSResolver

func DNSResolver(cfg *config.Config) (*madns.Resolver, error)

func Dag

Dag creates new DAGService

func Datastore

func Datastore(repo repo.Repo) datastore.Datastore

Datastore provides the datastore

func Files

func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, error)

Files loads persisted MFS root

func FilestoreBlockstoreCtor

func FilestoreBlockstoreCtor(repo repo.Repo, bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore, fstore *filestore.Filestore)

GcBlockstoreCtor wraps GcBlockstore and adds Filestore support

func GcBlockstoreCtor

func GcBlockstoreCtor(bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore)

GcBlockstoreCtor wraps the base blockstore with GC and Filestore layers

func IPFS

func IPFS(ctx context.Context, bcfg *BuildCfg) fx.Option

IPFS builds a group of fx Options based on the passed BuildCfg

func Identity

func Identity(cfg *config.Config) fx.Option

Identity groups units providing cryptographic identity

func IpnsRepublisher

func IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcProcess, namesys.NameSystem, repo.Repo, crypto.PrivKey) error

IpnsRepublisher runs new IPNS republisher service

func LibP2P

func LibP2P(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.PartialLimitConfig) fx.Option

func Namesys

func Namesys(cacheSize int, cacheMaxTTL time.Duration) func(rt irouting.ProvideManyRouter, rslv *madns.Resolver, repo repo.Repo) (namesys.NameSystem, error)

Namesys creates new name system

func Networked

func Networked(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.PartialLimitConfig) fx.Option

func Offline

func Offline(cfg *config.Config) fx.Option

Offline groups offline alternatives to Online units

func OfflineProviders

func OfflineProviders() fx.Option

OfflineProviders groups units managing provider routing records offline

func Online

func Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.PartialLimitConfig) fx.Option

Online groups online-only units

func OnlineExchange

func OnlineExchange() interface{}

OnlineExchange creates new LibP2P backed block exchange (BitSwap). Additional options to bitswap.New can be provided via the "bitswap-options" group.

func OnlineProviders

func OnlineProviders(useStrategicProviding bool, reprovideStrategy string, reprovideInterval time.Duration, acceleratedDHTClient bool) fx.Option

OnlineProviders groups units managing provider routing records online

func PeerID

func PeerID(id peer.ID) func() peer.ID

func PeerWith

func PeerWith(peers ...peer.AddrInfo) fx.Option

PeerWith configures the peering service to peer with the specified peers.

func Peering

func Peering(lc fx.Lifecycle, host host.Host) *peering.PeeringService

Peering constructs the peering service and hooks it into fx's lifetime management system.

func Pinning

func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo) (pin.Pinner, error)

Pinning creates new pinner which tells GC which blocks should be kept

func PrivateKey

func PrivateKey(sk crypto.PrivKey) func(id peer.ID) (crypto.PrivKey, error)

PrivateKey loads the private key from config

func ProviderSys added in v0.21.0

func ProviderSys(reprovideInterval time.Duration, acceleratedDHTClient bool) fx.Option

func RecordValidator

func RecordValidator(ps peerstore.Peerstore) record.Validator

RecordValidator provides namesys compatible routing record validator

func RepoConfig

func RepoConfig(repo repo.Repo) (*config.Config, error)

RepoConfig loads configuration from the repo

func Storage

func Storage(bcfg *BuildCfg, cfg *config.Config) fx.Option

Storage groups units which setup datastore based persistence and blockstore layers

Types

type BaseBlocks

type BaseBlocks blockstore.Blockstore

BaseBlocks is the lower level blockstore without GC or Filestore layers

type BuildCfg

type BuildCfg struct {
	// If online is set, the node will have networking enabled
	Online bool

	// ExtraOpts is a map of extra options used to configure the ipfs nodes creation
	ExtraOpts map[string]bool

	// If permanent then node should run more expensive processes
	// that will improve performance in long run
	Permanent bool

	// DisableEncryptedConnections disables connection encryption *entirely*.
	// DO NOT SET THIS UNLESS YOU'RE TESTING.
	DisableEncryptedConnections bool

	Routing libp2p.RoutingOption
	Host    libp2p.HostOption
	Repo    repo.Repo
}

type FetchersIn added in v0.20.0

type FetchersIn struct {
	fx.In
	IPLDFetcher          fetcher.Factory `name:"ipldFetcher"`
	UnixfsFetcher        fetcher.Factory `name:"unixfsFetcher"`
	OfflineIPLDFetcher   fetcher.Factory `name:"offlineIpldFetcher"`
	OfflineUnixfsFetcher fetcher.Factory `name:"offlineUnixfsFetcher"`
}

FetchersIn allows using fetchers for other dependencies.

type FetchersOut added in v0.20.0

type FetchersOut struct {
	fx.Out
	IPLDFetcher          fetcher.Factory `name:"ipldFetcher"`
	UnixfsFetcher        fetcher.Factory `name:"unixfsFetcher"`
	OfflineIPLDFetcher   fetcher.Factory `name:"offlineIpldFetcher"`
	OfflineUnixfsFetcher fetcher.Factory `name:"offlineUnixfsFetcher"`
}

FetchersOut allows injection of fetchers.

func FetcherConfig

func FetcherConfig(bs blockservice.BlockService) FetchersOut

FetcherConfig returns a fetcher config that can build new fetcher instances

type PathResolversOut added in v0.20.0

type PathResolversOut struct {
	fx.Out
	IPLDPathResolver          pathresolver.Resolver `name:"ipldPathResolver"`
	UnixFSPathResolver        pathresolver.Resolver `name:"unixFSPathResolver"`
	OfflineIPLDPathResolver   pathresolver.Resolver `name:"offlineIpldPathResolver"`
	OfflineUnixFSPathResolver pathresolver.Resolver `name:"offlineUnixFSPathResolver"`
}

PathResolversOut allows injection of path resolvers

func PathResolverConfig added in v0.20.0

func PathResolverConfig(fetchers FetchersIn) PathResolversOut

PathResolverConfig creates path resolvers with the given fetchers.

Directories

Path Synopsis
fd

Jump to

Keyboard shortcuts

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