isaacdatabase

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 25 Imported by: 17

Documentation

Overview

Package isaacdatabase handles data for isaac

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanSyncPool

func CleanSyncPool(st *leveldbstorage.Storage) error

func HeightFromPrefixStoragePrefix

func HeightFromPrefixStoragePrefix(b []byte) (base.Height, error)

func NewHashRecordMeta

func NewHashRecordMeta(h util.Hash) util.Byter

func NewPoolOperationRecordMeta

func NewPoolOperationRecordMeta(op base.Operation) util.Byter

func ReadHashRecordMeta

func ReadHashRecordMeta(b []byte) (util.Hash, error)

Types

type Center

type Center struct {
	*logging.Logging
	*util.ContextDaemon

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCenter

func NewCenter(
	st *leveldbstorage.Storage,
	encs *encoder.Encoders,
	enc encoder.Encoder,
	perm isaac.PermanentDatabase,
	newBlockWriteDatabase func(base.Height) (isaac.BlockWriteDatabase, error),
) (*Center, error)

func (*Center) BlockMap

func (db *Center) BlockMap(height base.Height) (base.BlockMap, bool, error)

func (*Center) BlockMapBytes

func (db *Center) BlockMapBytes(height base.Height) (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*Center) Close

func (*Center) Close() error

func (*Center) ExistsInStateOperation

func (db *Center) ExistsInStateOperation(h util.Hash) (bool, error)

func (*Center) ExistsKnownOperation

func (db *Center) ExistsKnownOperation(h util.Hash) (bool, error)

func (*Center) LastBlockMap

func (db *Center) LastBlockMap() (base.BlockMap, bool, error)

func (*Center) LastBlockMapBytes

func (db *Center) LastBlockMapBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*Center) LastNetworkPolicy

func (db *Center) LastNetworkPolicy() base.NetworkPolicy

func (*Center) LastSuffrageProof

func (db *Center) LastSuffrageProof() (base.SuffrageProof, bool, error)

func (*Center) LastSuffrageProofBytes

func (db *Center) LastSuffrageProofBytes() (
	enchint hint.Hint, meta, body []byte, found bool, lastheight base.Height, _ error,
)

func (*Center) MergeAllPermanent

func (db *Center) MergeAllPermanent() error

func (*Center) MergeBlockWriteDatabase

func (db *Center) MergeBlockWriteDatabase(w isaac.BlockWriteDatabase) error

func (*Center) NewBlockWriteDatabase

func (db *Center) NewBlockWriteDatabase(height base.Height) (isaac.BlockWriteDatabase, error)

func (*Center) RemoveBlocks

func (db *Center) RemoveBlocks(height base.Height) (bool, error)

RemoveBlocks removes temp databases over height including height.

func (*Center) SetLogging

func (db *Center) SetLogging(l *logging.Logging) *logging.Logging

func (*Center) State

func (db *Center) State(key string) (base.State, bool, error)

func (*Center) StateBytes

func (db *Center) StateBytes(key string) (ht hint.Hint, _, _ []byte, _ bool, _ error)

func (*Center) SuffrageProof

func (db *Center) SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error)

func (*Center) SuffrageProofByBlockHeight

func (db *Center) SuffrageProofByBlockHeight(height base.Height) (base.SuffrageProof, bool, error)

func (*Center) SuffrageProofBytes

func (db *Center) SuffrageProofBytes(suffrageHeight base.Height) (
	enchint hint.Hint, meta, body []byte, found bool, err error,
)

type LeveldbBlockWrite

type LeveldbBlockWrite struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLeveldbBlockWrite

func NewLeveldbBlockWrite(
	height base.Height,
	st *leveldbstorage.Storage,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) *LeveldbBlockWrite

func (*LeveldbBlockWrite) BlockMap

func (db *LeveldbBlockWrite) BlockMap() (base.BlockMap, error)

func (*LeveldbBlockWrite) BlockMapBytes

func (db *LeveldbBlockWrite) BlockMapBytes() (enchint hint.Hint, meta, body []byte, err error)

func (*LeveldbBlockWrite) Cancel

func (db *LeveldbBlockWrite) Cancel() error

func (*LeveldbBlockWrite) Close

func (db *LeveldbBlockWrite) Close() error

func (*LeveldbBlockWrite) NetworkPolicy

func (db *LeveldbBlockWrite) NetworkPolicy() base.NetworkPolicy

func (LeveldbBlockWrite) Prefix

func (db LeveldbBlockWrite) Prefix() []byte

func (LeveldbBlockWrite) Remove

func (db LeveldbBlockWrite) Remove() error

func (*LeveldbBlockWrite) SetBlockMap

