storageimpl

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0, MIT Imports: 33 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDealAcceptanceBuffer = abi.ChainEpoch(100)

Functions

func NewProvider

func NewProvider(net network.StorageMarketNetwork, ds datastore.Batching, bs blockstore.Blockstore, fs filestore.FileStore, pieceStore piecestore.PieceStore, dataTransfer datatransfer.Manager, spn storagemarket.StorageProviderNode, minerAddress address.Address, rt abi.RegisteredProof, storedAsk StoredAsk, options ...StorageProviderOption) (storagemarket.StorageProvider, error)

NewProvider returns a new storage provider

Types

type Client

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

func NewClient

func NewClient(
	net network.StorageMarketNetwork,
	bs blockstore.Blockstore,
	dataTransfer datatransfer.Manager,
	discovery *discovery.Local,
	ds datastore.Batching,
	scn storagemarket.StorageClientNode,
) (*Client, error)

func (*Client) AddPaymentEscrow

func (c *Client) AddPaymentEscrow(ctx context.Context, addr address.Address, amount abi.TokenAmount) error

func (*Client) GetLocalDeal

func (c *Client) GetLocalDeal(ctx context.Context, cid cid.Cid) (storagemarket.ClientDeal, error)

func (*Client) GetPaymentEscrow

func (c *Client) GetPaymentEscrow(ctx context.Context, addr address.Address) (storagemarket.Balance, error)

func (*Client) ListDeals

func (c *Client) ListDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error)

func (*Client) ListLocalDeals

func (c *Client) ListLocalDeals(ctx context.Context) ([]storagemarket.ClientDeal, error)

func (*Client) ListProviders

func (c *Client) ListProviders(ctx context.Context) (<-chan storagemarket.StorageProviderInfo, error)

func (*Client) ProposeStorageDeal

func (c *Client) ProposeStorageDeal(
	ctx context.Context,
	addr address.Address,
	info *storagemarket.StorageProviderInfo,
	data *storagemarket.DataRef,
	startEpoch abi.ChainEpoch,
	endEpoch abi.ChainEpoch,
	price abi.TokenAmount,
	collateral abi.TokenAmount,
	rt abi.RegisteredProof,
) (*storagemarket.ProposeStorageDealResult, error)

func (*Client) Run

func (c *Client) Run(ctx context.Context)

func (*Client) Stop

func (c *Client) Stop()

func (*Client) SubscribeToEvents added in v0.2.0

func (c *Client) SubscribeToEvents(subscriber storagemarket.ClientSubscriber) shared.Unsubscribe

type DealDeciderFunc added in v0.2.7

type DealDeciderFunc func(context.Context, storagemarket.MinerDeal) (bool, string, error)

DealDeciderFunc is a function which evaluates an incoming deal to decide if it its accepted It returns: - boolean = true if deal accepted, false if rejected - string = reason deal was not excepted, if rejected - error = if an error occurred trying to decide

type Provider

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

Provider is a storage provider implementation

func (*Provider) AddAsk

func (p *Provider) AddAsk(price abi.TokenAmount, duration abi.ChainEpoch, options ...storagemarket.StorageAskOption) error

func (*Provider) AddStorageCollateral

func (p *Provider) AddStorageCollateral(ctx context.Context, amount abi.TokenAmount) error

func (*Provider) Configure

func (p *Provider) Configure(options ...StorageProviderOption)

func (*Provider) DealAcceptanceBuffer

func (p *Provider) DealAcceptanceBuffer() abi.ChainEpoch

func (*Provider) GetStorageCollateral

func (p *Provider) GetStorageCollateral(ctx context.Context) (storagemarket.Balance, error)

func (*Provider) HandleAskStream

func (p *Provider) HandleAskStream(s network.StorageAskStream)

func (*Provider) HandleDealStream

func (p *Provider) HandleDealStream(s network.StorageDealStream)

func (*Provider) ImportDataForDeal

func (p *Provider) ImportDataForDeal(ctx context.Context, propCid cid.Cid, data io.Reader) error

func (*Provider) ListAsks

func (p *Provider) ListAsks(addr address.Address) []*storagemarket.SignedStorageAsk

func (*Provider) ListDeals

func (p *Provider) ListDeals(ctx context.Context) ([]storagemarket.StorageDeal, error)

func (*Provider) ListLocalDeals

func (p *Provider) ListLocalDeals() ([]storagemarket.MinerDeal, error)

func (*Provider) Start

func (p *Provider) Start(ctx context.Context) error

func (*Provider) Stop

func (p *Provider) Stop() error

func (*Provider) SubscribeToEvents

func (p *Provider) SubscribeToEvents(subscriber storagemarket.ProviderSubscriber) shared.Unsubscribe

func (*Provider) UniversalRetrievalEnabled

func (p *Provider) UniversalRetrievalEnabled() bool

type StorageProviderOption

type StorageProviderOption func(p *Provider)

StorageProviderOption allows custom configuration of a storage provider

func CustomDealDecisionLogic added in v0.2.7

func CustomDealDecisionLogic(decider DealDeciderFunc) StorageProviderOption

CustomDealDecisionLogic allows a provider to call custom decision logic when validating incoming deal proposals

func DealAcceptanceBuffer

func DealAcceptanceBuffer(buffer abi.ChainEpoch) StorageProviderOption

DealAcceptanceBuffer allows a provider to set a buffer (in epochs) to account for the time required for data transfer, deal verification, publishing, sealing, and committing.

func EnableUniversalRetrieval

func EnableUniversalRetrieval() StorageProviderOption

EnableUniversalRetrieval causes a storage provider to track all CIDs in a piece, so that any CID, not just the root, can be retrieved

type StoredAsk added in v0.2.7

type StoredAsk interface {
	GetAsk(address.Address) *storagemarket.SignedStorageAsk
	AddAsk(price abi.TokenAmount, duration abi.ChainEpoch, options ...storagemarket.StorageAskOption) error
}

Jump to

Keyboard shortcuts

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