batchstore

package
v1.4.1-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-3-Clause Imports: 14 Imported by: 2

Documentation

Overview

Package batchstore implements the reserve the reserve serves to maintain chunks in the area of responsibility it has two components - the batchstore reserve which maintains information about batches, their values, priorities and synchronises with the blockchain - the localstore which stores chunks and manages garbage collection

when a new chunk arrives in the localstore, the batchstore reserve is asked to check the batch used in the postage stamp attached to the chunk. Depending on the value of the batch (reserve depth of the batch), the localstore either pins the chunk (thereby protecting it from garbage collection) or not. the chunk stays pinned until it is 'unreserved' based on changes in relative priority of the batch it belongs to

the atomic db operation is unreserving a batch down to a depth the intended semantics of unreserve is to unpin the chunks in the relevant POs, belonging to the batch and (unless they are otherwise pinned) allow them to be gargage collected.

the rules of the reserve - if batch a is unreserved and val(b) < val(a) then b is unreserved on any po - if a batch is unreserved on po p, then it is unreserved also on any p'<p - batch size based on fully filled the reserve should not exceed Capacity - batch reserve is maximally utilised, i.e, cannot be extended and have 1-3 remain true

Index

Constants

This section is empty.

Variables

View Source
var Capacity = exp2(22)

Capacity is the number of chunks in reserve. `2^22` (4194304) was chosen to remain relatively near the current 5M chunks ~25GB.

View Source
var DefaultDepth = uint8(12) // 12 is the testnet depth at the time of merging to master

DefaultDepth is the initial depth for the reserve

Functions

func New

func New(st storage.StateStorer, ev evictFn, logger logging.Logger) (postage.Storer, error)

New constructs a new postage batch store. It initialises both chain state and reserve state from the persistent state store

Types

type UnreserveItem added in v1.0.0

type UnreserveItem struct {
	BatchID []byte
	Radius  uint8
}

func (*UnreserveItem) MarshalBinary added in v1.0.0

func (u *UnreserveItem) MarshalBinary() ([]byte, error)

func (*UnreserveItem) UnmarshalBinary added in v1.0.0

func (u *UnreserveItem) UnmarshalBinary(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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