moin

package module
Version: v0.0.0-...-110ef93 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 70 Imported by: 0

README

moin

go get gitlab.com/remmer.wilts/moin

set GO111MODULE=off

gomobile bind -o moin.aar -v -androidapi=24 -target=android gitlab.com/remmer.wilts/moin

Documentation

Index

Constants

View Source
const (
	// TFile is a regular file.
	TFile = 2
	// TDirectory is a directory.
	TDirectory = 1
	// TSymlink is a symlink.
	TSymlink = 4
)

Variables

View Source
var ErrClosed = errors.New("datastore closed")
View Source
var (
	ProtocolMoin protocol.ID = "/ipfs/moin/1.0.0"
)
View Source
var (
	ProtocolPush protocol.ID = "/ipfs/push/1.0.0"
)

Functions

func DecodePrivateKey

func DecodePrivateKey(privKey string) (ci.PrivKey, error)

func NewMoinHost

func NewMoinHost(host host.Host, listener Listener) bsmnet.BitSwapNetwork

NewMoinHost returns a BitSwapNetwork supported by underlying IPFS host.

func ResolveNode

func ResolveNode(ctx context.Context, dag ipld.NodeGetter, p path.Path) (ipld.Node, error)

func ResolvePath

func ResolvePath(ctx context.Context, dag ipld.NodeGetter, p path.Path) (path.Resolved, error)

Types

type Adder

type Adder struct {
	RawLeaves bool
	NoCopy    bool
	Chunker   string

	CidBuilder cid.Builder
	// contains filtered or unexported fields
}

Adder holds the switches passed to the `add` command.

func NewAdder

func NewAdder(ctx context.Context, ds ipld.DAGService) (*Adder, error)

NewAdder Returns a new Adder used for a file add operation.

func (*Adder) Add

func (adder *Adder) Add(reader io.Reader) (ipld.Node, error)

Constructs a node from reader's data, and adds it. Doesn't pin.

func (*Adder) AddFileNode

func (adder *Adder) AddFileNode(file files.Node) (ipld.Node, error)

AddAllAndPin adds the given request's files and pin them.

func (*Adder) AddLinkToDir

func (adder *Adder) AddLinkToDir(node ipld.Node, name string, link ipld.Node) (ipld.Node, error)

func (*Adder) CreateDir

func (adder *Adder) CreateDir(node ipld.Node) (ipld.Node, error)

func (*Adder) CreateEmptyDir

func (adder *Adder) CreateEmptyDir() (ipld.Node, error)

func (*Adder) RemoveLinkFromDir

func (adder *Adder) RemoveLinkFromDir(node ipld.Node, name string) (ipld.Node, error)

type BS

type BS struct {
	blockstore.Blockstore
}

func (*BS) Get

func (bs *BS) Get(c cid.Cid) (blocks.Block, error)

func (*BS) Put

func (bs *BS) Put(b blocks.Block) error

func (*BS) PutMany

func (bs *BS) PutMany(blks []blocks.Block) error

type ConnectionListener

type ConnectionListener interface {
	PeerConnected(peer.ID)
	PeerDisconnected(peer.ID)
}

type Datastore

type Datastore struct {
	DB *badger.DB
	// contains filtered or unexported fields
}

func Create

func Create(path string) (*Datastore, error)

func NewDatastore

func NewDatastore(path string, opt badger.Options) (*Datastore, error)

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) Batch

func (d *Datastore) Batch() (ds.Batch, error)

func (*Datastore) Close

func (d *Datastore) Close() error

func (*Datastore) Delete

func (d *Datastore) Delete(key ds.Key) error

func (*Datastore) DiskUsage

func (d *Datastore) DiskUsage() (uint64, error)

DiskUsage implements the PersistentDatastore interface. It returns the sum of lsm and value log files sizes in bytes.

func (*Datastore) Get

func (d *Datastore) Get(key ds.Key) (value []byte, err error)

func (*Datastore) GetExpiration

func (d *Datastore) GetExpiration(key ds.Key) (time.Time, error)

func (*Datastore) GetSize

func (d *Datastore) GetSize(key ds.Key) (size int, err error)

func (*Datastore) Has

func (d *Datastore) Has(key ds.Key) (bool, error)

func (*Datastore) NewTransaction

func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error)

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) Put

func (d *Datastore) Put(key ds.Key, value []byte) error

func (*Datastore) PutWithTTL

func (d *Datastore) PutWithTTL(key ds.Key, value []byte, ttl time.Duration) error

func (*Datastore) Query

func (d *Datastore) Query(q dsq.Query) (dsq.Results, error)

func (*Datastore) SetTTL

func (d *Datastore) SetTTL(key ds.Key, ttl time.Duration) error

func (*Datastore) Sync

func (d *Datastore) Sync(prefix ds.Key) error

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 Link struct {
	Name, Hash string
	Size       uint64
}

