blox

package
v1.55.17 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCIDFromDigest added in v1.54.8

func FindCIDFromDigest(base32MultibaseDigest string) (cid.Cid, error)

func IpfsClusterPins added in v1.54.8

func IpfsClusterPins(ctx context.Context, lastChecked time.Time, account string) (<-chan datamodel.Link, <-chan error)

IpfsClusterPins streams pins from the IPFS Cluster API and sends them through a channel.

Types

type Blox

type Blox struct {
	// contains filtered or unexported fields
}

func New

func New(o ...Option) (*Blox, error)

func (*Blox) AnnounceJoinPoolRequestPeriodically added in v1.15.0

func (p *Blox) AnnounceJoinPoolRequestPeriodically(ctx context.Context)

func (*Blox) BloxFreeSpace added in v1.29.0

func (p *Blox) BloxFreeSpace(ctx context.Context, to peer.ID) ([]byte, error)

func (*Blox) EraseBlData added in v1.30.0

func (p *Blox) EraseBlData(ctx context.Context, to peer.ID) ([]byte, error)

func (*Blox) FetchAvailableManifestsAndStore added in v1.16.0

func (p *Blox) FetchAvailableManifestsAndStore(ctx context.Context, maxCids int) error

FetchAvailableManifestsAndStore fetches available manifests and stores them.

func (*Blox) FindLinkProvidersByDht added in v1.16.0

func (p *Blox) FindLinkProvidersByDht(l ipld.Link) ([]peer.AddrInfo, error)

func (*Blox) GetBlMembers added in v1.15.0

func (p *Blox) GetBlMembers() map[peer.ID]common.MemberStatus

func (*Blox) GetCidv1FromBlockFilename added in v1.53.0

func (p *Blox) GetCidv1FromBlockFilename(filename string) (cid.Cid, error)

GetCidv1FromBlockFilename extracts CIDv1 from block filename

func (*Blox) GetIPFSRPC added in v1.53.0

func (p *Blox) GetIPFSRPC() *rpc.HttpApi

func (*Blox) GetLastCheckedTime added in v1.53.0

func (p *Blox) GetLastCheckedTime() (time.Time, error)

func (*Blox) Has

func (p *Blox) Has(ctx context.Context, l ipld.Link) (bool, error)

func (*Blox) ListModifiedStoredBlocks added in v1.53.0

func (p *Blox) ListModifiedStoredBlocks(lastChecked time.Time) ([]datamodel.Link, error)

ListModifiedStoredBlocks lists only the folders that have been modified after the last check time and returns the filenames of the files created after the last check time in those folders.

func (p *Blox) ListModifiedStoredLinks(ctx context.Context, lastChecked time.Time, account string) ([]datamodel.Link, error)

This method fetches the pinned items in ipfs-cluster since the lastChecked time

func (*Blox) Load

func (p *Blox) Load(ctx context.Context, l ipld.Link, np ipld.NodePrototype) (ipld.Node, error)

func (*Blox) Ping added in v1.15.0

func (p *Blox) Ping(ctx context.Context, to peer.ID) (int, int, error)

func (*Blox) PingDht added in v1.16.0

func (p *Blox) PingDht(to peer.ID) error

func (*Blox) ProvideLinkByDht added in v1.16.0

func (p *Blox) ProvideLinkByDht(l ipld.Link) error

func (*Blox) PubsubValidator added in v1.15.0

func (p *Blox) PubsubValidator(ctx context.Context, id peer.ID, msg *pubsub.Message) bool

func (*Blox) Pull

func (p *Blox) Pull(ctx context.Context, from peer.ID, l ipld.Link) error

func (*Blox) Push

func (p *Blox) Push(ctx context.Context, from peer.ID, l ipld.Link) error

func (*Blox) ServeIpfsRpc added in v1.14.2

func (p *Blox) ServeIpfsRpc() http.Handler

func (*Blox) SetAuth added in v0.8.3

func (p *Blox) SetAuth(ctx context.Context, on peer.ID, subject peer.ID, allow bool) error

func (*Blox) Shutdown

func (p *Blox) Shutdown(ctx context.Context) error

func (*Blox) Start

func (p *Blox) Start(ctx context.Context) error

func (*Blox) StartAnnouncementServer added in v1.15.0

func (p *Blox) StartAnnouncementServer(ctx context.Context) error

func (*Blox) StartPingServer added in v1.15.0

func (p *Blox) StartPingServer(ctx context.Context) error

func (*Blox) Store

func (p *Blox) Store(ctx context.Context, n ipld.Node) (ipld.Link, error)

func (*Blox) StoreCid added in v1.16.0

func (p *Blox) StoreCid(ctx context.Context, l ipld.Link, limit int) error

func (*Blox) StoreManifest added in v1.16.0

func (p *Blox) StoreManifest(ctx context.Context, links []blockchain.LinkWithLimit, maxCids int) error

func (*Blox) UpdateDhtPeers added in v1.16.0

func (p *Blox) UpdateDhtPeers(peers []peer.ID) error

func (*Blox) UpdateFailedCids added in v1.54.8

func (p *Blox) UpdateFailedCids(links []datamodel.Link) error

UpdateFailedCids updates the last checked time by appending failed CIDs to a file. It collects all errors encountered and returns them together.

func (*Blox) UpdateLastCheckedTime added in v1.53.0

func (p *Blox) UpdateLastCheckedTime() error

UpdateLastCheckedTime updates the last checked time

type CidStruct added in v1.14.2

