Documentation ¶
Index ¶
- Constants
- func CreateClientConn(target string, optsOverrides ...grpc.DialOption) (*grpc.ClientConn, error)
- type ApplyOption
- type Client
- type Data
- func (d *Data) CidInfo(ctx context.Context, cid string) (*userPb.CidInfoResponse, error)
- func (d *Data) CidSummary(ctx context.Context, cids ...string) (*userPb.CidSummaryResponse, error)
- func (d *Data) Get(ctx context.Context, cid string) (io.Reader, error)
- func (d *Data) GetFolder(ctx context.Context, ipfsRevProxyAddr, cid, outputDir string) error
- func (d *Data) ReplaceData(ctx context.Context, cid1, cid2 string) (*userPb.ReplaceDataResponse, error)
- func (d *Data) Stage(ctx context.Context, data io.Reader) (*userPb.StageResponse, error)
- func (d *Data) StageFolder(ctx context.Context, ipfsRevProxyAddr string, folderPath string) (string, error)
- func (d *Data) WatchLogs(ctx context.Context, ch chan<- WatchLogsEvent, cid string, ...) error
- type DealRecordsOption
- func WithAscending(ascending bool) DealRecordsOption
- func WithDataCids(cids ...string) DealRecordsOption
- func WithFromAddrs(addrs ...string) DealRecordsOption
- func WithIncludeFailed(includeFailed bool) DealRecordsOption
- func WithIncludeFinal(includeFinal bool) DealRecordsOption
- func WithIncludePending(includePending bool) DealRecordsOption
- type Deals
- type ListConfig
- type ListSelect
- type NewAddressOption
- type StorageConfig
- func (s *StorageConfig) Apply(ctx context.Context, cid string, opts ...ApplyOption) (*userPb.ApplyStorageConfigResponse, error)
- func (s *StorageConfig) Default(ctx context.Context) (*userPb.DefaultStorageConfigResponse, error)
- func (s *StorageConfig) Remove(ctx context.Context, cid string) (*userPb.RemoveResponse, error)
- func (s *StorageConfig) SetDefault(ctx context.Context, config *userPb.StorageConfig) (*userPb.SetDefaultStorageConfigResponse, error)
- type StorageInfo
- type StorageJobs
- func (j *StorageJobs) Cancel(ctx context.Context, jobID string) (*userPb.CancelStorageJobResponse, error)
- func (j *StorageJobs) Get(ctx context.Context, jobID string) (*userPb.StorageJobResponse, error)
- func (j *StorageJobs) List(ctx context.Context, config ListConfig) (*userPb.ListStorageJobsResponse, error)
- func (j *StorageJobs) StorageConfig(ctx context.Context, jobID string) (*userPb.StorageConfigForJobResponse, error)
- func (j *StorageJobs) Summary(ctx context.Context, opts ...SummaryOption) (*userPb.StorageJobsSummaryResponse, error)
- func (j *StorageJobs) Watch(ctx context.Context, ch chan<- WatchStorageJobsEvent, jobIDs ...string) error
- type SummaryOption
- type TokenAuth
- type Wallet
- func (w *Wallet) Addresses(ctx context.Context) (*userPb.AddressesResponse, error)
- func (w *Wallet) Balance(ctx context.Context, address string) (*userPb.BalanceResponse, error)
- func (w *Wallet) NewAddress(ctx context.Context, name string, options ...NewAddressOption) (*userPb.NewAddressResponse, error)
- func (w *Wallet) SendFil(ctx context.Context, from string, to string, amount *big.Int) (*userPb.SendFilResponse, error)
- func (w *Wallet) SignMessage(ctx context.Context, address string, message []byte) (*userPb.SignMessageResponse, error)
- func (w *Wallet) VerifyMessage(ctx context.Context, address string, message, signature []byte) (*userPb.VerifyMessageResponse, error)
- type WatchLogsEvent
- type WatchLogsOption
- type WatchStorageJobsEvent
Constants ¶
const AdminKey = ctxKey("admintoken")
AdminKey is the key that should be used to set the admin auth token in a Context.
const AuthKey = ctxKey("ffstoken")
AuthKey is the key that should be used to set the auth token in a Context.
Variables ¶
This section is empty.
Functions ¶
func CreateClientConn ¶
func CreateClientConn(target string, optsOverrides ...grpc.DialOption) (*grpc.ClientConn, error)
CreateClientConn creates a gRPC connection with sensible defaults and the provided overrides.
Types ¶
type ApplyOption ¶
type ApplyOption func(r *userPb.ApplyStorageConfigRequest)
ApplyOption mutates a push request.
func WithImportDealIDs ¶
func WithImportDealIDs(dealIDs []uint64) ApplyOption
WithImportDealIDs allows to import active on-chain deals to the Cid deals information.
func WithNoExec ¶
func WithNoExec(noExec bool) ApplyOption
WithNoExec allows to configure if a Job should ensure the new storage configuration.
func WithOverride ¶
func WithOverride(override bool) ApplyOption
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 ¶
func WithStorageConfig(c *userPb.StorageConfig) ApplyOption
WithStorageConfig overrides the Api default Cid configuration.
type Client ¶
type Client struct { StorageConfig *StorageConfig Data *Data Wallet *Wallet Deals *Deals StorageInfo *StorageInfo StorageJobs *StorageJobs Admin *admin.Admin // contains filtered or unexported fields }
Client provides the client api.
func NewClient ¶
func NewClient(host string, optsOverrides ...grpc.DialOption) (*Client, error)
NewClient creates a client.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data provides access to Powergate general data APIs.
func (*Data) CidSummary ¶
CidSummary gives a summary of the storage and jobs state of the specified cid.
func (*Data) ReplaceData ¶
func (d *Data) ReplaceData(ctx context.Context, cid1, cid2 string) (*userPb.ReplaceDataResponse, error)
ReplaceData 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 (*Data) Stage ¶
Stage allows to temporarily stage data in hot storage in preparation for pushing a cid storage config.
func (*Data) StageFolder ¶
func (d *Data) StageFolder(ctx context.Context, ipfsRevProxyAddr string, folderPath string) (string, error)
StageFolder allows to temporarily stage a folder in hot storage in preparation for pushing a cid storage config.
func (*Data) WatchLogs ¶
func (d *Data) WatchLogs(ctx context.Context, ch chan<- WatchLogsEvent, cid string, 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 DealRecordsOption ¶
type DealRecordsOption func(*userPb.DealRecordsConfig)
DealRecordsOption updates a ListDealRecordsConfig.
func WithAscending ¶
func WithAscending(ascending bool) DealRecordsOption
WithAscending specifies to sort the results in ascending order. Default is descending order. Records are sorted by timestamp.
func WithDataCids ¶
func WithDataCids(cids ...string) DealRecordsOption
WithDataCids limits the results to deals for the provided data cids. If WithFromAddrs is also provided, this is an AND operation.
func WithFromAddrs ¶
func WithFromAddrs(addrs ...string) DealRecordsOption
WithFromAddrs limits the results deals initiated from the provided wallet addresses. If WithDataCids is also provided, this is an AND operation.
func WithIncludeFailed ¶ added in v2.1.0
func WithIncludeFailed(includeFailed bool) DealRecordsOption
WithIncludeFailed specifies if failed records will be included in the output.
func WithIncludeFinal ¶
func WithIncludeFinal(includeFinal bool) DealRecordsOption
WithIncludeFinal specifies whether or not to include final deals in the results. Default is false. Ignored for ListRetrievalDealRecords.
func WithIncludePending ¶
func WithIncludePending(includePending bool) DealRecordsOption
WithIncludePending specifies whether or not to include pending deals in the results. Default is false. Ignored for ListRetrievalDealRecords.
type Deals ¶
type Deals struct {
// contains filtered or unexported fields
}
Deals provides access to Powergate deals APIs.
func (*Deals) RetrievalDealRecords ¶
func (d *Deals) RetrievalDealRecords(ctx context.Context, opts ...DealRecordsOption) (*userPb.RetrievalDealRecordsResponse, error)
RetrievalDealRecords returns a list of retrieval deals for the user according to the provided options.
func (*Deals) StorageDealRecords ¶
func (d *Deals) StorageDealRecords(ctx context.Context, opts ...DealRecordsOption) (*userPb.StorageDealRecordsResponse, error)
StorageDealRecords returns a list of storage deals for the user according to the provided options.
type ListConfig ¶
type ListConfig struct { // CidFilter filters StorageJobs list to the specified cid. Defaults to no filter. CidFilter string // Limit limits the number of StorageJobs returned. Defaults to no limit. Limit uint64 // Ascending returns the StorageJobs ascending by time. Defaults to false, descending. Ascending bool // Select specifies to return StorageJobs in the specified state. Select ListSelect // NextPageToken sets the slug from which to start building the next page of results. NextPageToken string }
ListConfig controls the behavior for listing StorageJobs.
type ListSelect ¶
type ListSelect int32
ListSelect specifies which StorageJobs to list.
const ( // All lists all StorageJobs and is the default. All ListSelect = iota // Queued lists queued StorageJobs. Queued // Executing lists executing StorageJobs. Executing // Final lists final StorageJobs. Final )
type NewAddressOption ¶
type NewAddressOption func(r *userPb.NewAddressRequest)
NewAddressOption is a function that changes a NewAddressConfig.
func WithAddressType ¶
func WithAddressType(addressType string) NewAddressOption
WithAddressType specifies the type of address to create.
func WithMakeDefault ¶
func WithMakeDefault(makeDefault bool) NewAddressOption
WithMakeDefault specifies if the new address should become the default.
type StorageConfig ¶
type StorageConfig struct {
// contains filtered or unexported fields
}
StorageConfig provides access to Powergate storage config APIs.
func (*StorageConfig) Apply ¶
func (s *StorageConfig) Apply(ctx context.Context, cid string, opts ...ApplyOption) (*userPb.ApplyStorageConfigResponse, error)
Apply push a new configuration for the Cid in hot and cold storage.
func (*StorageConfig) Default ¶
func (s *StorageConfig) Default(ctx context.Context) (*userPb.DefaultStorageConfigResponse, error)
Default returns the default storage config.
func (*StorageConfig) Remove ¶
func (s *StorageConfig) Remove(ctx context.Context, cid string) (*userPb.RemoveResponse, 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 (*StorageConfig) SetDefault ¶
func (s *StorageConfig) SetDefault(ctx context.Context, config *userPb.StorageConfig) (*userPb.SetDefaultStorageConfigResponse, error)
SetDefault sets the default storage config.
type StorageInfo ¶
type StorageInfo struct {
// contains filtered or unexported fields
}
StorageInfo provides access to Powergate storage indo APIs.
func (*StorageInfo) Get ¶
func (s *StorageInfo) Get(ctx context.Context, cid string) (*userPb.StorageInfoResponse, error)
Get returns the information about a stored Cid. If no information is available, since the Cid was never stored, it returns an error with codes.NotFound.
func (*StorageInfo) List ¶
func (s *StorageInfo) List(ctx context.Context, cids ...string) (*userPb.ListStorageInfoResponse, error)
List returns a list of information about all stored cids, filtered by cids if provided.
type StorageJobs ¶
type StorageJobs struct {
// contains filtered or unexported fields
}
StorageJobs provides access to Powergate jobs APIs.
func (*StorageJobs) Cancel ¶
func (j *StorageJobs) Cancel(ctx context.Context, jobID string) (*userPb.CancelStorageJobResponse, error)
Cancel signals that the executing Job with JobID jid should be canceled.
func (*StorageJobs) Get ¶
func (j *StorageJobs) Get(ctx context.Context, jobID string) (*userPb.StorageJobResponse, error)
Get returns the current state of the specified job.
func (*StorageJobs) List ¶
func (j *StorageJobs) List(ctx context.Context, config ListConfig) (*userPb.ListStorageJobsResponse, error)
List lists StorageJobs according to the provided ListConfig.
func (*StorageJobs) StorageConfig ¶
func (j *StorageJobs) StorageConfig(ctx context.Context, jobID string) (*userPb.StorageConfigForJobResponse, error)
StorageConfig returns the StorageConfig associated with the specified job.
func (*StorageJobs) Summary ¶
func (j *StorageJobs) Summary(ctx context.Context, opts ...SummaryOption) (*userPb.StorageJobsSummaryResponse, error)
Summary returns a summary of storage jobs.
func (*StorageJobs) Watch ¶
func (j *StorageJobs) Watch(ctx context.Context, ch chan<- WatchStorageJobsEvent, jobIDs ...string) error
Watch 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.
type SummaryOption ¶
type SummaryOption = func(*summaryConfig)
SummaryOption configures a storageJobsConfig.
func WithCid ¶
func WithCid(cid string) SummaryOption
WithCid filters the results to the specified data cid.
type TokenAuth ¶
type TokenAuth struct {
Secure bool
}
TokenAuth provides token based auth.
func (TokenAuth) GetRequestMetadata ¶
GetRequestMetadata returns request metadata that includes the auth token.
func (TokenAuth) RequireTransportSecurity ¶
RequireTransportSecurity specifies if the connection should be secure.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet provides an API for managing filecoin wallets.
func (*Wallet) Addresses ¶
Addresses returns a list of addresses managed by the user. Each addresses *could* have verified-client information. If VerifiedClientInfo is nil, then the address isn't verified.
func (*Wallet) NewAddress ¶
func (w *Wallet) NewAddress(ctx context.Context, name string, options ...NewAddressOption) (*userPb.NewAddressResponse, error)
NewAddress creates a new wallet address managed by the user.
func (*Wallet) SendFil ¶
func (w *Wallet) SendFil(ctx context.Context, from string, to string, amount *big.Int) (*userPb.SendFilResponse, error)
SendFil sends fil from a managed address to any another address, returns immediately but funds are sent asynchronously.
func (*Wallet) SignMessage ¶
func (w *Wallet) SignMessage(ctx context.Context, address string, message []byte) (*userPb.SignMessageResponse, error)
SignMessage signs a message with a user wallet address.
func (*Wallet) VerifyMessage ¶
func (w *Wallet) VerifyMessage(ctx context.Context, address string, message, signature []byte) (*userPb.VerifyMessageResponse, error)
VerifyMessage verifies a message signature from a wallet address.
type WatchLogsEvent ¶
type WatchLogsEvent struct { Res *userPb.WatchLogsResponse Err error }
WatchLogsEvent represents an event for watching cid logs.
type WatchLogsOption ¶
type WatchLogsOption func(r *userPb.WatchLogsRequest)
WatchLogsOption is a function that changes GetLogsConfig.
func WithHistory ¶
func WithHistory(enabled bool) WatchLogsOption
WithHistory indicates that prior history logs should be sent in the channel before getting real time logs.
func WithJobIDFilter ¶
func WithJobIDFilter(jobID string) WatchLogsOption
WithJobIDFilter filters only log messages of a Cid related to the Job with id jid.
type WatchStorageJobsEvent ¶
type WatchStorageJobsEvent struct { Res *userPb.WatchStorageJobsResponse Err error }
WatchStorageJobsEvent represents an event for Watching a job.