func (db *LeveldbBlockWrite) SetBlockMap(m base.BlockMap) error

func (*LeveldbBlockWrite) SetOperations

func (db *LeveldbBlockWrite) SetOperations(ops []util.Hash) error

func (*LeveldbBlockWrite) SetStates

func (db *LeveldbBlockWrite) SetStates(sts []base.State) error

func (*LeveldbBlockWrite) SetSuffrageProof

func (db *LeveldbBlockWrite) SetSuffrageProof(proof base.SuffrageProof) error

func (*LeveldbBlockWrite) SuffrageState

func (db *LeveldbBlockWrite) SuffrageState() base.State

func (*LeveldbBlockWrite) TempDatabase

func (db *LeveldbBlockWrite) TempDatabase() (isaac.TempDatabase, error)

func (*LeveldbBlockWrite) Write

func (db *LeveldbBlockWrite) Write() error

type LeveldbPermanent

type LeveldbPermanent struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewLeveldbPermanent

func NewLeveldbPermanent(
	st *leveldbstorage.Storage,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) (*LeveldbPermanent, error)

func (*LeveldbPermanent) BlockMap

func (db *LeveldbPermanent) BlockMap(height base.Height) (m base.BlockMap, _ bool, _ error)

func (*LeveldbPermanent) BlockMapBytes

func (db *LeveldbPermanent) BlockMapBytes(height base.Height) (
	enchint hint.Hint, meta, body []byte, found bool, err error,
)

func (*LeveldbPermanent) Clean

func (db *LeveldbPermanent) Clean() error

func (LeveldbPermanent) Close

func (db LeveldbPermanent) Close() error

func (*LeveldbPermanent) ExistsInStateOperation

func (db *LeveldbPermanent) ExistsInStateOperation(h util.Hash) (bool, error)

func (*LeveldbPermanent) ExistsKnownOperation

func (db *LeveldbPermanent) ExistsKnownOperation(h util.Hash) (bool, error)

func (LeveldbPermanent) LastBlockMap

func (db LeveldbPermanent) LastBlockMap() (base.BlockMap, bool, error)

func (LeveldbPermanent) LastBlockMapBytes

func (db LeveldbPermanent) LastBlockMapBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (LeveldbPermanent) LastNetworkPolicy

func (db LeveldbPermanent) LastNetworkPolicy() base.NetworkPolicy

func (LeveldbPermanent) LastSuffrageProof

func (db LeveldbPermanent) LastSuffrageProof() (base.SuffrageProof, bool, error)

func (LeveldbPermanent) LastSuffrageProofBytes

func (db LeveldbPermanent) LastSuffrageProofBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*LeveldbPermanent) MergeTempDatabase

func (db *LeveldbPermanent) MergeTempDatabase(ctx context.Context, temp isaac.TempDatabase) error

func (LeveldbPermanent) Prefix

func (db LeveldbPermanent) Prefix() []byte

func (LeveldbPermanent) Remove

func (db LeveldbPermanent) Remove() error

func (*LeveldbPermanent) State

func (db *LeveldbPermanent) State(key string) (st base.State, found bool, err error)

func (*LeveldbPermanent) StateBytes

func (db *LeveldbPermanent) StateBytes(key string) (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*LeveldbPermanent) SuffrageProof

func (db *LeveldbPermanent) SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error)

func (*LeveldbPermanent) SuffrageProofByBlockHeight

func (db *LeveldbPermanent) SuffrageProofByBlockHeight(height base.Height) (base.SuffrageProof, bool, error)

func (*LeveldbPermanent) SuffrageProofBytes

func (db *LeveldbPermanent) SuffrageProofBytes(suffrageHeight base.Height) (
	enchint hint.Hint, meta, body []byte, found bool, err error,
)

type LeveldbTempSyncPool

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

func NewLeveldbTempSyncPool

func NewLeveldbTempSyncPool(
	height base.Height,
	st *leveldbstorage.Storage,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) (*LeveldbTempSyncPool, error)

func (*LeveldbTempSyncPool) BlockMap

func (db *LeveldbTempSyncPool) BlockMap(height base.Height) (m base.BlockMap, found bool, _ error)

func (*LeveldbTempSyncPool) Cancel

func (db *LeveldbTempSyncPool) Cancel() error

func (LeveldbTempSyncPool) Close

func (db LeveldbTempSyncPool) Close() error

func (LeveldbTempSyncPool) Prefix

func (db LeveldbTempSyncPool) Prefix() []byte

func (LeveldbTempSyncPool) Remove

func (db LeveldbTempSyncPool) Remove() error

func (*LeveldbTempSyncPool) SetBlockMap

func (db *LeveldbTempSyncPool) SetBlockMap(m base.BlockMap) error

type MemTempSyncPool

type MemTempSyncPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemTempSyncPool

func NewMemTempSyncPool() *MemTempSyncPool

func (*MemTempSyncPool) BlockMap

func (db *MemTempSyncPool) BlockMap(height base.Height) (base.BlockMap, bool, error)

func (*MemTempSyncPool) Cancel

func (db *MemTempSyncPool) Cancel() error

func (*MemTempSyncPool) Close

func (db *MemTempSyncPool) Close() error

func (*MemTempSyncPool) SetBlockMap

func (db *MemTempSyncPool) SetBlockMap(m base.BlockMap) error

type PoolOperationRecordMeta

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

func ReadPoolOperationRecordMeta

func ReadPoolOperationRecordMeta(b []byte) (meta PoolOperationRecordMeta, _ error)

func (PoolOperationRecordMeta) AddedAt

func (h PoolOperationRecordMeta) AddedAt() time.Time

func (PoolOperationRecordMeta) Fact

func (PoolOperationRecordMeta) Hint

func (PoolOperationRecordMeta) Operation

func (h PoolOperationRecordMeta) Operation() util.Hash

func (PoolOperationRecordMeta) Version

func (h PoolOperationRecordMeta) Version() byte

type RedisPermanent

type RedisPermanent struct {
	*logging.Logging

	sync.Mutex
	// contains filtered or unexported fields
}

func NewRedisPermanent

func NewRedisPermanent(
	st *redisstorage.Storage,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) (*RedisPermanent, error)

func (*RedisPermanent) BlockMap

func (db *RedisPermanent) BlockMap(height base.Height) (m base.BlockMap, _ bool, _ error)

func (*RedisPermanent) BlockMapBytes

func (db *RedisPermanent) BlockMapBytes(height base.Height) (
	enchint hint.Hint, meta, body []byte, found bool, err error,
)

func (*RedisPermanent) Clean

func (db *RedisPermanent) Clean() error

func (*RedisPermanent) Close

func (db *RedisPermanent) Close() error

func (*RedisPermanent) ExistsInStateOperation

func (db *RedisPermanent) ExistsInStateOperation(h util.Hash) (bool, error)

func (*RedisPermanent) ExistsKnownOperation

func (db *RedisPermanent) ExistsKnownOperation(h util.Hash) (bool, error)

func (RedisPermanent) LastBlockMap

func (db RedisPermanent) LastBlockMap() (base.BlockMap, bool, error)

func (RedisPermanent) LastBlockMapBytes

func (db RedisPermanent) LastBlockMapBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (RedisPermanent) LastNetworkPolicy

func (db RedisPermanent) LastNetworkPolicy() base.NetworkPolicy

func (RedisPermanent) LastSuffrageProof

func (db RedisPermanent) LastSuffrageProof() (base.SuffrageProof, bool, error)

func (RedisPermanent) LastSuffrageProofBytes

func (db RedisPermanent) LastSuffrageProofBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*RedisPermanent) MergeTempDatabase

func (db *RedisPermanent) MergeTempDatabase(ctx context.Context, temp isaac.TempDatabase) error

func (*RedisPermanent) State

func (db *RedisPermanent) State(key string) (st base.State, found bool, _ error)

func (*RedisPermanent) StateBytes

func (db *RedisPermanent) StateBytes(key string) (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*RedisPermanent) SuffrageProof

func (db *RedisPermanent) SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error)

func (*RedisPermanent) SuffrageProofByBlockHeight

func (db *RedisPermanent) SuffrageProofByBlockHeight(height base.Height) (base.SuffrageProof, bool, error)

func (*RedisPermanent) SuffrageProofBytes

func (db *RedisPermanent) SuffrageProofBytes(suffrageHeight base.Height) (
	enchint hint.Hint, meta, body []byte, found bool, err error,
)

type TempLeveldb

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

func NewTempLeveldbFromPrefix

func NewTempLeveldbFromPrefix(
	st *leveldbstorage.Storage,
	prefix []byte,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) (*TempLeveldb, error)

func (*TempLeveldb) BlockMapBytes

func (db *TempLeveldb) BlockMapBytes() (enchint hint.Hint, meta, body []byte, _ error)

func (*TempLeveldb) Close

func (db *TempLeveldb) Close() error

func (*TempLeveldb) ExistsInStateOperation

func (db *TempLeveldb) ExistsInStateOperation(h util.Hash) (bool, error)

func (*TempLeveldb) ExistsKnownOperation

func (db *TempLeveldb) ExistsKnownOperation(h util.Hash) (bool, error)

func (*TempLeveldb) Height

func (db *TempLeveldb) Height() base.Height

