powergate: github.com/textileio/powergate/api/client Index | Files

package client

import "github.com/textileio/powergate/api/client"

Index

Package Files

asks.go client.go faults.go ffs.go health.go miners.go net.go reputation.go wallet.go

Constants

const AuthKey = ctxKey("ffstoken")

AuthKey is the key that should be used to set the auth token in a Context.

func CreateClientConn Uses

func CreateClientConn(target string, optsOverrides ...grpc.DialOption) (*grpc.ClientConn, error)

CreateClientConn creates a gRPC connection with sensible defaults and the provided overrides.

type Asks Uses

type Asks struct {
    // contains filtered or unexported fields
}

Asks provides an API for viewing asks data.

func (*Asks) Get Uses

func (a *Asks) Get(ctx context.Context) (*ask.Index, error)

Get returns the current index of available asks.

func (*Asks) Query Uses

func (a *Asks) Query(ctx context.Context, query ask.Query) ([]ask.StorageAsk, error)

Query executes a query to retrieve active Asks.

type Client Uses

type Client struct {
    Asks       *Asks
    Miners     *Miners
    Faults     *Faults
    Wallet     *Wallet
    Reputation *Reputation
    FFS        *FFS
    Health     *Health
    Net        *Net
    // contains filtered or unexported fields
}

Client provides the client api.

func NewClient Uses

func NewClient(host string, optsOverrides ...grpc.DialOption) (*Client, error)

NewClient creates a client.

func (*Client) BuildInfo Uses

func (c *Client) BuildInfo(ctx context.Context) (*buildinfoRpc.BuildInfoResponse, error)

BuildInfo returns build info about the server.

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the client's grpc connection and cancels any active requests.

func (*Client) Host Uses

func (c *Client) Host() string

Host returns the client host address.

type FFS Uses

type FFS struct {
    // contains filtered or unexported fields
}

FFS provides the API to create and interact with an FFS instance.

func (*FFS) Addrs Uses

func (f *FFS) Addrs(ctx context.Context) ([]api.AddrInfo, error)

Addrs returns a list of addresses managed by the FFS instance.

func (*FFS) CancelJob Uses

func (f *FFS) CancelJob(ctx context.Context, jid ffs.JobID) error

CancelJob signals that the executing Job with JobID jid should be canceled.

func (*FFS) Create Uses

func (f *FFS) Create(ctx context.Context) (string, string, error)

Create creates a new FFS instance, returning the instance ID and auth token.

func (*FFS) CreatePayChannel Uses

func (f *FFS) CreatePayChannel(ctx context.Context, from string, to string, amount uint64) (ffs.PaychInfo, cid.Cid, error)

CreatePayChannel creates a new payment channel.

func (*FFS) DefaultStorageConfig Uses

func (f *FFS) DefaultStorageConfig(ctx context.Context) (ffs.StorageConfig, error)

DefaultStorageConfig returns the default storage config.

func (*FFS) Get Uses

func (f *FFS) Get(ctx context.Context, c cid.Cid) (io.Reader, error)

Get returns an io.Reader for reading a stored Cid from the Hot Storage.

func (*FFS) GetFolder Uses

func (f *FFS) GetFolder(ctx context.Context, ipfsRevProxyAddr string, c cid.Cid, outputDir string) error

GetFolder retrieves to outputDir a Cid which corresponds to a folder.

func (*FFS) GetStorageConfig Uses

func (f *FFS) GetStorageConfig(ctx context.Context, c cid.Cid) (*rpc.GetStorageConfigResponse, error)

GetStorageConfig gets the current config for a cid.

func (*FFS) GetStorageJob Uses

func (f *FFS) GetStorageJob(ctx context.Context, jid ffs.JobID) (ffs.StorageJob, error)

GetStorageJob returns the current state of the specified job.

func (*FFS) ID Uses

func (f *FFS) ID(ctx context.Context) (ffs.APIID, error)

ID returns the FFS instance ID.

func (*FFS) Info Uses

func (f *FFS) Info(ctx context.Context) (api.InstanceInfo, error)

Info returns information about the FFS instance.

func (*FFS) ListAPI Uses

func (f *FFS) ListAPI(ctx context.Context) ([]ffs.APIID, error)

ListAPI returns a list of existing API instances.

func (*FFS) ListPayChannels Uses

func (f *FFS) ListPayChannels(ctx context.Context) ([]ffs.PaychInfo, error)

ListPayChannels returns a list of payment channels.

func (*FFS) ListRetrievalDealRecords Uses

func (f *FFS) ListRetrievalDealRecords(ctx context.Context, opts ...ListDealRecordsOption) ([]deals.RetrievalDealRecord, error)

ListRetrievalDealRecords returns a list of retrieval deals for the FFS instance according to the provided options.

func (*FFS) ListStorageDealRecords Uses

func (f *FFS) ListStorageDealRecords(ctx context.Context, opts ...ListDealRecordsOption) ([]deals.StorageDealRecord, error)

ListStorageDealRecords returns a list of storage deals for the FFS instance according to the provided options.

func (*FFS) NewAddr Uses

func (f *FFS) NewAddr(ctx context.Context, name string, options ...NewAddressOption) (string, error)

