fs

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: GPL-3.0 Imports: 38 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotDirectory = errors.New("could not get next file, not a directory")
	ErrNotReader    = errors.New("this is a directory, cannot call read functions")
)
View Source
var (
	ErrStreamDisabled     = errors.New("libp2pStreamMounting is disabled")
	ErrListenerRegistered = errors.New("listener is already registered")
	ErrListenerClosed     = errors.New("listener is closed")
)
View Source
var (
	ErrNoPubSub = errors.New("IPFS pubsub is not initialized")
	ErrSubStop  = errors.New("stop subscription")
)
View Source
var ErrNotFound = errors.New("not found")

Functions

func ListenHostOpt

func ListenHostOpt(v string) ipfsOpt

func ListenPortOpt

func ListenPortOpt(v string) ipfsOpt

func NewObjectFile

func NewObjectFile(meta proto.ObjectMeta, body io.ReadCloser) (files.File, error)

func NewPrivateKey

func NewPrivateKey() ([]byte, error)

func UseBootstrapPeersOpt

func UseBootstrapPeersOpt(peers []string) ipfsOpt

func UseCacheOpt

func UseCacheOpt(cache PlanetaryCache) ipfsOpt

func UseNetworkProfileOpt

func UseNetworkProfileOpt(profile NetworkProfile) ipfsOpt

func UsePubSubOpt

func UsePubSubOpt(v bool) ipfsOpt

func UseRelayOpt

func UseRelayOpt(v bool) ipfsOpt

func UseStoreOpt

func UseStoreOpt(v bool) ipfsOpt

func VerifyDataSignature

func VerifyDataSignature(nodeID, sig string, data []byte) (bool, error)

Types

type BandwidthStats

type BandwidthStats struct {
	TotalIn  int64   `json:"total_in"`
	TotalOut int64   `json:"total_out"`
	RateIn   float64 `json:"rate_in"`
	RateOut  float64 `json:"rate_out"`
}

type BitswapStats

type BitswapStats struct {
	ProvideBufLen   int      `json:"provide_buf_len"`
	WantlistLen     int      `json:"wantlist_len"`
	Peers           []string `json:"peers"`
	BlocksReceived  uint64   `json:"blocks_received"`
	DataReceived    uint64   `json:"data_receiver"`
	BlocksSent      uint64   `json:"blocks_sent"`
	DataSent        uint64   `json:"data_sent"`
	DupBlksReceived uint64   `json:"dup_blks_received"`
	DupDataReceived uint64   `json:"dup_data_received"`
}

type DiskStats

type DiskStats struct {
	BytesAll  uint64 `json:"bytes_all"`
	BytesUsed uint64 `json:"bytes_used"`
	BytesFree uint64 `json:"bytes_free"`
}

type Message

type Message struct {
	From     string   `json:"from,omitempty"`
	Data     []byte   `json:"data,omitempty"`
	Seqno    []byte   `json:"seqno,omitempty"`
	TopicIDs []string `json:"topicIDs,omitempty"`
}

type MessagePeekFunc

type MessagePeekFunc func(m *Message) error

type NetworkProfile

type NetworkProfile string
const (
	// NetworkDefault restores default network settings. Agressively discovers private IPs in local network.
	//
	// Activates `default-networking` and `local-discovery` profiles for IPFS.
	NetworkDefault NetworkProfile = "default"

	// NetworkServer is recommended for nodes with public IPv4 address (servers, VPSes, etc.),
	// disables host and content discovery in local networks. Use if the provider warns about DDoS from your node.
	//
	// Activates `default-networking` and `server` profiles for IPFS.
	NetworkServer NetworkProfile = "server"

	// NetworkTest reduces external interference, useful for running ipfs in test environments.
	// Note that with these settings node won't be able to talk to the rest of the
	// network without manual bootstrap.
	//
	// Activates `test` profile for IPFS.
	NetworkTest NetworkProfile = "test"

	// NetworkNoModify skips settings network profile for existing IPFS repos.
	NetworkNoModify NetworkProfile = "no-modify"
)

