service

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLowBalance = fmt.Errorf("storage denied, available balance should be at least 0.08 TON")
View Source
var ErrLowBounty = fmt.Errorf("bounty should be at least 0.05 TON to cover fees")
View Source
var ErrNoSpace = fmt.Errorf("not enough free space to store requested bag")
View Source
var ErrNotDeployed = fmt.Errorf("contract is not deployed")
View Source
var ErrTooBigBag = fmt.Errorf("too big bag")
View Source
var ErrTooLongSpan = fmt.Errorf("too long proof time")
View Source
var ErrTooLowRate = fmt.Errorf("too low rate per mb")
View Source
var ErrTooShortSpan = fmt.Errorf("too short proof time")
View Source
var ErrUnsupportedContract = fmt.Errorf("unsupported contract")

Functions

This section is empty.

Types

type DB

type DB interface {
	SetContract(bag db.StoredBag) error
	GetContract(addr string) (db.StoredBag, error)
	ListContracts() ([]db.StoredBag, error)
}

type Service

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

func NewService

func NewService(ton ton.APIClientWrapped, storage Storage, xdb DB, key ed25519.PrivateKey, w *wallet.Wallet, minRatePerMb tlb.Coins, spaceAllocated, maxBagSize uint64, minSpan, maxSpan uint32) (*Service, error)

func (*Service) FetchStorageInfo

func (s *Service) FetchStorageInfo(ctx context.Context, contractAddr *address.Address, byteToProof uint64) (*StorageInfo, error)

func (*Service) GetStorageInfo

func (s *Service) GetStorageInfo(bagSize uint64) (available bool, minSpan, maxSpan uint32, spaceAvailable uint64, ratePerMB tlb.Coins)

func (*Service) RequestStorageADNLProof added in v0.2.0

func (s *Service) RequestStorageADNLProof(ctx context.Context, contractAddr *address.Address) (ed25519.PublicKey, []byte, error)

type Storage

type Storage interface {
	GetBag(ctx context.Context, bagId []byte) (*storage.BagDetailed, error)
	GetPieceProof(ctx context.Context, bagId []byte, piece uint64) ([]byte, error)
	StartDownload(ctx context.Context, bagId []byte, downloadAll bool) error
	RemoveBag(ctx context.Context, bagId []byte, withFiles bool) error
	ProofProvider(ctx context.Context) (ed25519.PublicKey, []byte, error)
}

type StorageInfo

type StorageInfo struct {
	Status     string
	Downloaded uint64
	Proof      []byte
}

Jump to

Keyboard shortcuts

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