ributil

package
v0.0.0-...-9f67d33 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0, MIT Imports: 54 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KNamePrefix  = "wallet-"
	KTrashPrefix = "trash-"
	KDefault     = "default"
)
View Source
const CommPBuf = abi.UnpaddedPieceSize(commPBufPad - (commPBufPad / 128)) // can't use .Unpadded() for const

Variables

View Source
var TotalTransferDivFactor int64 = 4

Functions

func MaddrsToUrl

func MaddrsToUrl(addrs []multiaddr.Multiaddr) (*url.URL, error)

func MemoryWatchdog

func MemoryWatchdog() (cleanup func())

func RobustGet

func RobustGet(url string, dataSize int64, rcf func() *RateCounter) io.ReadCloser

Types

type CachedQuery

type CachedQuery[T any] struct {
	// contains filtered or unexported fields
}

func NewCachedQuery

func NewCachedQuery[T any](refreshInterval time.Duration, refreshFunc func() (T, error)) *CachedQuery[T]

func (*CachedQuery[T]) Get

func (cq *CachedQuery[T]) Get() (T, error)

type CurrentDealInfo

type CurrentDealInfo struct {
	DealID           abi.DealID
	MarketDeal       *api.MarketDeal
	PublishMsgTipSet types.TipSetKey
}

type CurrentDealInfoAPI

type CurrentDealInfoAPI interface {
	ChainGetMessage(context.Context, cid.Cid) (*types.Message, error)
	StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
	StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
	StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
	StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)

	ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
	ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
	StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
}

type CurrentDealInfoManager

type CurrentDealInfoManager struct {
	CDAPI CurrentDealInfoAPI
}

func (*CurrentDealInfoManager) CheckDealEquality

func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tsk types.TipSetKey, p1, p2 market.DealProposal) (bool, error)

func (*CurrentDealInfoManager) FindCloseMsgTipset

func (mgr *CurrentDealInfoManager) FindCloseMsgTipset(ctx context.Context, tsk types.TipSetKey, publishCid cid.Cid, step abi.ChainEpoch) (types.TipSetKey, error)

func (*CurrentDealInfoManager) GetCurrentDealInfo

func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error)

GetCurrentDealInfo gets the current deal state and deal ID. Note that the deal ID is assigned when the deal is published, so it may have changed if there was a reorg after the deal was published.

type DataCIDSize

type DataCIDSize struct {
	PayloadSize int64
	PieceSize   abi.PaddedPieceSize
	PieceCID    cid.Cid
}

type DataCidWriter

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

func (*DataCidWriter) Sum

func (w *DataCidWriter) Sum() (DataCIDSize, error)

func (*DataCidWriter) Write

func (w *DataCidWriter) Write(p []byte) (int, error)

type DiskKeyStore

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

func OpenOrInitKeystore

func OpenOrInitKeystore(p string) (*DiskKeyStore, error)

func (*DiskKeyStore) Delete

func (fsr *DiskKeyStore) Delete(name string) error

func (*DiskKeyStore) Get

func (fsr *DiskKeyStore) Get(name string) (types.KeyInfo, error)

Get gets a key out of keystore and returns types.KeyInfo coresponding to named key

func (*DiskKeyStore) List

func (fsr *DiskKeyStore) List() ([]string, error)

List lists all the keys stored in the KeyStore

func (*DiskKeyStore) Put

func (fsr *DiskKeyStore) Put(name string, info types.KeyInfo) error

Put saves key info under given name

type IpldStoreWrapper

type IpldStoreWrapper struct {
	BS blockstore.Blockstore
}

func (*IpldStoreWrapper) BlockWriteOpener

func (b *IpldStoreWrapper) BlockWriteOpener() linking.BlockWriteOpener

BlockWriteOpener returns a BlockWriteOpener that operates on this storage.

func (*IpldStoreWrapper) Get

func (b *IpldStoreWrapper) Get(ctx context.Context, key string) ([]byte, error)

func (*IpldStoreWrapper) Has

func (b *IpldStoreWrapper) Has(ctx context.Context, key string) (bool, error)

func (*IpldStoreWrapper) Put