type Object

type Object struct {
	ObjectRef

	Meta *proto.ObjectMeta
	Body io.ReadCloser
}

type ObjectRef

type ObjectRef struct {
	ID   string
	Path string
	Size int64

	Version         string
	VersionPrevious string
	VersionOffset   int
	// contains filtered or unexported fields
}

func (*ObjectRef) Meta

func (o *ObjectRef) Meta() *proto.ObjectMeta

func (ObjectRef) NextVersion

func (o ObjectRef) NextVersion() ObjectRef

func (ObjectRef) PrevVersion

func (o ObjectRef) PrevVersion() ObjectRef

func (*ObjectRef) SetMeta

func (o *ObjectRef) SetMeta(m *proto.ObjectMeta)

func (*ObjectRef) ToProto

func (o *ObjectRef) ToProto() (proto.ObjectMeta, error)

type PlanetaryCache

type PlanetaryCache interface{}

type PlanetaryClient

type PlanetaryClient interface {
	// Do performs a HTTP request over the pipe to PlanetaryListener, e.g.
	// GET http://14V8BYb2dEc3wEwLZroaaTDhoW9TjAMXBnH8BBHj8e5ZEF4hB/private/v1/ping
	Do(req *http.Request) (*http.Response, error)
	Close()
}

type PlanetaryFileStore

type PlanetaryFileStore interface {
	NodeID() string
	SignData(peerID string, data []byte) ([]byte, error)

	PubSub() (PlanetaryPubSub, error)
	Listener() PlanetaryListener
	Client() PlanetaryClient

	PinObject(ref ObjectRef) error
	PutObject(ctx context.Context, ref ObjectRef, userMeta []byte, body io.ReadCloser) (*ObjectRef, error)
	DeleteObject(ctx context.Context, ref ObjectRef) (*ObjectRef, error)
	GetObject(ctx context.Context, ref ObjectRef) (*Object, error)
	HeadObject(ctx context.Context, ref ObjectRef) (*ObjectRef, error)
	ListObjects(ctx context.Context, ref ObjectRef) ([]ObjectRef, error)

	DiskStats() (*DiskStats, error)
	BandwidthStats() *BandwidthStats
	RepoStats() *RepoStats
	BitswapStats() *BitswapStats

	Close() error
}

func InitPlanetaryFileStore

func InitPlanetaryFileStore(prefix string, opts ...ipfsOpt) (PlanetaryFileStore, error)

func NewPlanetaryFileStore

func NewPlanetaryFileStore(prefix string, opts ...ipfsOpt) (PlanetaryFileStore, error)

type PlanetaryListener

type PlanetaryListener interface {
	Listen(addr string) error
	IsRunning() bool
	Close() error
}

type PlanetaryPubSub

type PlanetaryPubSub interface {
	Publish(topic string, data []byte) error
	Subscribe(fn MessagePeekFunc, topics ...string) error
	Close() error
}

type RefWriter

type RefWriter struct {
	DAG ipld.DAGService
	Ctx context.Context

	Unique    bool
	Recursive bool
	PrintFmt  string
	// contains filtered or unexported fields
}

RefWriter implementation from go-ipfs/commands/refs.go

func (*RefWriter) WriteEdge

func (rw *RefWriter) WriteEdge(from, to *cid.Cid, linkname string) error

Write one edge

func (*RefWriter) WriteRefs

func (rw *RefWriter) WriteRefs(n ipld.Node) (int, error)

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

type RepoStats

type RepoStats struct {
	NumObjects uint64 `json:"num_objects"`
	RepoSize   uint64 `json:"repo_size"`
	RepoPath   string `json:"repo_path"`
	Version    string `json:"version"`
	StorageMax uint64 `json:"storage_max"`
}

Jump to

Keyboard shortcuts

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