thor

package module
v0.0.0-...-da45d7d Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

README

thor

go get -d github.com/remmerw/thor

cd $GOPATH/src/github.com/remmerw/thor

go mod vendor

go mod tidy

cd $HOME

set GO111MODULE=off

gomobile bind -o thor-1.1.6.aar -v -androidapi=26 -target=android -ldflags="-s -w" github.com/remmerw/thor

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

This section is empty.

Functions

func DecodePrivateKey

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

func NewBlockstore

func NewBlockstore(listener Listener) bstore.Blockstore

func NewLeacher

func NewLeacher(listener Listener) bstore.Blockstore

NewBlockstore returns a default Blockstore implementation using the provided datastore.Batching backend.

Types

type Closeable

type Closeable interface {
	Close() bool
}

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 Leacher

type Leacher struct {
	Listener Listener
	// contains filtered or unexported fields
}

func (*Leacher) AllKeysChan

func (bs *Leacher) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)

AllKeysChan runs a query for keys from the blockstore. this is very simplistic, in the future, take dsq.Query as a param?

AllKeysChan respects context.

func (*Leacher) DeleteBlock

func (bs *Leacher) DeleteBlock(k cid.Cid) error

func (*Leacher) Get

func (bs *Leacher) Get(k cid.Cid) (blocks.Block, error)

func (*Leacher) GetSize

func (bs *Leacher) GetSize(k cid.Cid) (int, error)

func (*Leacher) Has

func (bs *Leacher) Has(k cid.Cid) (bool, error)

func (*Leacher) HashOnRead

func (bs *Leacher) HashOnRead(enabled bool)

func (*Leacher) Put

func (bs *Leacher) Put(block blocks.Block) error

func (*Leacher) PutMany

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

type Listener

type Listener interface {
	Error(string)
	Info(string)
	Verbose(string)
	BlockPut(string, []byte)
	BlockGet(string) []byte
	BlockHas(string) bool
	BlockSize(string) int
	BlockDelete(string)
}

type Loader

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

func (*Loader) Close

func (fd *Loader) Close() error

func (*Loader) Load

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

func (*Loader) Seek

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

type LsInfoClose

type LsInfoClose interface {
	LsInfo(NAME string, HASH string, SIZE int, TYPE int32)
	Closeable
}

type Node

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

	PeerID     string
	PrivateKey string
	PublicKey  string
	RepoPath   string
	Agent      string

	Running           bool
	Shutdown          bool
	Listener          Listener
	PeerStore         peerstore.Peerstore
	RecordValidator   record.Validator
	BlockStore        bs.Blockstore
	BlockService      blockservice.BlockService
	DagService        format.DAGService
	Host              host.Host
	ConnectionManager connmgr.ConnManager
	Routing           routing.Routing
}

func NewNode

func NewNode(listener Listener) *Node

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() error

func (*Node) DecodeName

func (n *Node) DecodeName(name string) string

func (*Node) DhtFindProvs

func (n *Node) DhtFindProvs(mcid string, provider Provider, numProviders int, close Closeable) error

func (*Node) DhtFindProvsTimeout

func (n *Node) DhtFindProvsTimeout(mcid string, provider Provider, numProviders int, timeout int32) error

func (*Node) DhtProvide

func (n *Node) DhtProvide(mcid string, close Closeable) error

func (*Node) DhtProvideTimeout

func (n *Node) DhtProvideTimeout(mcid string, timeout int32) error

func (*Node) FindPeer

func (n *Node) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error)

func (*Node) FindProviders

func (n *Node) FindProviders(ctx context.Context, p path.Path, numProviders int) (<-chan peer.AddrInfo, error)

func (*Node) GetLoader

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

func (*Node) GetRawPrivateKey

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

func (*Node) Identity

func (n *Node) Identity() error

func (*Node) IsConnected

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

func (*Node) IsDir

func (n *Node) IsDir(paths string, close Closeable) (bool, error)

func (*Node) Ls

func (n *Node) Ls(paths string, info LsInfoClose, resolveChildren bool) error

func (*Node) Lss

func (n *Node) Lss(ctx context.Context, p path.Path, resolveChildren bool) (<-chan DirEntry, error)

func (*Node) PidCheck

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

func (*Node) Provide

func (n *Node) Provide(ctx context.Context, path path.Path) error

func (*Node) Resolve

func (n *Node) Resolve(paths string, close Closeable) string

func (*Node) ResolveName

func (n *Node) ResolveName(info ResolveInfo, name string, offline bool, dhtRecords int) 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) SwarmConnect

func (n *Node) SwarmConnect(addr string, close Closeable) (bool, error)

func (*Node) SwarmConnectTimeout

func (n *Node) SwarmConnectTimeout(addr string, timeout int32) (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 Provider

type Provider interface {
	Pid(Message string)
}

type ResolveInfo

type ResolveInfo interface {
	Resolved(Data []byte)
	Closeable
}

type StreamInfo

type StreamInfo struct {
	Protocol string
}

type WriterStream

type WriterStream interface {
	Load(int) (int, error)
}

Jump to

Keyboard shortcuts

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