type Listener

type Listener interface {
	Error(string)
	Info(string)
	Verbose(string)
	AllowConnect(string) bool
	Push(string, string)
	Connected(string)
}

type Loader

type Loader struct {
	DagReader uio.DagReader
	Size      int64
	Data      []byte
	Read      int
}

func (*Loader) Close

func (fd *Loader) Close() error

func (*Loader) Load

func (fd *Loader) Load(size int64, close LoaderClose) error

func (*Loader) Seek

func (fd *Loader) Seek(position int64, close LoaderClose) error

type LoaderClose

type LoaderClose interface {
	Close() bool
}

type NetOpt

type NetOpt func(*Settings)

func Prefix

func Prefix(prefix protocol.ID) NetOpt

func SupportedProtocols

func SupportedProtocols(protos []protocol.ID) NetOpt

type Node

type Node struct {
	GracePeriod string
	LowWater    int
	HighWater   int
	Port        int

	PeerID     string
	PrivateKey string
	PublicKey  string
	RepoPath   string

	Debug             bool
	Pushing           bool
	Running           bool
	Shutdown          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 NewNode

func NewNode(listener Listener, repoPath string) *Node

func (*Node) AddFile

func (n *Node) AddFile(fpath string) (string, error)

func (*Node) CidCheck

func (n *Node) CidCheck(multihash string) error

func (*Node) Connect

func (n *Node) Connect(ctx context.Context, pi peer.AddrInfo) error

func (*Node) Daemon

func (n *Node) Daemon(agent string) error

func (*Node) Disconnect

func (n *Node) Disconnect(addr ma.Multiaddr) error

func (*Node) GetLoader

func (n *Node) GetLoader(paths string, close LoaderClose) (*Loader, error)

func (*Node) GetRawPrivateKey

func (n *Node) GetRawPrivateKey() (string, error)

func (*Node) GetReader

func (n *Node) GetReader(paths string) (*Reader, error)

func (*Node) Id

func (n *Node) Id() (*PeerInfo, error)

func (*Node) Identity

func (n *Node) Identity() error

func (*Node) IsConnected

func (n *Node) IsConnected(pid string) (bool, error)

func (*Node) OpenDatabase

func (n *Node) OpenDatabase() error

func (*Node) PidCheck

func (n *Node) PidCheck(pid string) error

func (*Node) PidInfo

func (n *Node) PidInfo(pid string) (*PeerInfo, error)

func (*Node) Push

func (n *Node) Push(pid string, msg []byte) (int, error)

func (*Node) RepoGC

func (n *Node) RepoGC() error

func (*Node) ResolveNode

func (n *Node) ResolveNode(ctx context.Context, dag ipld.DAGService, p path.Path) (ipld.Node, error)

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) Rm

func (n *Node) Rm(paths string, recursive bool) error

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) Stream

func (n *Node) Stream(stream WriterStream) (string, error)

func (*Node) SwarmConnect

func (n *Node) SwarmConnect(addr string, timeout int32) (bool, error)

func (*Node) SwarmDisconnect

func (n *Node) SwarmDisconnect(addr string) (bool, error)

func (*Node) SwarmPeer

func (n *Node) SwarmPeer(pid string) (*Peer, error)

func (*Node) SwarmPeers

func (n *Node) SwarmPeers() int

type Peer

type Peer struct {
	Address string
	ID      string
}

type PeerInfo

type PeerInfo struct {
	ID              string
	PublicKey       string
	AgentVersion    string
	ProtocolVersion string
}

type Reader

type Reader struct {
	DagReader uio.DagReader
	Size      int64
	Data      []byte
	Read      int
}

func (*Reader) Close

func (fd *Reader) Close() error

func (*Reader) Load

func (fd *Reader) Load(size int64) error

func (*Reader) ReadAt

func (fd *Reader) ReadAt(position int64, size int64) error

func (*Reader) Seek

func (fd *Reader) Seek(position int64) error

type RefWriter

type RefWriter struct {
	DAG      ipld.DAGService
	Ctx      context.Context
	Paths    []string
	Unique   bool
	MaxDepth int
	PrintFmt string
	// contains filtered or unexported fields
}

func (*RefWriter) EvalRefs

func (rw *RefWriter) EvalRefs(n ipld.Node, enc cidenc.Encoder) (int, error)

WriteRefs writes refs of the given object to the underlying writer.

type Settings

type Settings struct {
	ProtocolPrefix     protocol.ID
	SupportedProtocols []protocol.ID
}

type UnknownUserError

type UnknownUserError string

func (UnknownUserError) Error

func (err UnknownUserError) Error() string

type Writer

type Writer struct {
	Writer WriterStream
}

func (*Writer) Read

func (fd *Writer) Read(p []byte) (n int, err error)

type WriterStream

type WriterStream interface {
	Read() (n int, err error)
	Data() []byte
	Close() bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL