Versions in this module Expand all Collapse all v0 v0.1.0 Aug 3, 2021 Changes in this version + const BucketDepth + const IndexSize + const StampSize + var ErrBucketFull = errors.New("bucket full") + var ErrBucketMismatch = errors.New("bucket mismatch") + var ErrInvalidIndex = errors.New("invalid index") + var ErrNotFound = errors.New("not found") + var ErrNotUsable = errors.New("not usable") + var ErrOwnerMismatch = errors.New("owner mismatch") + var ErrStampInvalid = errors.New("invalid stamp") + func ValidStamp(batchStore Storer) func(chunk swarm.Chunk, stampBytes []byte) (swarm.Chunk, error) + type Batch struct + BucketDepth uint8 + Depth uint8 + ID []byte + Immutable bool + Owner []byte + Radius uint8 + Start uint64 + Value *big.Int + func (b *Batch) MarshalBinary() ([]byte, error) + func (b *Batch) UnmarshalBinary(buf []byte) error + type BatchCreationListener interface + Handle func(*Batch) + type ChainState struct + Block uint64 + CurrentPrice *big.Int + TotalAmount *big.Int + type EventUpdater interface + Create func(id []byte, owner []byte, normalisedBalance *big.Int, depth, bucketDepth uint8, ...) error + Start func(startBlock uint64) (<-chan struct{}, error) + TopUp func(id []byte, normalisedBalance *big.Int, txHash []byte) error + TransactionEnd func() error + TransactionStart func() error + UpdateBlockNumber func(blockNumber uint64) error + UpdateDepth func(id []byte, depth uint8, normalisedBalance *big.Int, txHash []byte) error + UpdatePrice func(price *big.Int, txHash []byte) error + type Listener interface + Listen func(from uint64, updater EventUpdater) <-chan struct{} + type RadiusSetter interface + SetRadius func(uint8) + type ReserveState struct + Available int64 + Inner *big.Int + Outer *big.Int + Radius uint8 + StorageRadius uint8 + type Service interface + Add func(*StampIssuer) + GetStampIssuer func([]byte) (*StampIssuer, error) + IssuerUsable func(*StampIssuer) bool + StampIssuers func() []*StampIssuer + func NewService(store storage.StateStorer, postageStore Storer, chainID int64) (Service, error) + type Stamp struct + func NewStamp(batchID, index, timestamp, sig []byte) *Stamp + func (s *Stamp) BatchID() []byte + func (s *Stamp) Index() []byte + func (s *Stamp) MarshalBinary() ([]byte, error) + func (s *Stamp) Sig() []byte + func (s *Stamp) Timestamp() []byte + func (s *Stamp) UnmarshalBinary(buf []byte) error + func (s *Stamp) Valid(chunkAddr swarm.Address, ownerAddr []byte, depth, bucketDepth uint8, ...) error + type StampIssuer struct + func NewStampIssuer(label, keyID string, batchID []byte, batchAmount *big.Int, ...) *StampIssuer + func (si *StampIssuer) Amount() *big.Int + func (si *StampIssuer) BlockNumber() uint64 + func (si *StampIssuer) BucketDepth() uint8 + func (si *StampIssuer) Depth() uint8 + func (si *StampIssuer) ID() []byte + func (si *StampIssuer) ImmutableFlag() bool + func (si *StampIssuer) Label() string + func (si *StampIssuer) MarshalBinary() ([]byte, error) + func (si *StampIssuer) UnmarshalBinary(data []byte) error + func (si *StampIssuer) Utilization() uint32 + type Stamper interface + Stamp func(swarm.Address) (*Stamp, error) + func NewStamper(st *StampIssuer, signer crypto.Signer) Stamper + type Storer interface + Get func(id []byte) (*Batch, error) + GetChainState func() *ChainState + GetReserveState func() *ReserveState + Put func(*Batch, *big.Int, uint8) error + PutChainState func(*ChainState) error + Reset func() error + SetRadiusSetter func(RadiusSetter) + Unreserve func(UnreserveIteratorFn) error + type UnreserveIteratorFn func(id []byte, radius uint8) (bool, error)