func (*TempLeveldb) LastBlockMap

func (db *TempLeveldb) LastBlockMap() (base.BlockMap, bool, error)

func (*TempLeveldb) LastSuffrageProofBytes

func (db *TempLeveldb) LastSuffrageProofBytes() (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*TempLeveldb) Merge

func (db *TempLeveldb) Merge() error

func (*TempLeveldb) NetworkPolicy

func (db *TempLeveldb) NetworkPolicy() base.NetworkPolicy

func (TempLeveldb) Prefix

func (db TempLeveldb) Prefix() []byte

func (*TempLeveldb) Remove

func (db *TempLeveldb) Remove() error

func (*TempLeveldb) State

func (db *TempLeveldb) State(key string) (st base.State, found bool, err error)

func (*TempLeveldb) StateBytes

func (db *TempLeveldb) StateBytes(key string) (enchint hint.Hint, meta, body []byte, found bool, err error)

func (*TempLeveldb) SuffrageHeight

func (db *TempLeveldb) SuffrageHeight() base.Height

func (*TempLeveldb) SuffrageProof

func (db *TempLeveldb) SuffrageProof() (base.SuffrageProof, bool, error)

type TempPool

type TempPool struct {
	*util.ContextDaemon
	// contains filtered or unexported fields
}

func NewTempPool

func NewTempPool(st *leveldbstorage.Storage, encs *encoder.Encoders, enc encoder.Encoder) (*TempPool, error)

func (*TempPool) Ballot

func (db *TempPool) Ballot(point base.Point, stage base.Stage, isSuffrageConfirm bool) (base.Ballot, bool, error)

func (*TempPool) Close

func (db *TempPool) Close() error

func (*TempPool) LastVoteproofs

func (db *TempPool) LastVoteproofs() (base.INITVoteproof, base.ACCEPTVoteproof, bool, error)

func (*TempPool) NewOperation

func (db *TempPool) NewOperation(_ context.Context, operationhash util.Hash) (op base.Operation, found bool, _ error)

func (*TempPool) NewOperationBytes

func (db *TempPool) NewOperationBytes(_ context.Context, operationhash util.Hash) (
	enchint hint.Hint, meta, body []byte, found bool, _ error,
)

func (*TempPool) NewOperationHashes

func (db *TempPool) NewOperationHashes(
	ctx context.Context,
	height base.Height,
	limit uint64,
	filter func(isaac.PoolOperationRecordMeta) (bool, error),
) ([]util.Hash, error)

func (TempPool) Prefix

func (db TempPool) Prefix() []byte

func (*TempPool) Proposal

func (db *TempPool) Proposal(h util.Hash) (pr base.ProposalSignFact, found bool, _ error)

func (*TempPool) ProposalByPoint

func (db *TempPool) ProposalByPoint(point base.Point, proposer base.Address) (base.ProposalSignFact, bool, error)

func (*TempPool) ProposalBytes

func (db *TempPool) ProposalBytes(h util.Hash) (enchint hint.Hint, meta, body []byte, found bool, _ error)

func (TempPool) Remove

func (db TempPool) Remove() error

func (*TempPool) RemoveSuffrageWithdrawOperationsByFact

func (db *TempPool) RemoveSuffrageWithdrawOperationsByFact(facts []base.SuffrageWithdrawFact) error

func (*TempPool) RemoveSuffrageWithdrawOperationsByHeight

func (db *TempPool) RemoveSuffrageWithdrawOperationsByHeight(height base.Height) error

func (*TempPool) SetBallot

func (db *TempPool) SetBallot(bl base.Ballot) (bool, error)

func (*TempPool) SetLastVoteproofs

func (db *TempPool) SetLastVoteproofs(ivp base.INITVoteproof, avp base.ACCEPTVoteproof) error

func (*TempPool) SetNewOperation

func (db *TempPool) SetNewOperation(_ context.Context, op base.Operation) (bool, error)

func (*TempPool) SetProposal

func (db *TempPool) SetProposal(pr base.ProposalSignFact) (bool, error)

func (*TempPool) SetSuffrageWithdrawOperation

func (db *TempPool) SetSuffrageWithdrawOperation(op base.SuffrageWithdrawOperation) error

func (*TempPool) SuffrageWithdrawOperation

func (db *TempPool) SuffrageWithdrawOperation(
	height base.Height,
	node base.Address,
) (base.SuffrageWithdrawOperation, bool, error)

func (*TempPool) TraverseSuffrageWithdrawOperations

func (db *TempPool) TraverseSuffrageWithdrawOperations(
	_ context.Context,
	height base.Height,
	callback isaac.SuffrageVoteFunc,
) error

Jump to

Keyboard shortcuts

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