Documentation
¶
Index ¶
- func FormatSwarmKey(hexKey string) (io.Reader, error)
- func LoadSavedBootstrapPeers(dataDir string) []string
- func NewPinnedBlockService(split *SplitBlockstore, exchange *bitswap.Bitswap) blockservice.BlockService
- func ParseSwarmKey(hexKey string) (pnet.PSK, error)
- func SaveBootstrapPeer(dataDir, multiaddr string) error
- type CacheEvictor
- type Node
- type PinMeta
- type PinMetaEntry
- type SplitBlockstore
- func (s *SplitBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (s *SplitBlockstore) DeleteBlock(ctx context.Context, c cid.Cid) error
- func (s *SplitBlockstore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (s *SplitBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (s *SplitBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (s *SplitBlockstore) PinPut(ctx context.Context, blk blocks.Block) error
- func (s *SplitBlockstore) PinPutMany(ctx context.Context, blks []blocks.Block) error
- func (s *SplitBlockstore) Put(ctx context.Context, blk blocks.Block) error
- func (s *SplitBlockstore) PutMany(ctx context.Context, blks []blocks.Block) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSwarmKey ¶
FormatSwarmKey takes a hex-encoded 32-byte key and returns a reader in the standard IPFS swarm key file format.
func LoadSavedBootstrapPeers ¶
LoadSavedBootstrapPeers reads multiaddrs from bootstrap_peers.txt in dataDir.
func NewPinnedBlockService ¶
func NewPinnedBlockService(split *SplitBlockstore, exchange *bitswap.Bitswap) blockservice.BlockService
NewPinnedBlockService creates a blockservice that writes to the pinned store.
func ParseSwarmKey ¶
ParseSwarmKey takes a hex-encoded swarm key string and returns a PSK.
func SaveBootstrapPeer ¶
SaveBootstrapPeer appends a multiaddr to bootstrap_peers.txt.
Types ¶
type CacheEvictor ¶
type CacheEvictor struct {
// contains filtered or unexported fields
}
CacheEvictor monitors cache disk usage and evicts the oldest blocks when the cache exceeds its size limit. It uses file modification time as a proxy for LRU ordering.
func NewCacheEvictor ¶
func NewCacheEvictor(cacheDir string, maxBytes int64) *CacheEvictor
NewCacheEvictor creates a new evictor. If maxBytes is 0, eviction is disabled.
func (*CacheEvictor) Run ¶
func (e *CacheEvictor) Run(ctx context.Context)
Run starts the eviction loop. It blocks until ctx is cancelled.
type Node ¶
type Node struct {
Host host.Host
DHT *dht.IpfsDHT
Bitswap *bitswap.Bitswap
BlockService blockservice.BlockService
DAGService ipld.DAGService
Pinner pinner.Pinner
Blockstore *SplitBlockstore
PinMeta *PinMeta
DataDir string
SwarmKey string
// contains filtered or unexported fields
}
Node is the core IPFS node, owning all subsystems.
func (*Node) BootstrapMultiaddr ¶
BootstrapMultiaddr returns this node's multiaddr for sharing with others. Uses the Funnel hostname so it's reachable from outside the tailnet.
func (*Node) ConnectPeer ¶
ConnectPeer connects to a peer by multiaddr string and optionally saves it.
type PinMeta ¶
type PinMeta struct {
// contains filtered or unexported fields
}
PinMeta stores supplementary metadata (like timestamps) for pins. The pinner itself doesn't track when pins were created.
func NewPinMeta ¶
type PinMetaEntry ¶
type SplitBlockstore ¶
type SplitBlockstore struct {
// contains filtered or unexported fields
}
SplitBlockstore routes blocks to either a pinned store or a cache store. Blocks added via PinPut go to the pinned store. All other writes (e.g. from bitswap) go to the cache store. Reads check both stores, pinned first.
func OpenSplitBlockstore ¶
OpenSplitBlockstore creates two flatfs-backed blockstores under dataDir.
func (*SplitBlockstore) AllKeysChan ¶
AllKeysChan returns CIDs from both stores.
func (*SplitBlockstore) DeleteBlock ¶
DeleteBlock removes a block from both stores.
func (*SplitBlockstore) PinPut ¶
PinPut stores a block in the pinned store. Used when explicitly adding content.
func (*SplitBlockstore) PinPutMany ¶
PinPutMany stores multiple blocks in the pinned store.