rbdeal

package
v0.0.0-...-31e7708 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0, MIT Imports: 84 Imported by: 1

Documentation

Index

Constants

View Source
const AskProtocolID = "/fil/storage/ask/1.1.0"
View Source
const AvgBlockSize = 256 << 10
View Source
const BlockCacheSize = BlockCacheSizeMiB << 20 / AvgBlockSize
View Source
const BlockCacheSizeMiB = 512
View Source
const DEBUG_LOOP_COUNT = 10000
View Source
const DealProtocolv121 = "/fil/storage/mk/1.2.1"
View Source
const DealStatusV12ProtocolID = "/fil/storage/status/1.2.0"
View Source
const EXTERNAL_LOCALWEB = "local-web"
View Source
const EXTERNAL_S3 = "s3"
View Source
const RetrievalCandidateCacheSize = 10000
View Source
const RetrievalCandidateTimeout = 5 * time.Minute

Variables

View Source
var ParallelDealChecks = 10
View Source
var RepairCheckInterval = time.Minute

Functions

func CalculateChunkSize

func CalculateChunkSize(fileSize int64) int

func DerefOr

func DerefOr[T any](v *T, def T) T

func GetAddrInfo

func GetAddrInfo(ctx context.Context, api api.Gateway, maddr address.Address) (*peer.AddrInfo, error)

func IsPublicOrDNSAddr

func IsPublicOrDNSAddr(a multiaddr.Multiaddr) bool

func Open

func Open(root string, opts ...OpenOption) (iface.RIBS, error)

func OpenOrCreateWallet

func OpenOrCreateWallet(path string) (*ributil.LocalWallet, address.Address, error)

Types

type CarSource

type CarSource func(context.Context, iface.GroupKey, func(int64), io.Writer) error

type ErrRejected

type ErrRejected struct {
	Reason string
}

func (ErrRejected) Error

func (e ErrRejected) Error() string

type ExternalOffloader

type ExternalOffloader interface {
	GetModuleName() string
	EnsureExternalPush(gid iface.GroupKey, src CarSource) error
	GetGroupExternalURL(gid iface.GroupKey, lpath string) (*string, error)
	CleanExternal(gid iface.GroupKey, lpath string) error
	ReadCar(ctx context.Context, group iface.GroupKey, path string, off int64, size int64) (io.ReadCloser, error)
	ReadCarFile(ctx context.Context, group iface.GroupKey) (io.ReadSeekCloser, error)
	// contains filtered or unexported methods
}

type GroupDealStats

type GroupDealStats struct {
	GroupID        int64
	State          iface.GroupState
	TotalDeals     int64
	PublishedDeals int64
	SealedDeals    int64
	FailedDeals    int64
	RejectedDeals  int64
	Retrievable    int64
	Unretrievable  int64
}

type LimitWriter

type LimitWriter struct {
	W       io.Writer
	N       int64
	Err     error
	Reached bool // flag to indicate whether the limit has been reached
}

func (*LimitWriter) Write

func (lw *LimitWriter) Write(p []byte) (n int, err error)

type LocalWebInfo

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

func (*LocalWebInfo) CleanExternal

func (lwi *LocalWebInfo) CleanExternal(gid iface.GroupKey, lpath string) error

func (*LocalWebInfo) EnsureExternalPush

func (lwi *LocalWebInfo) EnsureExternalPush(gid iface.GroupKey, src CarSource) error

func (*LocalWebInfo) GetGroupExternalURL

func (lwi *LocalWebInfo) GetGroupExternalURL(gid iface.GroupKey, lpath string) (*string, error)

func (*LocalWebInfo) GetModuleName

func (lwi *LocalWebInfo) GetModuleName() string

func (*LocalWebInfo) ReadCar

func (lwi *LocalWebInfo) ReadCar(ctx context.Context, group iface.GroupKey, pathStr string, off int64, size int64) (io.ReadCloser, error)

func (*LocalWebInfo) ReadCarFile

func (lwi *LocalWebInfo) ReadCarFile(ctx context.Context, group iface.GroupKey) (io.ReadSeekCloser, error)

type OpenOption

type OpenOption func(*openOptions)

func WithFileCoinApiEndpoint

func WithFileCoinApiEndpoint(wp string) OpenOption

WithFileCoinApiEndpoint sets the FileCoin API endpoint used to probe the chain. Defaults to "https://api.chain.love/rpc/v1".

func WithHostGetter

func WithHostGetter(hg func(...libp2p.Option) (host.Host, error)) OpenOption

WithHostGetter sets the function used to instantiate the libp2p host used by RIBS. Defaults to libp2p.New.

func WithLocalWalletOpener

func WithLocalWalletOpener(wg func(path string) (*ributil.LocalWallet, error)) OpenOption

WithLocalWalletOpener sets the function used to open the local wallet path. Defaults to using ributil.OpenWallet, where the wallet is instantiated if it does not exist. In a case where it is auto generated, the wallet path must be backed up elsewhere.

See: WithLocalWalletPath.

func WithLocalWalletPath

func WithLocalWalletPath(wp string) OpenOption

WithLocalWalletPath sets the path to the local directory containing the wallet. Care must be taken in backing up this directory. Defaults to `.ribswallet` under user home directory.

type ProviderAddrInfo

type ProviderAddrInfo struct {
	LibP2PMaddrs  []multiaddr.Multiaddr
	BitswapMaddrs []multiaddr.Multiaddr
	HttpMaddrs    []multiaddr.Multiaddr
}

type RetrCandidate

type RetrCandidate struct {
	DealID                    string
	Provider                  int64
	Verified                  bool
	FastRetr                  bool
	LastRetrievalCheckSuccess int64
}

type RetrCheckCandidate

type RetrCheckCandidate struct {
	DealID   string
	Provider int64
	Group    int64
	Verified bool
	FastRetr bool
}

type RetrievalResult

type RetrievalResult struct {
	Success bool
	Error   string

	Duration        time.Duration
	TimeToFirstByte time.Duration
}

type S3OffloadInfo

type S3OffloadInfo struct {
	Endpoint  string
	AccessKey string
	SecretKey string
	Token     string
	Bucket    string
	// contains filtered or unexported fields
}

func (*S3OffloadInfo) CleanExternal

func (s *S3OffloadInfo) CleanExternal(gid iface.GroupKey, lpath string) error

func (*S3OffloadInfo) EnsureExternalPush

func (s *S3OffloadInfo) EnsureExternalPush(gid iface.GroupKey, src CarSource) error

func (*S3OffloadInfo) GetGroupExternalURL

func (s *S3OffloadInfo) GetGroupExternalURL(gid iface.GroupKey, lpath string) (*string, error)

func (*S3OffloadInfo) GetModuleName

func (s *S3OffloadInfo) GetModuleName() string

func (*S3OffloadInfo) ReadCar

func (s *S3OffloadInfo) ReadCar(ctx context.Context, group iface.GroupKey, path string, off int64, size int64) (io.ReadCloser, error)

func (*S3OffloadInfo) ReadCarFile

func (s *S3OffloadInfo) ReadCarFile(ctx context.Context, group iface.GroupKey) (io.ReadSeekCloser, error)

Jump to

Keyboard shortcuts

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