NewAddr created a new wallet address managed by the FFS instance.

func (*FFS) PushStorageConfig Uses

func (f *FFS) PushStorageConfig(ctx context.Context, c cid.Cid, opts ...PushStorageConfigOption) (ffs.JobID, error)

PushStorageConfig push a new configuration for the Cid in the Hot and Cold layers.

func (*FFS) RedeemPayChannel Uses

func (f *FFS) RedeemPayChannel(ctx context.Context, addr string) error

RedeemPayChannel redeems a payment channel.

func (*FFS) Remove Uses

func (f *FFS) Remove(ctx context.Context, c cid.Cid) error

Remove removes a Cid from being tracked as an active storage. The Cid should have both Hot and Cold storage disabled, if that isn't the case it will return ErrActiveInStorage.

func (*FFS) Replace Uses

func (f *FFS) Replace(ctx context.Context, c1 cid.Cid, c2 cid.Cid) (ffs.JobID, error)

Replace pushes a StorageConfig for c2 equal to that of c1, and removes c1. This operation is more efficient than manually removing and adding in two separate operations.

func (*FFS) SendFil Uses

func (f *FFS) SendFil(ctx context.Context, from string, to string, amount int64) error

SendFil sends fil from a managed address to any another address, returns immediately but funds are sent asynchronously.

func (*FFS) SetDefaultStorageConfig Uses

func (f *FFS) SetDefaultStorageConfig(ctx context.Context, config ffs.StorageConfig) error

SetDefaultStorageConfig sets the default storage config.

func (*FFS) Show Uses

func (f *FFS) Show(ctx context.Context, c cid.Cid) (*rpc.ShowResponse, error)

Show returns information about the current storage state of a cid.

func (*FFS) SignMessage Uses

func (f *FFS) SignMessage(ctx context.Context, addr string, message []byte) ([]byte, error)

SignMessage signs a message with a FFS managed wallet address.

func (*FFS) Stage Uses

func (f *FFS) Stage(ctx context.Context, data io.Reader) (*cid.Cid, error)

Stage allows to temporarily stage data in the Hot Storage in preparation for pushing a cid storage config.

func (*FFS) StageFolder Uses

func (f *FFS) StageFolder(ctx context.Context, ipfsRevProxyAddr string, folderPath string) (cid.Cid, error)

StageFolder allows to temporarily stage a folder in the Hot Storage in preparation for pushing a cid storage config.

func (*FFS) VerifyMessage Uses

func (f *FFS) VerifyMessage(ctx context.Context, addr string, message, signature []byte) (bool, error)

VerifyMessage verifies a message signature from a wallet address.

func (*FFS) WatchJobs Uses

func (f *FFS) WatchJobs(ctx context.Context, ch chan<- JobEvent, jids ...ffs.JobID) error

WatchJobs pushes JobEvents to the provided channel. The provided channel will be owned by the client after the call, so it shouldn't be closed by the client. To stop receiving events, the provided ctx should be canceled. If an error occurs, it will be returned in the Err field of JobEvent and the channel will be closed.

func (*FFS) WatchLogs Uses

func (f *FFS) WatchLogs(ctx context.Context, ch chan<- LogEvent, c cid.Cid, opts ...WatchLogsOption) error

WatchLogs pushes human-friendly messages about Cid executions. The method is blocking and will continue to send messages until the context is canceled. The provided channel is owned by the method and must not be closed.

type Faults Uses

type Faults struct {
    // contains filtered or unexported fields
}

Faults provides an API for viewing faults data.

func (*Faults) Get Uses

func (s *Faults) Get(ctx context.Context) (*faults.IndexSnapshot, error)

Get returns the current index of miner faults data.

type Health Uses

type Health struct {
    // contains filtered or unexported fields
}

Health provides an API for checking node Health.

func (*Health) Check Uses

func (health *Health) Check(ctx context.Context) (h.Status, []string, error)

Check returns the node health status and any related messages.

type JobEvent Uses

type JobEvent struct {
    Job ffs.StorageJob
    Err error
}

JobEvent represents an event for Watching a job.

type ListDealRecordsOption Uses

type ListDealRecordsOption func(*rpc.ListDealRecordsConfig)

ListDealRecordsOption updates a ListDealRecordsConfig.

func WithAscending Uses

func WithAscending(ascending bool) ListDealRecordsOption

WithAscending specifies to sort the results in ascending order. Default is descending order. Records are sorted by timestamp.

func WithDataCids Uses

func WithDataCids(cids ...string) ListDealRecordsOption

WithDataCids limits the results to deals for the provided data cids. If WithFromAddrs is also provided, this is an AND operation.

func WithFromAddrs Uses

func WithFromAddrs(addrs ...string) ListDealRecordsOption

WithFromAddrs limits the results deals initiated from the provided wallet addresses. If WithDataCids is also provided, this is an AND operation.

func WithIncludeFinal Uses

func WithIncludeFinal(includeFinal bool) ListDealRecordsOption

WithIncludeFinal specifies whether or not to include final deals in the results. Default is false. Ignored for ListRetrievalDealRecords.

