Versions in this module Expand all Collapse all v0 v0.4.0 Mar 25, 2024 Changes in this version + type Index map[T][]types.UnitID + func CreateIndex[T comparable](s *State, ke KeyExtractor[T]) (Index[T], error) + type KeyExtractor func(unit *Unit) (T, error) type State + func (s *State) CreateIndex(ke KeyExtractor[string]) (Index[string], error) type Unit + func (u *Unit) LastLogIndex() int v0.3.0 Feb 28, 2024 Changes in this version + const CBORChecksumLength + func MarshalUnitData(u UnitData) ([]byte, error) + func NewStateNodeCounter() *stateNodeCounter + type Action func(s ShardState, hashAlgorithm crypto.Hash) error + func AddUnit(id types.UnitID, bearer predicates.PredicateBytes, data UnitData) Action + func DeleteUnit(id types.UnitID) Action + func SetOwner(id types.UnitID, bearer predicates.PredicateBytes) Action + func UpdateUnitData(id types.UnitID, f UpdateFunction) Action + type CRC32Reader struct + func NewCRC32Reader(reader io.Reader, checksumLength int) *CRC32Reader + func (c *CRC32Reader) Read(p []byte) (n int, err error) + func (c *CRC32Reader) Sum() uint32 + type CRC32Writer struct + func NewCRC32Writer(writer io.Writer) *CRC32Writer + func (c *CRC32Writer) Sum() uint32 + func (c *CRC32Writer) Write(p []byte) (n int, err error) + type Header struct + NodeRecordCount uint64 + SystemIdentifier types.SystemID + UnicityCertificate *types.UnicityCertificate + type Log struct + NewBearer predicates.PredicateBytes + NewUnitData UnitData + TxRecordHash []byte + UnitLedgerHeadHash []byte + func (l *Log) Clone() *Log + func (l *Log) Hash(algorithm crypto.Hash) []byte + type Option func(o *Options) + func WithHashAlgorithm(hashAlgorithm crypto.Hash) Option + type Options struct + type ShardState interface + Add func(id types.UnitID, u *Unit) error + Delete func(id types.UnitID) error + Get func(id types.UnitID) (*Unit, error) + Update func(id types.UnitID, unit *Unit) error + type State struct + func NewEmptyState(opts ...Option) *State + func NewRecoveredState(stateData io.Reader, udc UnitDataConstructor, opts ...Option) (*State, error) + func (s *State) AddUnitLog(id types.UnitID, transactionRecordHash []byte) error + func (s *State) Apply(actions ...Action) error + func (s *State) CalculateRoot() (uint64, []byte, error) + func (s *State) Clone() *State + func (s *State) Commit(uc *types.UnicityCertificate) error + func (s *State) CommittedUC() *types.UnicityCertificate + func (s *State) CreateUnitStateProof(id types.UnitID, logIndex int) (*types.UnitStateProof, error) + func (s *State) GetUnit(id types.UnitID, committed bool) (*Unit, error) + func (s *State) HashAlgorithm() crypto.Hash + func (s *State) IsCommitted() bool + func (s *State) Prune() error + func (s *State) ReleaseToSavepoint(id int) + func (s *State) Revert() + func (s *State) RollbackToSavepoint(id int) + func (s *State) Savepoint() int + func (s *State) Serialize(writer io.Writer, header *Header, committed bool) error + func (s *State) Traverse(traverser avl.Traverser[types.UnitID, *Unit]) + type Unit struct + func NewUnit(bearer predicates.PredicateBytes, data UnitData) *Unit + func (u *Unit) Bearer() predicates.PredicateBytes + func (u *Unit) Clone() *Unit + func (u *Unit) Data() UnitData + func (u *Unit) Logs() []*Log + func (u *Unit) String() string + type UnitData interface + Copy func() UnitData + SummaryValueInput func() uint64 + Write func(hasher hash.Hash) error + type UnitDataConstructor func(types.UnitID) (UnitData, error) + type UpdateFunction func(data UnitData) (newData UnitData, err error)