type CidStruct struct {
	Root string `json:"/"`
}

type FilesStat added in v1.14.2

type FilesStat struct {
	Blocks         int    `json:"Blocks"`
	CumulativeSize uint64 `json:"CumulativeSize"`
	Hash           string `json:"Hash"`
	Local          bool   `json:"Local,omitempty"` // Optional field. 'omitempty' keyword is used to exclude the field from the output if it's default/zero value
	Size           uint64 `json:"Size"`
	SizeLocal      uint64 `json:"SizeLocal,omitempty"` // Optional field.
	Type           string `json:"Type"`
	WithLocality   bool   `json:"WithLocality,omitempty"` // Optional field.
}

type Option

type Option func(*options) error

func WithAnnounceInterval

func WithAnnounceInterval(i time.Duration) Option

WithAnnounceInterval sets the interval at which announcements are made on the pubsub. Defaults to 5 seconds if unset.

func WithBlockchainEndPoint added in v1.15.0

func WithBlockchainEndPoint(b string) Option

func WithChainName added in v1.55.15

func WithChainName(n string) Option

func WithDatastore

func WithDatastore(ds datastore.Batching) Option

func WithDefaultIPFShttpServer added in v1.46.0

func WithDefaultIPFShttpServer(n string) Option

func WithExchangeOpts added in v1.0.0

func WithExchangeOpts(eo ...exchange.Option) Option

func WithGetChainName added in v1.55.15

func WithGetChainName(getChainName func() string) Option

func WithGetPoolName added in v1.54.8

func WithGetPoolName(getPoolName PoolNameGetter) Option

func WithHost

func WithHost(h host.Host) Option

WithHost sets the libp2p host on which the blox is exposed. If unset a default host with random identity is used. See: libp2p.New.

func WithIpfsClient added in v1.48.0

func WithIpfsClient(n *rpc.HttpApi) Option

func WithIpfsClusterAPI added in v1.53.0

func WithIpfsClusterAPI(n ipfsCluster.Client) Option

func WithLinkSystem

func WithLinkSystem(ls *ipld.LinkSystem) Option

func WithMaxPingTime added in v1.15.0

func WithMaxPingTime(pt int) Option

func WithMinSuccessPingRate added in v1.15.0

func WithMinSuccessPingRate(sr int) Option

func WithPingCount added in v1.15.0

func WithPingCount(pc int) Option

func WithPoolHostMode added in v1.53.0

func WithPoolHostMode(n bool) Option

func WithPoolName

func WithPoolName(n string) Option

WithPoolName sets a human readable name for the pool that the blox should join or create. Required.

func WithRelays added in v1.15.0

func WithRelays(r []string) Option

WithStoreDir sets a the store directory we are using for datastore Required.

func WithSecretsPath added in v1.41.0

func WithSecretsPath(b string) Option

func WithStoreDir added in v1.14.2

func WithStoreDir(n string) Option

WithStoreDir sets a the store directory we are using for datastore Required.

func WithTopicName

func WithTopicName(n string) Option

WithTopicName sets the name of the topic onto which announcements are made. Defaults to "/explore.fula/pools/<pool-name>" if unset. See: WithPoolName.

func WithUpdateChainName added in v1.55.15

func WithUpdateChainName(updateChainName func(string) error) Option

func WithUpdatePoolName added in v1.15.0

func WithUpdatePoolName(updatePoolName PoolNameUpdater) Option

func WithWg added in v1.21.0

func WithWg(wg *sync.WaitGroup) Option

type PeerStats added in v1.14.2

type PeerStats struct {
	Exchanged uint64  `json:"Exchanged"`
	Peer      string  `json:"Peer"`
	Recv      uint64  `json:"Recv"`
	Sent      uint64  `json:"Sent"`
	Value     float64 `json:"Value"`
}

type PoolNameGetter added in v1.54.8

type PoolNameGetter func() string

type PoolNameUpdater added in v1.15.0

type PoolNameUpdater func(string) error

type RepoInfo added in v1.14.2

type RepoInfo struct {
	NumObjects uint64   `json:"NumObjects"`
	RepoPath   string   `json:"RepoPath"`
	SizeStat   SizeStat `json:"SizeStat"`
	Version    string   `json:"Version"`
	RepoSize   uint64   `json:"RepoSize"`
}

type SizeStat added in v1.14.2

type SizeStat struct {
	RepoSize   uint64 `json:"RepoSize"`
	StorageMax uint64 `json:"StorageMax"`
}

type StatsBitswap added in v1.14.2

type StatsBitswap struct {
	BlocksReceived   uint64      `json:"BlocksReceived"`
	BlocksSent       uint64      `json:"BlocksSent"`
	DataReceived     uint64      `json:"DataReceived"`
	DataSent         uint64      `json:"DataSent"`
	DupBlksReceived  uint64      `json:"DupBlksReceived"`
	DupDataReceived  uint64      `json:"DupDataReceived"`
	MessagesReceived uint64      `json:"MessagesReceived"`
	Peers            []string    `json:"Peers"`
	ProvideBufLen    int         `json:"ProvideBufLen"`
	Wantlist         []CidStruct `json:"Wantlist"`
}

type StatsBw added in v1.14.2

type StatsBw struct {
	RateIn   float64 `json:"RateIn"`
	RateOut  float64 `json:"RateOut"`
	TotalIn  int64   `json:"TotalIn"`
	TotalOut int64   `json:"TotalOut"`
}

Jump to

Keyboard shortcuts

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