func WithIncludePending Uses

func WithIncludePending(includePending bool) ListDealRecordsOption

WithIncludePending specifies whether or not to include pending deals in the results. Default is false. Ignored for ListRetrievalDealRecords.

type LogEvent Uses

type LogEvent struct {
    LogEntry ffs.LogEntry
    Err      error
}

LogEvent represents an event for watching cid logs.

type Miners Uses

type Miners struct {
    // contains filtered or unexported fields
}

Miners provides an API for viewing miner data.

func (*Miners) Get Uses

func (a *Miners) Get(ctx context.Context) (*miner.IndexSnapshot, error)

Get returns the current index of available asks.

type Net Uses

type Net struct {
    // contains filtered or unexported fields
}

Net provides the Net API.

func (*Net) ConnectPeer Uses

func (net *Net) ConnectPeer(ctx context.Context, addrInfo peer.AddrInfo) error

ConnectPeer connects to a peer.

func (*Net) Connectedness Uses

func (net *Net) Connectedness(ctx context.Context, peerID peer.ID) (n.Connectedness, error)

Connectedness returns the connection status to a peer.

func (*Net) DisconnectPeer Uses

func (net *Net) DisconnectPeer(ctx context.Context, peerID peer.ID) error

DisconnectPeer disconnects from a peer.

func (*Net) FindPeer Uses

func (net *Net) FindPeer(ctx context.Context, peerID peer.ID) (n.PeerInfo, error)

FindPeer finds a peer by peer id.

func (*Net) ListenAddr Uses

func (net *Net) ListenAddr(ctx context.Context) (peer.AddrInfo, error)

ListenAddr returns listener address info for the local node.

func (*Net) Peers Uses

func (net *Net) Peers(ctx context.Context) ([]n.PeerInfo, error)

Peers returns a list of peers.

type NewAddressOption Uses

type NewAddressOption func(r *rpc.NewAddrRequest)

NewAddressOption is a function that changes a NewAddressConfig.

func WithAddressType Uses

func WithAddressType(addressType string) NewAddressOption

WithAddressType specifies the type of address to create.

func WithMakeDefault Uses

func WithMakeDefault(makeDefault bool) NewAddressOption

WithMakeDefault specifies if the new address should become the default.

type PushStorageConfigOption Uses

type PushStorageConfigOption func(r *rpc.PushStorageConfigRequest)

PushStorageConfigOption mutates a push request.

func WithOverride Uses

func WithOverride(override bool) PushStorageConfigOption

WithOverride allows a new push configuration to override an existing one. It's used as an extra security measure to avoid unwanted configuration changes.

func WithStorageConfig Uses

func WithStorageConfig(c ffs.StorageConfig) PushStorageConfigOption

WithStorageConfig overrides the Api default Cid configuration.

type Reputation Uses

type Reputation struct {
    // contains filtered or unexported fields
}

Reputation provides an API for viewing reputation data.

func (*Reputation) AddSource Uses

func (r *Reputation) AddSource(ctx context.Context, id string, maddr ma.Multiaddr) error

AddSource adds a new external Source to be considered for reputation generation.

func (*Reputation) GetTopMiners Uses

func (r *Reputation) GetTopMiners(ctx context.Context, limit int) ([]reputation.MinerScore, error)

GetTopMiners gets the top n miners with best score.

type TokenAuth Uses

type TokenAuth struct {
    Secure bool
}

TokenAuth provides token based auth.

func (TokenAuth) GetRequestMetadata Uses

func (t TokenAuth) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error)

GetRequestMetadata returns request metadata that includes the auth token.

func (TokenAuth) RequireTransportSecurity Uses

func (t TokenAuth) RequireTransportSecurity() bool

RequireTransportSecurity specifies if the connection should be secure.

type Wallet Uses

type Wallet struct {
    // contains filtered or unexported fields
}

Wallet provides an API for managing filecoin wallets.

func (*Wallet) Balance Uses

func (w *Wallet) Balance(ctx context.Context, address string) (uint64, error)

Balance gets a filecoin wallet's balance.

func (*Wallet) List Uses

func (w *Wallet) List(ctx context.Context) ([]string, error)

List returns all wallet addresses.

func (*Wallet) NewAddress Uses

func (w *Wallet) NewAddress(ctx context.Context, typ string) (string, error)

NewAddress creates a new filecoin address [bls|secp256k1].

func (*Wallet) SendFil Uses

func (w *Wallet) SendFil(ctx context.Context, from, to string, amount int64) error

SendFil sends Fils from one address to another.

type WatchLogsOption Uses

type WatchLogsOption func(r *rpc.WatchLogsRequest)

WatchLogsOption is a function that changes GetLogsConfig.

func WithHistory Uses

func WithHistory(enabled bool) WatchLogsOption

WithHistory indicates that prior history logs should be sent in the channel before getting real time logs.

func WithJidFilter Uses

func WithJidFilter(jid ffs.JobID) WatchLogsOption

WithJidFilter filters only log messages of a Cid related to the Job with id jid.

Package client imports 39 packages (graph) and is imported by 8 packages. Updated 2020-09-30. Refresh now. Tools for package owners.