func (b *IpldStoreWrapper) Put(ctx context.Context, key string, content []byte) error

type LocalWallet

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

func NewWallet

func NewWallet(keystore types.KeyStore) (*LocalWallet, error)

func OpenWallet

func OpenWallet(path string) (*LocalWallet, error)

func (*LocalWallet) GetDefault

func (w *LocalWallet) GetDefault() (address.Address, error)

func (*LocalWallet) SetDefault

func (w *LocalWallet) SetDefault(a address.Address) error

func (*LocalWallet) WalletList

func (w *LocalWallet) WalletList(ctx context.Context) ([]address.Address, error)

func (*LocalWallet) WalletNew

func (w *LocalWallet) WalletNew(ctx context.Context, typ types.KeyType) (address.Address, error)

func (*LocalWallet) WalletSign

func (w *LocalWallet) WalletSign(ctx context.Context, addr address.Address, msg []byte, meta api.MsgMeta) (*crypto.Signature, error)

type RateCounter

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

func (*RateCounter) Check

func (rc *RateCounter) Check(cb func() error) error

Check allows only single concurrent check per peer - this is to prevent multiple concurrent checks causing all transfers to fail at once. When we drop a peer, we'll reduce rc.transfers, so the next check will require less total bandwidth (assuming that MinAvgGlobalLogPeerRate is used).

func (*RateCounter) Release

func (rc *RateCounter) Release()

type RateCounters

type RateCounters[K comparable] struct {
	// contains filtered or unexported fields
}

func NewRateCounters

func NewRateCounters[K comparable](rateFunc RateFunc) *RateCounters[K]

func (*RateCounters[K]) Get

func (rc *RateCounters[K]) Get(key K) *RateCounter

type RateEnforcingReader

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

func NewRateEnforcingReader

func NewRateEnforcingReader(r io.Reader, rc *RateCounter, windowDuration time.Duration) *RateEnforcingReader

func (*RateEnforcingReader) Done

func (rer *RateEnforcingReader) Done()

func (*RateEnforcingReader) Read

func (rer *RateEnforcingReader) Read(p []byte) (int, error)

func (*RateEnforcingReader) ReadError

func (rer *RateEnforcingReader) ReadError() error

type RateEnforcingWriter

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

func NewRateEnforcingWriter

func NewRateEnforcingWriter(w io.Writer, rc *RateCounter, windowDuration time.Duration) *RateEnforcingWriter

func (*RateEnforcingWriter) Done

func (rew *RateEnforcingWriter) Done()

func (*RateEnforcingWriter) Write

func (rew *RateEnforcingWriter) Write(p []byte) (int, error)

func (*RateEnforcingWriter) WriteError

func (rew *RateEnforcingWriter) WriteError() error

type RateFunc

type RateFunc func(transferRateMbps float64, peerTransfers, totalTransfers int64) error

func MinAvgGlobalLogPeerRate

func MinAvgGlobalLogPeerRate(minTxRateMbps, linkMbps float64) RateFunc

type RepairCarLog

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

func NewCarRepairReader

func NewCarRepairReader(source io.Reader, root cid.Cid, repair func(cid.Cid, []byte) ([]byte, error)) (*RepairCarLog, error)

func (*RepairCarLog) Read

func (r *RepairCarLog) Read(p []byte) (n int, err error)

type RetryDB

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

RetryDB retries 'database is locked' errors

func NewRetryDB

func NewRetryDB(db *sql.DB) *RetryDB

func (*RetryDB) Begin

func (d *RetryDB) Begin() (*sql.Tx, error)

Begin

func (*RetryDB) Exec

func (d *RetryDB) Exec(query string, args ...interface{}) (sql.Result, error)

Exec

func (*RetryDB) ExecContext

func (d *RetryDB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

ExecContext

func (*RetryDB) Query

func (d *RetryDB) Query(query string, args ...interface{}) (*sql.Rows, error)

Query

func (*RetryDB) QueryContext

func (d *RetryDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

QueryContext

func (*RetryDB) QueryRow

func (d *RetryDB) QueryRow(query string, args ...interface{}) *sql.Row

QueryRow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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