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 ¶
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.
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 ¶
Types ¶
type UnreserveItem ¶ added in v1.0.0
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