View Source
const AdminKey = ctxKey("admintoken")

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

    View Source
    const AuthKey = ctxKey("ffstoken")

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


      This section is empty.


      func CreateClientConn

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

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


        type ApplyOption

        type ApplyOption func(r *userPb.ApplyStorageConfigRequest)

          ApplyOption mutates a push request.

          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
              	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.

                  func (*Client) BuildInfo

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

                    BuildInfo returns build info about the server.

                    func (*Client) Close

                    func (c *Client) Close() error

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

                      func (*Client) Host

                      func (c *Client) Host() string

                        Host returns the client host address.

                        func (*Client) UserID

                          UserID returns the user id.

                          type Data

                          type Data struct {
                          	// contains filtered or unexported fields

                            Data provides access to Powergate general data APIs.

                            func (*Data) CidInfo

                            func (d *Data) CidInfo(ctx context.Context, cids ...string) (*userPb.CidInfoResponse, error)

                              CidInfo returns information about cids stored by the user.

                              func (*Data) Get

                              func (d *Data) Get(ctx context.Context, cid string) (io.Reader, error)

                                Get returns an io.Reader for reading a stored Cid from hot storage.

                                func (*Data) GetFolder

                                func (d *Data) GetFolder(ctx context.Context, ipfsRevProxyAddr, cid, outputDir string) error

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

                                  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

                                    func (d *Data) Stage(ctx context.Context, data io.Reader) (*userPb.StageResponse, error)

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

                                                                      Apply push a new configuration for the Cid in hot and cold storage.

                                                                      func (*StorageConfig) Default

                                                                        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

                                                                            SetDefault sets the default storage config.

                                                                            type StorageJobs

                                                                            type StorageJobs struct {
                                                                            	// contains filtered or unexported fields

                                                                              StorageJobs provides access to Powergate jobs APIs.

                                                                              func (*StorageJobs) Cancel

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

                                                                                func (*StorageJobs) Executing

                                                                                  Executing returns a list of executing storage jobs.

                                                                                  func (*StorageJobs) LatestFinal

                                                                                  func (j *StorageJobs) LatestFinal(ctx context.Context, cids ...string) (*userPb.LatestFinalStorageJobsResponse, error)

                                                                                    LatestFinal returns a list of latest final storage jobs.

                                                                                    func (*StorageJobs) LatestSuccessful

                                                                                    func (j *StorageJobs) LatestSuccessful(ctx context.Context, cids ...string) (*userPb.LatestSuccessfulStorageJobsResponse, error)

                                                                                      LatestSuccessful returns a list of latest successful storage jobs.

                                                                                      func (*StorageJobs) Queued

                                                                                        Queued returns a list of queued storage jobs.

                                                                                        func (*StorageJobs) StorageConfigForJob

                                                                                        func (j *StorageJobs) StorageConfigForJob(ctx context.Context, jobID string) (*userPb.StorageConfigForJobResponse, error)

                                                                                          StorageConfigForJob returns the StorageConfig associated with the specified job.

                                                                                          func (*StorageJobs) StorageJob

                                                                                          func (j *StorageJobs) StorageJob(ctx context.Context, jobID string) (*userPb.StorageJobResponse, error)

                                                                                            StorageJob returns the current state of the specified job.

                                                                                            func (*StorageJobs) Summary

                                                                                              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 TokenAuth

                                                                                                type TokenAuth struct {
                                                                                                	Secure bool

                                                                                                  TokenAuth provides token based auth.

                                                                                                  func (TokenAuth) GetRequestMetadata

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

                                                                                                    GetRequestMetadata returns request metadata that includes the auth token.

                                                                                                    func (TokenAuth) RequireTransportSecurity

                                                                                                    func (t TokenAuth) RequireTransportSecurity() bool

                                                                                                      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

                                                                                                        func (w *Wallet) Addresses(ctx context.Context) (*userPb.AddressesResponse, error)

                                                                                                          Addresses returns a list of addresses managed by the user.

                                                                                                          func (*Wallet) Balance

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

                                                                                                            Balance gets a filecoin wallet's balance.

                                                                                                            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.


                                                                                                                              Path Synopsis