Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePrivateKey(privKey string) (ci.PrivKey, error)
- func GetPublished(ctx context.Context, routing routing.ValueStore, datastore ds.Datastore, ...) (*pb.IpnsEntry, error)
- func IpnsDsKey(id peer.ID) ds.Key
- func NewLiteHost(host host.Host, listener Listener) bsmnet.BitSwapNetwork
- func PkKeyForID(id peer.ID) string
- func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec *pb.IpnsEntry) error
- func PublishPublicKey(ctx context.Context, r routing.ValueStore, k string, pubk ci.PubKey) error
- func PublishWithEOL(ctx context.Context, routing routing.ValueStore, ds ds.Datastore, k ci.PrivKey, ...) error
- func PutRecordToRouting(ctx context.Context, r routing.ValueStore, k ci.PubKey, entry *pb.IpnsEntry) error
- func ResolveNode(ctx context.Context, dag ipld.NodeGetter, p path.Path) (ipld.Node, error)
- func ResolvePath(ctx context.Context, dag ipld.NodeGetter, p path.Path) (path.Resolved, error)
- func UpdateRecord(ctx context.Context, routing routing.ValueStore, ds ds.Datastore, k ci.PrivKey, ...) (*pb.IpnsEntry, error)
- type Adder
- func (adder *Adder) Add(reader io.Reader) (ipld.Node, error)
- func (adder *Adder) AddFileNode(file files.Node) (ipld.Node, error)
- func (adder *Adder) AddLinkToDir(node ipld.Node, name string, link ipld.Node) (ipld.Node, error)
- func (adder *Adder) CreateDir(node ipld.Node) (ipld.Node, error)
- func (adder *Adder) CreateEmptyDir() (ipld.Node, error)
- func (adder *Adder) RemoveLinkFromDir(node ipld.Node, name string) (ipld.Node, error)
- type BS
- type ConnectionListener
- type Datastore
- func (d *Datastore) Batch() (ds.Batch, error)
- func (d *Datastore) Close() error
- func (d *Datastore) Delete(key ds.Key) error
- func (d *Datastore) DiskUsage() (uint64, error)
- func (d *Datastore) Get(key ds.Key) (value []byte, err error)
- func (d *Datastore) GetExpiration(key ds.Key) (time.Time, error)
- func (d *Datastore) GetSize(key ds.Key) (size int, err error)
- func (d *Datastore) Has(key ds.Key) (bool, error)
- func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error)
- func (d *Datastore) Put(key ds.Key, value []byte) error
- func (d *Datastore) PutWithTTL(key ds.Key, value []byte, ttl time.Duration) error
- func (d *Datastore) Query(q dsq.Query) (dsq.Results, error)
- func (d *Datastore) SetTTL(key ds.Key, ttl time.Duration) error
- func (d *Datastore) Sync(prefix ds.Key) error
- type DhtClose
- type DirEntry
- type Link
- type Listener
- type Loader
- type LoaderClose
- type LsInfoClose
- type Node
- func (n *Node) AddFile(fpath string) (string, error)
- func (n *Node) AddLinkToDir(dir string, name string, link string) (string, error)
- func (n *Node) Base32(pid string) (string, error)
- func (n *Node) Base58(pid string) (string, error)
- func (n *Node) CheckSwarmKey(key string) error
- func (n *Node) CidCheck(multihash string) error
- func (n *Node) Connect(ctx context.Context, pi peer.AddrInfo) error
- func (n *Node) CreateEmptyDir() (string, error)
- func (n *Node) Daemon(EnablePrivateSharing bool) error
- func (n *Node) DhtFindProvs(mcid string, provider Provider, numProviders int, close DhtClose) error
- func (n *Node) DhtFindProvsTimeout(mcid string, provider Provider, numProviders int, timeout int32) error
- func (n *Node) DhtProvide(mcid string, close DhtClose) error
- func (n *Node) DhtProvideTimeout(mcid string, timeout int32) error
- func (n *Node) Disconnect(addr ma.Multiaddr) error
- func (n *Node) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error)
- func (n *Node) FindProviders(ctx context.Context, p path.Path, numProviders int) (<-chan peer.AddrInfo, error)
- func (n *Node) GetLoader(paths string, close LoaderClose) (*Loader, error)
- func (n *Node) GetRawPrivateKey() (string, error)
- func (n *Node) GetReader(paths string) (*Reader, error)
- func (n *Node) Id() (*PeerInfo, error)
- func (n *Node) Identity() error
- func (n *Node) IsConnected(pid string) (bool, error)
- func (n *Node) KnownAddrs() (map[peer.ID][]ma.Multiaddr, error)
- func (n *Node) ListenAddrs(context.Context) ([]ma.Multiaddr, error)
- func (n *Node) LocalAddrs() ([]ma.Multiaddr, error)
- func (n *Node) Ls(paths string, info LsInfoClose) error
- func (n *Node) Lss(ctx context.Context, p path.Path, resolveChildren bool) (<-chan DirEntry, error)
- func (n *Node) NumSwarmPeers() int
- func (n *Node) OpenDatabase() error
- func (n *Node) PidCheck(pid string) error
- func (n *Node) PidInfo(pid string) (*PeerInfo, error)
- func (n *Node) Provide(ctx context.Context, path path.Path) error
- func (n *Node) PublishName(p string, close PublisherClose, sequence Sequence) error
- func (n *Node) Push(pid string, msg []byte) (int, error)
- func (n *Node) RemoveLinkFromDir(dir string, linkName string) (string, error)
- func (n *Node) RepoGC() error
- func (n *Node) ResolveName(info ResolveInfo, name string, offline bool, dhtRecords int) error
- func (n *Node) ResolveNode(ctx context.Context, dag ipld.DAGService, p path.Path) (ipld.Node, error)
- func (n *Node) ResolvePath(ctx context.Context, dag ipld.DAGService, p path.Path) (path.Resolved, error)
- func (n *Node) Rm(paths string, recursive bool) error
- func (n *Node) RmBlocks(blocks blockstore.GCBlockstore, cids []cid.Cid) error
- func (n *Node) Stream(stream WriterStream) (string, error)
- func (n *Node) SwarmConnect(addr string, timeout int32) (bool, error)
- func (n *Node) SwarmDisconnect(addr string) (bool, error)
- func (n *Node) SwarmPeer(pid string) (*Peer, error)
- func (n *Node) SwarmPeers(stream PeerStream) error
- type Peer
- type PeerInfo
- type PeerStream
- type Provider
- type PublisherClose
- type Reader
- type RefWriter
- type ResolveInfo
- type Result
- type Sequence
- type UnknownUserError
- type VerifBS
- type VerifBSGC
- type Writer
- type WriterStream
Constants ¶
const ( // TFile is a regular file. TFile = 2 // TDirectory is a directory. TDirectory = 1 // TSymlink is a symlink. TSymlink = 4 )
const DefaultRecordEOL = 24 * time.Hour
const (
MaxSize = 1024
)
Variables ¶
var ErrClosed = errors.New("datastore closed")
var (
ProtocolBitswap protocol.ID = "/ipfs/lite/1.0.0"
)
var (
ProtocolPush protocol.ID = "/ipfs/push/1.0.0"
)
Functions ¶
func GetPublished ¶
func GetPublished(ctx context.Context, routing routing.ValueStore, datastore ds.Datastore, id peer.ID, checkRouting bool) (*pb.IpnsEntry, error)
GetPublished returns the record this node has published corresponding to the given peer ID.
If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
func NewLiteHost ¶
func NewLiteHost(host host.Host, listener Listener) bsmnet.BitSwapNetwork
NewMoinHost returns a BitSwapNetwork supported by underlying IPFS host.
func PkKeyForID ¶
PkKeyForID returns the public key routing key for the given peer ID.
func PublishEntry ¶
func PublishPublicKey ¶
func PublishWithEOL ¶
func PublishWithEOL(ctx context.Context, routing routing.ValueStore, ds ds.Datastore, k ci.PrivKey, value path.Path, eol time.Time, sequence Sequence) error
PublishWithEOL is a temporary stand in for the ipns records implementation see here for more details: https://github.com/ipfs/specs/tree/master/records
func PutRecordToRouting ¶
func ResolveNode ¶
func ResolvePath ¶
Types ¶
type Adder ¶
type Adder struct { Trickle bool RawLeaves bool NoCopy bool Chunker string CidBuilder cid.Builder // contains filtered or unexported fields }
Adder holds the switches passed to the `add` command.
func (*Adder) AddFileNode ¶
AddAllAndPin adds the given request's files and pin them.
func (*Adder) AddLinkToDir ¶
type BS ¶
type BS struct {
blockstore.Blockstore
}
type ConnectionListener ¶
type Datastore ¶
type Datastore struct { DB *badger.DB // contains filtered or unexported fields }
func NewDatastore ¶
NewDatastore creates a new badger datastore.
DO NOT set the Dir and/or ValuePath fields of opt, they will be set for you.
func (*Datastore) DiskUsage ¶
DiskUsage implements the PersistentDatastore interface. It returns the sum of lsm and value log files sizes in bytes.
func (*Datastore) NewTransaction ¶
NewTransaction starts a new transaction. The resulting transaction object can be mutated without incurring changes to the underlying DataStore until the transaction is Committed.
func (*Datastore) PutWithTTL ¶
type DirEntry ¶
type DirEntry struct { Name string Cid cid.Cid // Only filled when asked to resolve the directory entry. Size uint64 // The size of the file in bytes (or the size of the symlink). Type int32 // The type of the file. Err error }
DirEntry is a directory entry returned by `Ls`.
type LoaderClose ¶
type LoaderClose interface {
Close() bool
}
type LsInfoClose ¶
type Node ¶
type Node struct { GracePeriod string LowWater int HighWater int Port int PeerID string PrivateKey string PublicKey string RepoPath string Agent string EnablePrivateNetwork bool SwarmKey []byte Running bool Shutdown bool PrivateNetwork bool Pushing bool Listener Listener Badger *badger.DB DataStore ds.Batching PeerStore peerstore.Peerstore RecordValidator record.Validator BlockStore blockstore.Blockstore BlockService blockservice.BlockService DagService format.DAGService Host host.Host ConnectionManager connmgr.ConnManager Routing routing.Routing }
func (*Node) AddLinkToDir ¶
func (*Node) CheckSwarmKey ¶
func (*Node) CreateEmptyDir ¶
func (*Node) DhtFindProvs ¶
func (*Node) DhtFindProvsTimeout ¶
func (*Node) FindProviders ¶
func (*Node) GetRawPrivateKey ¶
func (*Node) NumSwarmPeers ¶
func (*Node) OpenDatabase ¶
func (*Node) PublishName ¶
func (n *Node) PublishName(p string, close PublisherClose, sequence Sequence) error
func (*Node) RemoveLinkFromDir ¶
func (*Node) ResolveName ¶
func (*Node) ResolveNode ¶
func (*Node) ResolvePath ¶
func (n *Node) ResolvePath(ctx context.Context, dag ipld.DAGService, p path.Path) (path.Resolved, error)
ResolvePath resolves the path `p` using Unixfs resolver, returns the resolved path.
func (*Node) RmBlocks ¶
func (n *Node) RmBlocks(blocks blockstore.GCBlockstore, cids []cid.Cid) error
RmBlocks removes the blocks provided in the cids slice. It returns a channel where objects of type RemovedBlock are placed, when not using the Quiet option. Block removal is asynchronous and will skip any pinned blocks.
func (*Node) SwarmPeers ¶
func (n *Node) SwarmPeers(stream PeerStream) error
type PeerStream ¶
type PeerStream interface {
Peer(ID string)
}
type PublisherClose ¶
type PublisherClose interface {
Close() bool
}
type RefWriter ¶
type ResolveInfo ¶
type UnknownUserError ¶
type UnknownUserError string
func (UnknownUserError) Error ¶
func (err UnknownUserError) Error() string
type VerifBS ¶
type VerifBS struct { bstore.Blockstore Listener Listener }
type VerifBSGC ¶
type VerifBSGC struct {
bstore.GCBlockstore
}
type Writer ¶
type Writer struct {
Writer WriterStream
}