singularity

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options) error

Option represents a configurable parameter in Motion service.

func WithCleanupInterval added in v0.2.1

func WithCleanupInterval(v time.Duration) Option

WithCleanupInterval sets how often to check for and remove data that has been successfully stored on Filecoin. Deafults to time.Hour

func WithDealDuration

func WithDealDuration(v abi.ChainEpoch) Option

WithDealDuration sets duration of Filecoin deals made. Defaults to one year if unspecified.

func WithDealStartDelay

func WithDealStartDelay(v abi.ChainEpoch) Option

WithDealStartDelay sets the delay for deal start epoch. Defaults to 72 hours if unspecified.

func WithForcePackAfter added in v0.2.2

func WithForcePackAfter(d time.Duration) Option

WithForcePackAfter sets the maximum amount of time to wait without any data being received before forcing packing. Defaults to 24 hours.

func WithIPNIAnnounce

func WithIPNIAnnounce(v bool) Option

WithIPNIAnnounce set whether the deal payload should be announced to IPNI. Defaults to true.

func WithKeepUnsealed

func WithKeepUnsealed(v bool) Option

WithKeepUnsealed set whether the deal the deal should be kept unsealed. Defaults to false.

func WithMaxCarSize

func WithMaxCarSize(s string) Option

WithMaxCarSize sets singularity max car size config as string. Defaults to "31.5GiB"

func WithMaxPendingDealNumber

func WithMaxPendingDealNumber(v int) Option

WithMaxPendingDealNumber sets the max pending deal number. Defaults to 1.

func WithMaxPendingDealSize

func WithMaxPendingDealSize(v string) Option

WithMaxPendingDealSize sets the max pending deal size. Defaults to "0".

func WithMinFreeSpace added in v0.2.3

func WithMinFreeSpace(space int64) Option

WithMinFreeSpce configures the minimul free disk space that must remain after storing a blob. A value of zero uses the default value and -1 disabled checks.

func WithPackThreshold

func WithPackThreshold(s int64) Option

WithPackThreshold sets the threshold at which unpacked bytes are scheduled for packing. Defaults to 16 GiB.

func WithPreparationName added in v0.2.1

func WithPreparationName(n string) Option

WithPreparationName sets the singularity preparation name used to store data. Defaults to "MOTION_PREPARATION".

func WithPricePerDeal

func WithPricePerDeal(v abi.TokenAmount) Option

WithPricePerDeal sets the per deal.

func WithPricePerGiB

func WithPricePerGiB(v abi.TokenAmount) Option

WithPricePerGiB sets the per epoch per GiB.

func WithPricePerGiBEpoch

func WithPricePerGiBEpoch(v abi.TokenAmount) Option

WithPricePerGiBEpoch sets the price per epoch per GiB.

func WithReplicationFactor

func WithReplicationFactor(r uint) Option

WithReplicationFactor sets the replication factor for the blobs. Defaults to the number of storage providers specified. If no storage providers are specified the replication factor will be zero, i.e. data will only be stored locally.

See WithStorageProviders.

func WithScheduleCron

func WithScheduleCron(c string) Option

WithScheduleCron sets the Singularity schedule cron. Defaults to disabled.

func WithScheduleCronPerpetual

func WithScheduleCronPerpetual(v bool) Option

WithScheduleCronPerpetual sets whether a cron schedule should run in definitely. Defaults to true.

func WithScheduleDealNumber

func WithScheduleDealNumber(n int) Option

WithScheduleDealNumber sets the max number of deals per singularity scheduled time. Defaults to unlimited.

func WithScheduleDealSize

func WithScheduleDealSize(v string) Option

WithScheduleDealSize sets the size of deals per schedule trigger. Defaults to "0".

func WithScheduleUrlTemplate

func WithScheduleUrlTemplate(t string) Option

WithScheduleUrlTemplate sets the Singularity schedule URL template for online deals. Defaults to offline deals.

func WithSingularityClient

func WithSingularityClient(c *singularityclient.SingularityAPI) Option

WithSingularityClient sets the client used to communicate with Singularity API. Defaults to HTTP client with API endpoint http://localhost:9090.

func WithStorageProviders

func WithStorageProviders(sp ...address.Address) Option

WithStorageProviders sets the list of Filecoin storage providers to make deals with. Defaults to no deals, i.e. local storage only if unspecified.

func WithStoreDir

func WithStoreDir(s string) Option

WithStoreDir sets local directory used by the singularity store. Defaults to OS temporary directory. See: os.TempDir.

func WithTotalDealNumber

func WithTotalDealNumber(v int) Option

WithTotalDealNumber sets the total number of deals. Defaults to 0, i.e. unlimited.

func WithTotalDealSize

func WithTotalDealSize(v string) Option

WithTotalDealSize sets the total schedule deal size. Defaults to "0".

func WithVerifiedDeal

func WithVerifiedDeal(v bool) Option

WithVerifiedDeal set whether the deals should be verified. Defaults to true.

func WithWalletKey

func WithWalletKey(wk string) Option

WithWalletKey sets the wallet used by Motion to interact with Filecoin network.

type Reader added in v0.2.2

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

io.ReadSeekCloser implementation that reads from remote singularity

func NewReader added in v0.2.2

func NewReader(client *singularityclient.SingularityAPI, fileID uint64, size int64) *Reader

func (*Reader) Close added in v0.2.2

func (r *Reader) Close() error

func (*Reader) Read added in v0.2.2

func (r *Reader) Read(p []byte) (int, error)

func (*Reader) Seek added in v0.2.2

func (r *Reader) Seek(offset int64, whence int) (int64, error)

func (*Reader) WriteTo added in v0.2.2

func (r *Reader) WriteTo(w io.Writer) (int64, error)

WriteTo is implemented in order to directly handle io.Copy operations rather than allow small, separate Read operations.

func (*Reader) WriteToN added in v0.2.2

func (r *Reader) WriteToN(w io.Writer, readLen int64) (int64, error)

type Store added in v0.2.2

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

func NewStore

func NewStore(o ...Option) (*Store, error)

func (*Store) Describe added in v0.2.2

func (s *Store) Describe(ctx context.Context, id blob.ID) (*blob.Descriptor, error)

func (*Store) Get added in v0.2.2

func (s *Store) Get(ctx context.Context, id blob.ID) (io.ReadSeekCloser, error)

func (*Store) PassGet added in v0.2.2

func (s *Store) PassGet(w http.ResponseWriter, r *http.Request, id blob.ID)

func (*Store) Put added in v0.2.2

func (s *Store) Put(ctx context.Context, reader io.Reader) (*blob.Descriptor, error)

func (*Store) Shutdown added in v0.2.2

func (s *Store) Shutdown(ctx context.Context) error

func (*Store) Start added in v0.2.2

func (s *Store) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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