Documentation
¶
Overview ¶
Package ipfs assembles the IPFS pieces OrbitDB runs on: a libp2p host, gossipsub for database update announcements, and a block service whose bitswap exchange fetches entries, identities and manifests from peers.
It plays the role Helia plays for @orbitdb/core. The defaults (TCP, Noise, Yamux, gossipsub, bitswap) interoperate with a Helia node that enables the same transports.
Callers with their own libp2p stack can fill a Node by hand instead of calling New.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultListenAddrs = []string{"/ip4/127.0.0.1/tcp/0"}
DefaultListenAddrs is used when Options.ListenAddrs is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// Host is the libp2p host. OrbitDB registers the heads exchange
// protocol on it.
Host host.Host
// PubSub carries database updates; each database is a topic.
PubSub *pubsub.PubSub
// Blocks stores blocks locally and fetches missing ones from peers.
Blocks storage.BlockService
// Pins, if set, pins the blocks OrbitDB stores.
Pins storage.Pinner
// contains filtered or unexported fields
}
Node is what OrbitDB needs from IPFS.
type Options ¶
type Options struct {
// ListenAddrs are the multiaddrs to listen on. Defaults to TCP on
// 127.0.0.1 with a random port.
ListenAddrs []string
// PrivateKey is the peer identity key. Defaults to a new Ed25519 key.
PrivateKey crypto.PrivKey
// Datastore backs the blockstore and the pinner. If nil, a LevelDB
// datastore in Repo is used, or an in-memory one when Repo is empty
// (blocks then do not survive a restart).
Datastore datastore.Batching
// Repo is a directory for a persistent datastore.
Repo string
// Libp2pOptions are appended to the host options.
Libp2pOptions []libp2p.Option
// PubSubOptions are appended to the gossipsub options.
PubSubOptions []pubsub.Option
}
Options configures New.
Click to show internal directories.
Click to hide internal directories.