Documentation ¶
Index ¶
- Constants
- Variables
- func BlockCaller(handler interface{}, params ...interface{})
- func BlockFactory(key []byte, data []byte) (objectstorage.StorableObject, error)
- func BlockIDCaller(handler interface{}, params ...interface{})
- func BlockMetadataCaller(handler interface{}, params ...interface{})
- func BlockReferencedCaller(handler interface{}, params ...interface{})
- func MetadataFactory(key []byte, data []byte) (objectstorage.StorableObject, error)
- func MilestoneCaller(handler interface{}, params ...interface{})
- func MilestoneIndexCaller(handler interface{}, params ...interface{})
- func MilestoneWithBlockIDAndRequestedCaller(handler interface{}, params ...interface{})
- func NewBlockCaller(handler interface{}, params ...interface{})
- func ObjectStorageIteratorOptions(iteratorOptions ...IteratorOption) []objectstorage.IteratorOption
- type Block
- func (blk *Block) Block() *iotago.Block
- func (blk *Block) BlockID() iotago.BlockID
- func (blk *Block) Data() []byte
- func (blk *Block) IsMilestone() bool
- func (blk *Block) IsTransaction() bool
- func (blk *Block) Milestone() *iotago.Milestone
- func (blk *Block) ObjectStorageKey() []byte
- func (blk *Block) ObjectStorageValue() []byte
- func (blk *Block) Parents() iotago.BlockIDs
- func (blk *Block) ProtocolVersion() byte
- func (blk *Block) TaggedData() *iotago.TaggedData
- func (blk *Block) Transaction() *iotago.Transaction
- func (blk *Block) TransactionEssence() *iotago.TransactionEssence
- func (blk *Block) TransactionEssenceTaggedData() *iotago.TaggedData
- func (blk *Block) TransactionEssenceUTXOInputs() iotago.OutputIDs
- func (blk *Block) Update(_ objectstorage.StorableObject)
- type BlockIDConsumer
- type BlockMetadata
- func (m *BlockMetadata) BlockID() iotago.BlockID
- func (m *BlockMetadata) ConeRootIndexes() (ycri iotago.MilestoneIndex, ocri iotago.MilestoneIndex, ...)
- func (m *BlockMetadata) Conflict() Conflict
- func (m *BlockMetadata) IsConflictingTx() bool
- func (m *BlockMetadata) IsIncludedTxInLedger() bool
- func (m *BlockMetadata) IsMilestone() bool
- func (m *BlockMetadata) IsNoTransaction() bool
- func (m *BlockMetadata) IsReferenced() bool
- func (m *BlockMetadata) IsSolid() bool
- func (m *BlockMetadata) Metadata() byte
- func (m *BlockMetadata) ObjectStorageKey() []byte
- func (m *BlockMetadata) ObjectStorageValue() (data []byte)
- func (m *BlockMetadata) Parents() iotago.BlockIDs
- func (m *BlockMetadata) ReferencedWithIndex() (bool, iotago.MilestoneIndex)
- func (m *BlockMetadata) ReferencedWithIndexAndWhiteFlagIndex() (bool, iotago.MilestoneIndex, uint32)
- func (m *BlockMetadata) SetConeRootIndexes(ycri iotago.MilestoneIndex, ocri iotago.MilestoneIndex, ...)
- func (m *BlockMetadata) SetConflictingTx(conflict Conflict)
- func (m *BlockMetadata) SetIsNoTransaction(noTx bool)
- func (m *BlockMetadata) SetMilestone(milestone bool)
- func (m *BlockMetadata) SetReferenced(referenced bool, referencedIndex iotago.MilestoneIndex, whiteFlagIndex uint32)
- func (m *BlockMetadata) SetSolid(solid bool)
- func (m *BlockMetadata) Update(_ objectstorage.StorableObject)
- type BlocksMemcache
- type CachedBlock
- func (c *CachedBlock) Block() *Block
- func (c *CachedBlock) CachedMetadata() *CachedMetadata
- func (c *CachedBlock) ConsumeBlock(consumer func(*Block))
- func (c *CachedBlock) ConsumeBlockAndMetadata(consumer func(*Block, *BlockMetadata))
- func (c *CachedBlock) ConsumeMetadata(consumer func(*BlockMetadata))
- func (c *CachedBlock) Exists() bool
- func (c *CachedBlock) Metadata() *BlockMetadata
- func (c *CachedBlock) Release(force ...bool)
- func (c *CachedBlock) Retain() *CachedBlock
- type CachedBlockFunc
- type CachedBlockMetadataFunc
- type CachedBlocks
- type CachedChild
- type CachedChildren
- type CachedMetadata
- type CachedMilestone
- type CachedMilestones
- type CachedUnreferencedBlock
- type CachedUnreferencedBlocks
- type Child
- type ChildConsumer
- type Conflict
- type ErrDatabaseError
- type IteratorOption
- type IteratorOptions
- type LexicalOrderedSolidEntryPoints
- type MetadataMemcache
- type Milestone
- func (ms *Milestone) Data() []byte
- func (ms *Milestone) Index() iotago.MilestoneIndex
- func (ms *Milestone) Milestone() *iotago.Milestone
- func (ms *Milestone) MilestoneID() iotago.MilestoneID
- func (ms *Milestone) MilestoneIDHex() string
- func (ms *Milestone) ObjectStorageKey() []byte
- func (ms *Milestone) ObjectStorageValue() []byte
- func (ms *Milestone) Parents() iotago.BlockIDs
- func (ms *Milestone) Timestamp() time.Time
- func (ms *Milestone) TimestampUnix() uint32
- func (ms *Milestone) Update(_ objectstorage.StorableObject)
- type MilestoneIndex
- type MilestoneIndexConsumer
- type NonCachedStorage
- func (ns *NonCachedStorage) ForEachBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
- func (ns *NonCachedStorage) ForEachBlockMetadataBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
- func (ns *NonCachedStorage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)
- func (ns *NonCachedStorage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)
- func (ns *NonCachedStorage) ForEachUnreferencedBlock(consumer UnreferencedBlockConsumer, iteratorOptions ...IteratorOption)
- type ProtocolParamsMilestoneOptConsumer
- type ProtocolStorage
- func (s *ProtocolStorage) ActiveProtocolParameterMilestoneOptionsHash(msIndex iotago.MilestoneIndex) ([]byte, error)
- func (s *ProtocolStorage) ForEachActiveProtocolParameterMilestoneOption(msIndex iotago.MilestoneIndex, consumer ProtocolParamsMilestoneOptConsumer) error
- func (s *ProtocolStorage) ForEachProtocolParameterMilestoneOption(consumer ProtocolParamsMilestoneOptConsumer) error
- func (s *ProtocolStorage) ProtocolParameters(msIndex iotago.MilestoneIndex) (*iotago.ProtocolParameters, error)
- func (s *ProtocolStorage) ProtocolParametersMilestoneOption(msIndex iotago.MilestoneIndex) (*iotago.ProtocolParamsMilestoneOpt, error)
- func (s *ProtocolStorage) PruneProtocolParameterMilestoneOptions(pruningIndex iotago.MilestoneIndex) error
- func (s *ProtocolStorage) StoreProtocolParametersMilestoneOption(protoParamsMsOption *iotago.ProtocolParamsMilestoneOpt) error
- type ReadOption
- type SnapshotInfo
- func (i *SnapshotInfo) Deserialize(data []byte, _ serializer.DeSerializationMode, _ interface{}) (int, error)
- func (i *SnapshotInfo) EntryPointIndex() iotago.MilestoneIndex
- func (i *SnapshotInfo) GenesisMilestoneIndex() iotago.MilestoneIndex
- func (i *SnapshotInfo) PruningIndex() iotago.MilestoneIndex
- func (i *SnapshotInfo) Serialize(_ serializer.DeSerializationMode, _ interface{}) ([]byte, error)
- func (i *SnapshotInfo) SnapshotIndex() iotago.MilestoneIndex
- func (i *SnapshotInfo) SnapshotTimestamp() time.Time
- type SolidEntryPoint
- type SolidEntryPointConsumer
- type SolidEntryPoints
- func (s *SolidEntryPoints) Add(blockID iotago.BlockID, milestoneIndex iotago.MilestoneIndex)
- func (s *SolidEntryPoints) Bytes() []byte
- func (s *SolidEntryPoints) Clear()
- func (s *SolidEntryPoints) Contains(blockID iotago.BlockID) bool
- func (s *SolidEntryPoints) Index(blockID iotago.BlockID) (iotago.MilestoneIndex, bool)
- func (s *SolidEntryPoints) IsModified() bool
- func (s *SolidEntryPoints) SHA256Sum() ([]byte, error)
- func (s *SolidEntryPoints) SetModified(modified bool)
- func (s *SolidEntryPoints) Sorted() []*SolidEntryPoint
- type Storage
- func (s *Storage) AreDatabasesCorrupted() (bool, error)
- func (s *Storage) AreDatabasesTainted() (bool, error)
- func (s *Storage) Block(blockID iotago.BlockID) (*iotago.Block, error)
- func (s *Storage) BlockExistsInStore(blockID iotago.BlockID) bool
- func (s *Storage) BlockMetadataExistsInStore(blockID iotago.BlockID) bool
- func (s *Storage) BlockMetadataStorageSize() int
- func (s *Storage) BlockStorageSize() int
- func (s *Storage) CachedBlock(blockID iotago.BlockID) (*CachedBlock, error)
- func (s *Storage) CachedBlockMetadata(blockID iotago.BlockID) (*CachedMetadata, error)
- func (s *Storage) CachedBlockMetadataOrNil(blockID iotago.BlockID) *CachedMetadata
- func (s *Storage) CachedBlockOrNil(blockID iotago.BlockID) *CachedBlock
- func (s *Storage) CachedChildrenOfBlockID(blockID iotago.BlockID, iteratorOptions ...IteratorOption) CachedChildren
- func (s *Storage) CachedMilestoneByIndexOrNil(milestoneIndex iotago.MilestoneIndex) *CachedMilestone
- func (s *Storage) CachedMilestoneOrNil(milestoneID iotago.MilestoneID) *CachedMilestone
- func (s *Storage) CheckCorrectDatabasesVersion() (bool, error)
- func (s *Storage) CheckLedgerState() error
- func (s *Storage) ChildrenBlockIDs(blockID iotago.BlockID, iteratorOptions ...IteratorOption) (iotago.BlockIDs, error)
- func (s *Storage) ChildrenStorageSize() int
- func (s *Storage) ContainsBlock(blockID iotago.BlockID, readOptions ...ReadOption) bool
- func (s *Storage) ContainsChild(blockID iotago.BlockID, childBlockID iotago.BlockID, readOptions ...ReadOption) bool
- func (s *Storage) ContainsMilestoneIndex(milestoneIndex iotago.MilestoneIndex, readOptions ...ReadOption) bool
- func (s *Storage) CurrentProtocolParameters() (*iotago.ProtocolParameters, error)
- func (s *Storage) DeleteBlock(blockID iotago.BlockID)
- func (s *Storage) DeleteBlockMetadata(blockID iotago.BlockID)
- func (s *Storage) DeleteChild(blockID iotago.BlockID, childBlockID iotago.BlockID)
- func (s *Storage) DeleteChildren(blockID iotago.BlockID, iteratorOptions ...IteratorOption)
- func (s *Storage) DeleteMilestone(milestoneIndex iotago.MilestoneIndex)
- func (s *Storage) DeleteUnreferencedBlocks(msIndex iotago.MilestoneIndex, iteratorOptions ...IteratorOption) int
- func (s *Storage) FlushAndCloseStores() error
- func (s *Storage) FlushBlocksStorage()
- func (s *Storage) FlushChildrenStorage()
- func (s *Storage) FlushMilestoneStorage()
- func (s *Storage) FlushStorages()
- func (s *Storage) FlushUnreferencedBlocksStorage()
- func (s *Storage) ForEachBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
- func (s *Storage) ForEachBlockMetadataBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
- func (s *Storage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)
- func (s *Storage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)
- func (s *Storage) ForEachSolidEntryPointWithoutLocking(consumer SolidEntryPointConsumer)
- func (s *Storage) ForEachUnreferencedBlock(consumer UnreferencedBlockConsumer, iteratorOptions ...IteratorOption)
- func (s *Storage) MarkDatabasesCorrupted() error
- func (s *Storage) MarkDatabasesHealthy() error
- func (s *Storage) MarkDatabasesTainted() error
- func (s *Storage) MilestoneBlockIDByIndex(milestoneIndex iotago.MilestoneIndex) (iotago.BlockID, error)
- func (s *Storage) MilestoneParentsByIndex(milestoneIndex iotago.MilestoneIndex) (iotago.BlockIDs, error)
- func (s *Storage) MilestoneStorageSize() int
- func (s *Storage) MilestoneTimestampByIndex(milestoneIndex iotago.MilestoneIndex) (time.Time, error)
- func (s *Storage) MilestoneTimestampUnixByIndex(milestoneIndex iotago.MilestoneIndex) (uint32, error)
- func (s *Storage) NonCachedStorage() *NonCachedStorage
- func (s *Storage) PrintSnapshotInfo()
- func (s *Storage) ReadLockSolidEntryPoints()
- func (s *Storage) ReadUnlockSolidEntryPoints()
- func (s *Storage) ResetSolidEntryPointsWithoutLocking()
- func (s *Storage) SearchLatestMilestoneIndexInStore() iotago.MilestoneIndex
- func (s *Storage) SetEntryPointIndex(entryPointIndex iotago.MilestoneIndex) error
- func (s *Storage) SetInitialSnapshotInfo(genesisMilestoneIndex iotago.MilestoneIndex, ...) error
- func (s *Storage) SetPruningIndex(pruningIndex iotago.MilestoneIndex) error
- func (s *Storage) SetSnapshotIndex(snapshotIndex iotago.MilestoneIndex, snapshotTimestamp time.Time) error
- func (s *Storage) Shutdown() error
- func (s *Storage) ShutdownBlocksStorage()
- func (s *Storage) ShutdownChildrenStorage()
- func (s *Storage) ShutdownMilestoneStorage()
- func (s *Storage) ShutdownStorages()
- func (s *Storage) ShutdownUnreferencedBlocksStorage()
- func (s *Storage) SnapshotInfo() *SnapshotInfo
- func (s *Storage) SolidEntryPoints() *SolidEntryPoints
- func (s *Storage) SolidEntryPointsAddWithoutLocking(blockID iotago.BlockID, milestoneIndex iotago.MilestoneIndex)
- func (s *Storage) SolidEntryPointsContain(blockID iotago.BlockID) (bool, error)
- func (s *Storage) SolidEntryPointsIndex(blockID iotago.BlockID) (iotago.MilestoneIndex, bool, error)
- func (s *Storage) StoreBlockIfAbsent(block *Block) (cachedBlock *CachedBlock, newlyAdded bool)
- func (s *Storage) StoreChild(parentBlockID iotago.BlockID, childBlockID iotago.BlockID) *CachedChild
- func (s *Storage) StoreMilestoneIfAbsent(milestonePayload *iotago.Milestone, blockID iotago.BlockID) (cachedMilestone *CachedMilestone, newlyAdded bool)
- func (s *Storage) StoreSolidEntryPointsWithoutLocking() error
- func (s *Storage) StoreUnreferencedBlock(msIndex iotago.MilestoneIndex, blockID iotago.BlockID) *CachedUnreferencedBlock
- func (s *Storage) StoredMetadataOrNil(blockID iotago.BlockID) *BlockMetadata
- func (s *Storage) TangleStore() kvstore.KVStore
- func (s *Storage) UTXOManager() *utxo.Manager
- func (s *Storage) UTXOStore() kvstore.KVStore
- func (s *Storage) UnreferencedBlockIDs(msIndex iotago.MilestoneIndex, iteratorOptions ...IteratorOption) iotago.BlockIDs
- func (s *Storage) UnreferencedBlocksStorageSize() int
- func (s *Storage) UpdateDatabasesVersion() (bool, error)
- func (s *Storage) UpdateSnapshotInfo(snapshotIndex iotago.MilestoneIndex, entryPointIndex iotago.MilestoneIndex, ...) error
- func (s *Storage) WriteLockSolidEntryPoints()
- func (s *Storage) WriteUnlockSolidEntryPoints()
- type StoreHealthTracker
- func (s *StoreHealthTracker) CheckCorrectDatabaseVersion() (bool, error)
- func (s *StoreHealthTracker) DatabaseVersion() (int, error)
- func (s *StoreHealthTracker) IsCorrupted() (bool, error)
- func (s *StoreHealthTracker) IsTainted() (bool, error)
- func (s *StoreHealthTracker) MarkCorrupted() error
- func (s *StoreHealthTracker) MarkHealthy() error
- func (s *StoreHealthTracker) MarkTainted() error
- func (s *StoreHealthTracker) UpdateDatabaseVersion() (bool, error)
- type UnreferencedBlock
- func (t *UnreferencedBlock) BlockID() iotago.BlockID
- func (t *UnreferencedBlock) LatestMilestoneIndex() iotago.MilestoneIndex
- func (t *UnreferencedBlock) ObjectStorageKey() []byte
- func (t *UnreferencedBlock) ObjectStorageValue() []byte
- func (t *UnreferencedBlock) Update(_ objectstorage.StorableObject)
- type UnreferencedBlockConsumer
Constants ¶
const ( BlockMetadataSolid = 0 BlockMetadataReferenced = 1 BlockMetadataNoTx = 2 BlockMetadataConflictingTx = 3 BlockMetadataMilestone = 4 )
const ( // ConflictNone the block has no conflict. ConflictNone Conflict = iota // ConflictInputUTXOAlreadySpent the referenced UTXO was already spent. ConflictInputUTXOAlreadySpent = 1 // ConflictInputUTXOAlreadySpentInThisMilestone the referenced UTXO was already spent while confirming this milestone ConflictInputUTXOAlreadySpentInThisMilestone = 2 // ConflictInputUTXONotFound the referenced UTXO cannot be found. ConflictInputUTXONotFound = 3 // ConflictInputOutputSumMismatch the sum of the inputs and output values does not match. ConflictInputOutputSumMismatch = 4 // ConflictInvalidSignature the unlock block signature is invalid. ConflictInvalidSignature = 5 // ConflictTimelockNotExpired the configured timelock is not yet expired. ConflictTimelockNotExpired = 6 // ConflictInvalidNativeTokens the given native tokens are invalid. ConflictInvalidNativeTokens = 7 // ConflictReturnAmountNotFulfilled return amount in a transaction is not fulfilled by the output side. ConflictReturnAmountNotFulfilled = 8 // ConflictInvalidInputUnlock input unlock is invalid. ConflictInvalidInputUnlock = 9 // ConflictInvalidInputsCommitment the inputs commitment is invalid. ConflictInvalidInputsCommitment = 10 // ConflictInvalidSender an output contains a Sender with an ident which is not unlocked. ConflictInvalidSender = 11 // ConflictInvalidChainStateTransition the chain state transition is invalid. ConflictInvalidChainStateTransition = 12 // ConflictSemanticValidationFailed the semantic validation failed. ConflictSemanticValidationFailed = 255 )
const ( DBVersionTangle byte = 2 DBVersionUTXO byte = 2 )
const ( // DBVersionNone is used to load an existing database without a version check (e.g. in the tools) DBVersionNone byte = 0 )
const (
MaxProtocolParametersActivationRange uint32 = 30
)
Variables ¶
var ( ErrSolidEntryPointsAlreadyInitialized = errors.New("solidEntryPoints already initialized") ErrSolidEntryPointsNotInitialized = errors.New("solidEntryPoints not initialized") )
var (
ErrDBVersionCheckNotSupported = errors.New("database version check not supported")
)
var (
ErrMilestoneNotFound = errors.New("milestone not found")
)
var (
ErrProtocolParamsMilestoneOptAlreadyExists = errors.New("protocol parameters milestone option already exists")
)
Functions ¶
func BlockCaller ¶
func BlockCaller(handler interface{}, params ...interface{})
func BlockFactory ¶
func BlockFactory(key []byte, data []byte) (objectstorage.StorableObject, error)
func BlockIDCaller ¶
func BlockIDCaller(handler interface{}, params ...interface{})
func BlockMetadataCaller ¶
func BlockMetadataCaller(handler interface{}, params ...interface{})
func BlockReferencedCaller ¶
func BlockReferencedCaller(handler interface{}, params ...interface{})
func MetadataFactory ¶
func MetadataFactory(key []byte, data []byte) (objectstorage.StorableObject, error)
func MilestoneCaller ¶
func MilestoneCaller(handler interface{}, params ...interface{})
func MilestoneIndexCaller ¶
func MilestoneIndexCaller(handler interface{}, params ...interface{})
func MilestoneWithBlockIDAndRequestedCaller ¶
func MilestoneWithBlockIDAndRequestedCaller(handler interface{}, params ...interface{})
func NewBlockCaller ¶
func NewBlockCaller(handler interface{}, params ...interface{})
func ObjectStorageIteratorOptions ¶
func ObjectStorageIteratorOptions(iteratorOptions ...IteratorOption) []objectstorage.IteratorOption
Types ¶
type Block ¶
type Block struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func BlockFromBytes ¶
func BlockFromBytes(data []byte, deSeriMode serializer.DeSerializationMode, protoParams *iotago.ProtocolParameters) (*Block, error)
func (*Block) IsMilestone ¶
func (*Block) IsTransaction ¶
func (*Block) ObjectStorageKey ¶
func (*Block) ObjectStorageValue ¶
func (*Block) ProtocolVersion ¶
func (*Block) TaggedData ¶
func (blk *Block) TaggedData() *iotago.TaggedData
func (*Block) Transaction ¶
func (blk *Block) Transaction() *iotago.Transaction
func (*Block) TransactionEssence ¶
func (blk *Block) TransactionEssence() *iotago.TransactionEssence
func (*Block) TransactionEssenceTaggedData ¶
func (blk *Block) TransactionEssenceTaggedData() *iotago.TaggedData
func (*Block) TransactionEssenceUTXOInputs ¶
func (*Block) Update ¶
func (blk *Block) Update(_ objectstorage.StorableObject)
type BlockIDConsumer ¶
BlockIDConsumer consumes the given block ID during looping through all blocks. Returning false from this function indicates to abort the iteration.
type BlockMetadata ¶
type BlockMetadata struct { objectstorage.StorableObjectFlags syncutils.RWMutex // contains filtered or unexported fields }
func NewBlockMetadata ¶
func NewBlockMetadata(blockID iotago.BlockID, parents iotago.BlockIDs) *BlockMetadata
func (*BlockMetadata) BlockID ¶
func (m *BlockMetadata) BlockID() iotago.BlockID
func (*BlockMetadata) ConeRootIndexes ¶
func (m *BlockMetadata) ConeRootIndexes() (ycri iotago.MilestoneIndex, ocri iotago.MilestoneIndex, ci iotago.MilestoneIndex)
func (*BlockMetadata) Conflict ¶
func (m *BlockMetadata) Conflict() Conflict
func (*BlockMetadata) IsConflictingTx ¶
func (m *BlockMetadata) IsConflictingTx() bool
func (*BlockMetadata) IsIncludedTxInLedger ¶
func (m *BlockMetadata) IsIncludedTxInLedger() bool
func (*BlockMetadata) IsMilestone ¶
func (m *BlockMetadata) IsMilestone() bool
func (*BlockMetadata) IsNoTransaction ¶
func (m *BlockMetadata) IsNoTransaction() bool
func (*BlockMetadata) IsReferenced ¶
func (m *BlockMetadata) IsReferenced() bool
func (*BlockMetadata) IsSolid ¶
func (m *BlockMetadata) IsSolid() bool
func (*BlockMetadata) Metadata ¶
func (m *BlockMetadata) Metadata() byte
func (*BlockMetadata) ObjectStorageKey ¶
func (m *BlockMetadata) ObjectStorageKey() []byte
func (*BlockMetadata) ObjectStorageValue ¶
func (m *BlockMetadata) ObjectStorageValue() (data []byte)
func (*BlockMetadata) Parents ¶
func (m *BlockMetadata) Parents() iotago.BlockIDs
func (*BlockMetadata) ReferencedWithIndex ¶
func (m *BlockMetadata) ReferencedWithIndex() (bool, iotago.MilestoneIndex)
func (*BlockMetadata) ReferencedWithIndexAndWhiteFlagIndex ¶
func (m *BlockMetadata) ReferencedWithIndexAndWhiteFlagIndex() (bool, iotago.MilestoneIndex, uint32)
func (*BlockMetadata) SetConeRootIndexes ¶
func (m *BlockMetadata) SetConeRootIndexes(ycri iotago.MilestoneIndex, ocri iotago.MilestoneIndex, ci iotago.MilestoneIndex)
func (*BlockMetadata) SetConflictingTx ¶
func (m *BlockMetadata) SetConflictingTx(conflict Conflict)
func (*BlockMetadata) SetIsNoTransaction ¶
func (m *BlockMetadata) SetIsNoTransaction(noTx bool)
func (*BlockMetadata) SetMilestone ¶
func (m *BlockMetadata) SetMilestone(milestone bool)
func (*BlockMetadata) SetReferenced ¶
func (m *BlockMetadata) SetReferenced(referenced bool, referencedIndex iotago.MilestoneIndex, whiteFlagIndex uint32)
func (*BlockMetadata) SetSolid ¶
func (m *BlockMetadata) SetSolid(solid bool)
func (*BlockMetadata) Update ¶
func (m *BlockMetadata) Update(_ objectstorage.StorableObject)
type BlocksMemcache ¶
type BlocksMemcache struct {
// contains filtered or unexported fields
}
func NewBlocksMemcache ¶
func NewBlocksMemcache(cachedBlockFunc CachedBlockFunc) *BlocksMemcache
NewBlocksMemcache creates a new BlocksMemcache instance.
func (*BlocksMemcache) CachedBlock ¶
func (c *BlocksMemcache) CachedBlock(blockID iotago.BlockID) (*CachedBlock, error)
CachedBlock returns a cached block object. block +1
func (*BlocksMemcache) Cleanup ¶
func (c *BlocksMemcache) Cleanup(forceRelease bool)
Cleanup releases all the cached objects that have been used. This MUST be called by the user at the end.
type CachedBlock ¶
type CachedBlock struct {
// contains filtered or unexported fields
}
CachedBlock contains two cached objects, one for block and one for metadata.
func NewCachedBlock ¶
func NewCachedBlock(block objectstorage.CachedObject, metadata objectstorage.CachedObject) *CachedBlock
func (*CachedBlock) Block ¶
func (c *CachedBlock) Block() *Block
Block retrieves the block, that is cached in this container.
func (*CachedBlock) CachedMetadata ¶
func (c *CachedBlock) CachedMetadata() *CachedMetadata
CachedMetadata returns the underlying cached metadata. meta +1
func (*CachedBlock) ConsumeBlock ¶
func (c *CachedBlock) ConsumeBlock(consumer func(*Block))
ConsumeBlock consumes the underlying block. block -1 meta -1
func (*CachedBlock) ConsumeBlockAndMetadata ¶
func (c *CachedBlock) ConsumeBlockAndMetadata(consumer func(*Block, *BlockMetadata))
ConsumeBlockAndMetadata consumes the underlying block and metadata. block -1 meta -1
func (*CachedBlock) ConsumeMetadata ¶
func (c *CachedBlock) ConsumeMetadata(consumer func(*BlockMetadata))
ConsumeMetadata consumes the underlying metadata. block -1 meta -1
func (*CachedBlock) Exists ¶
func (c *CachedBlock) Exists() bool
Exists returns true if the block in this container does exist (could be found in the database and was not marked as deleted).
func (*CachedBlock) Metadata ¶
func (c *CachedBlock) Metadata() *BlockMetadata
Metadata retrieves the metadata, that is cached in this container.
func (*CachedBlock) Release ¶
func (c *CachedBlock) Release(force ...bool)
Release releases the cached block and metadata, to be picked up by the persistence layer (as soon as all consumers are done). block -1
func (*CachedBlock) Retain ¶
func (c *CachedBlock) Retain() *CachedBlock
Retain registers a new consumer for the cached block and metadata. block +1
type CachedBlockFunc ¶
type CachedBlockFunc func(blockID iotago.BlockID) (*CachedBlock, error)
type CachedBlockMetadataFunc ¶
type CachedBlockMetadataFunc func(blockID iotago.BlockID) (*CachedMetadata, error)
type CachedBlocks ¶
type CachedBlocks []*CachedBlock
func (CachedBlocks) Release ¶
func (cachedBlocks CachedBlocks) Release(force ...bool)
Release releases the cached blocks, to be picked up by the persistence layer (as soon as all consumers are done). block -1
func (CachedBlocks) Retain ¶
func (cachedBlocks CachedBlocks) Retain() CachedBlocks
Retain registers a new consumer for the cached blocks. block +1
type CachedChild ¶
type CachedChild struct {
objectstorage.CachedObject
}
CachedChild represents a cached Child.
func (*CachedChild) Child ¶
func (c *CachedChild) Child() *Child
Child retrieves the child, that is cached in this container.
func (*CachedChild) Retain ¶
func (c *CachedChild) Retain() *CachedChild
Retain registers a new consumer for the cached child. child +1
type CachedChildren ¶
type CachedChildren []*CachedChild
func (CachedChildren) Release ¶
func (cachedChildren CachedChildren) Release(force ...bool)
Release releases the cached children, to be picked up by the persistence layer (as soon as all consumers are done).
func (CachedChildren) Retain ¶
func (cachedChildren CachedChildren) Retain() CachedChildren
Retain registers a new consumer for the cached children. child +1
type CachedMetadata ¶
type CachedMetadata struct {
objectstorage.CachedObject
}
CachedMetadata contains the cached object only for metadata.
func NewCachedMetadata ¶
func NewCachedMetadata(metadata objectstorage.CachedObject) *CachedMetadata
func (*CachedMetadata) ConsumeMetadata ¶
func (c *CachedMetadata) ConsumeMetadata(consumer func(*BlockMetadata))
ConsumeMetadata consumes the metadata. meta -1
func (*CachedMetadata) Metadata ¶
func (c *CachedMetadata) Metadata() *BlockMetadata
Metadata retrieves the metadata, that is cached in this container.
func (*CachedMetadata) Retain ¶
func (c *CachedMetadata) Retain() *CachedMetadata
Retain registers a new consumer for the cached metadata. meta +1
type CachedMilestone ¶
type CachedMilestone struct {
objectstorage.CachedObject
}
CachedMilestone represents a cached milestone.
func (*CachedMilestone) Milestone ¶
func (c *CachedMilestone) Milestone() *Milestone
Milestone retrieves the milestone, that is cached in this container.
func (*CachedMilestone) Retain ¶
func (c *CachedMilestone) Retain() *CachedMilestone
Retain registers a new consumer for the cached milestone. milestone +1
type CachedMilestones ¶
type CachedMilestones []*CachedMilestone
func (CachedMilestones) Release ¶
func (c CachedMilestones) Release(force ...bool)
Release releases the cached milestones, to be picked up by the persistence layer (as soon as all consumers are done). milestone -1
func (CachedMilestones) Retain ¶
func (c CachedMilestones) Retain() CachedMilestones
Retain registers a new consumer for the cached milestones. milestone +1
type CachedUnreferencedBlock ¶
type CachedUnreferencedBlock struct {
objectstorage.CachedObject
}
CachedUnreferencedBlock represents a cached unreferenced block.
func (*CachedUnreferencedBlock) UnreferencedBlock ¶
func (c *CachedUnreferencedBlock) UnreferencedBlock() *UnreferencedBlock
UnreferencedBlock retrieves the unreferenced block, that is cached in this container.
type CachedUnreferencedBlocks ¶
type CachedUnreferencedBlocks []*CachedUnreferencedBlock
func (CachedUnreferencedBlocks) Release ¶
func (cachedUnreferencedBlocks CachedUnreferencedBlocks) Release(force ...bool)
Release releases the cached unreferenced blocks, to be picked up by the persistence layer (as soon as all consumers are done).
type Child ¶
type Child struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func (*Child) ChildBlockID ¶
func (*Child) ObjectStorageKey ¶
func (*Child) ObjectStorageValue ¶
func (*Child) ParentBlockID ¶
func (*Child) Update ¶
func (a *Child) Update(_ objectstorage.StorableObject)
type ChildConsumer ¶
ChildConsumer consumes the given child during looping through all children. Returning false from this function indicates to abort the iteration.
type Conflict ¶
type Conflict uint8
Conflict defines the reason why a block is marked as conflicting.
type ErrDatabaseError ¶
type ErrDatabaseError struct {
Inner error
}
func NewDatabaseError ¶
func NewDatabaseError(cause error) *ErrDatabaseError
func (ErrDatabaseError) Cause ¶
func (e ErrDatabaseError) Cause() error
func (ErrDatabaseError) Error ¶
func (e ErrDatabaseError) Error() string
type IteratorOption ¶
type IteratorOption func(opts *IteratorOptions)
IteratorOption is a function setting an iterator option.
func WithIteratorMaxIterations ¶
func WithIteratorMaxIterations(maxIterations int) IteratorOption
WithIteratorMaxIterations is used to stop the iteration after a certain amount of iterations. 0 disables the limit.
func WithIteratorPrefix ¶
func WithIteratorPrefix(prefix []byte) IteratorOption
WithIteratorPrefix is used to iterate a subset of elements with a defined prefix.
type IteratorOptions ¶
type IteratorOptions struct {
// contains filtered or unexported fields
}
IteratorOptions define options for iterations in the object storage.
type LexicalOrderedSolidEntryPoints ¶
type LexicalOrderedSolidEntryPoints []*SolidEntryPoint
LexicalOrderedSolidEntryPoints are solid entry points ordered in lexical order by their BlockID.
func (LexicalOrderedSolidEntryPoints) Len ¶
func (l LexicalOrderedSolidEntryPoints) Len() int
func (LexicalOrderedSolidEntryPoints) Less ¶
func (l LexicalOrderedSolidEntryPoints) Less(i, j int) bool
func (LexicalOrderedSolidEntryPoints) Swap ¶
func (l LexicalOrderedSolidEntryPoints) Swap(i, j int)
type MetadataMemcache ¶
type MetadataMemcache struct {
// contains filtered or unexported fields
}
func NewMetadataMemcache ¶
func NewMetadataMemcache(cachedBlockMetadataFunc CachedBlockMetadataFunc) *MetadataMemcache
NewMetadataMemcache creates a new NewMetadataMemcache instance.
func (*MetadataMemcache) CachedBlockMetadata ¶
func (c *MetadataMemcache) CachedBlockMetadata(blockID iotago.BlockID) (*CachedMetadata, error)
CachedBlockMetadata returns a cached metadata object. meta +1
func (*MetadataMemcache) Cleanup ¶
func (c *MetadataMemcache) Cleanup(forceRelease bool)
Cleanup releases all the cached objects that have been used. This MUST be called by the user at the end.
type Milestone ¶
type Milestone struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func NewMilestone ¶
func (*Milestone) Index ¶
func (ms *Milestone) Index() iotago.MilestoneIndex
func (*Milestone) MilestoneID ¶
func (ms *Milestone) MilestoneID() iotago.MilestoneID
func (*Milestone) MilestoneIDHex ¶
func (*Milestone) ObjectStorageKey ¶
func (*Milestone) ObjectStorageValue ¶
func (*Milestone) TimestampUnix ¶
func (*Milestone) Update ¶
func (ms *Milestone) Update(_ objectstorage.StorableObject)
type MilestoneIndex ¶
type MilestoneIndex struct { objectstorage.StorableObjectFlags Index iotago.MilestoneIndex // contains filtered or unexported fields }
func NewMilestoneIndex ¶
func NewMilestoneIndex(milestonePayload *iotago.Milestone, blockID iotago.BlockID, milestoneID ...iotago.MilestoneID) (*MilestoneIndex, error)
func (*MilestoneIndex) MilestoneID ¶
func (ms *MilestoneIndex) MilestoneID() iotago.MilestoneID
func (*MilestoneIndex) ObjectStorageKey ¶
func (ms *MilestoneIndex) ObjectStorageKey() []byte
func (*MilestoneIndex) ObjectStorageValue ¶
func (ms *MilestoneIndex) ObjectStorageValue() (data []byte)
func (*MilestoneIndex) Update ¶
func (ms *MilestoneIndex) Update(_ objectstorage.StorableObject)
type MilestoneIndexConsumer ¶
type MilestoneIndexConsumer func(index iotago.MilestoneIndex) bool
MilestoneIndexConsumer consumes the given index during looping through all milestones. Returning false from this function indicates to abort the iteration.
type NonCachedStorage ¶
type NonCachedStorage struct {
// contains filtered or unexported fields
}
NonCachedStorage is a Storage without a cache.
func (*NonCachedStorage) ForEachBlockID ¶
func (ns *NonCachedStorage) ForEachBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
ForEachBlockID loops over all block IDs.
func (*NonCachedStorage) ForEachBlockMetadataBlockID ¶
func (ns *NonCachedStorage) ForEachBlockMetadataBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
ForEachBlockMetadataBlockID loops over all block metadata block IDs.
func (*NonCachedStorage) ForEachChild ¶
func (ns *NonCachedStorage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)
ForEachChild loops over all children.
func (*NonCachedStorage) ForEachMilestoneIndex ¶
func (ns *NonCachedStorage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)
ForEachMilestoneIndex loops through all milestones.
func (*NonCachedStorage) ForEachUnreferencedBlock ¶
func (ns *NonCachedStorage) ForEachUnreferencedBlock(consumer UnreferencedBlockConsumer, iteratorOptions ...IteratorOption)
ForEachUnreferencedBlock loops over all unreferenced blocks.
type ProtocolParamsMilestoneOptConsumer ¶
type ProtocolParamsMilestoneOptConsumer func(*iotago.ProtocolParamsMilestoneOpt) bool
ProtocolParamsMilestoneOptConsumer consumes the given ProtocolParamsMilestoneOpt. Returning false from this function indicates to abort the iteration.
type ProtocolStorage ¶
type ProtocolStorage struct {
// contains filtered or unexported fields
}
func NewProtocolStorage ¶
func NewProtocolStorage(protocolStore kvstore.KVStore) *ProtocolStorage
func (*ProtocolStorage) ActiveProtocolParameterMilestoneOptionsHash ¶
func (s *ProtocolStorage) ActiveProtocolParameterMilestoneOptionsHash(msIndex iotago.MilestoneIndex) ([]byte, error)
func (*ProtocolStorage) ForEachActiveProtocolParameterMilestoneOption ¶
func (s *ProtocolStorage) ForEachActiveProtocolParameterMilestoneOption(msIndex iotago.MilestoneIndex, consumer ProtocolParamsMilestoneOptConsumer) error
func (*ProtocolStorage) ForEachProtocolParameterMilestoneOption ¶
func (s *ProtocolStorage) ForEachProtocolParameterMilestoneOption(consumer ProtocolParamsMilestoneOptConsumer) error
func (*ProtocolStorage) ProtocolParameters ¶
func (s *ProtocolStorage) ProtocolParameters(msIndex iotago.MilestoneIndex) (*iotago.ProtocolParameters, error)
func (*ProtocolStorage) ProtocolParametersMilestoneOption ¶
func (s *ProtocolStorage) ProtocolParametersMilestoneOption(msIndex iotago.MilestoneIndex) (*iotago.ProtocolParamsMilestoneOpt, error)
func (*ProtocolStorage) PruneProtocolParameterMilestoneOptions ¶
func (s *ProtocolStorage) PruneProtocolParameterMilestoneOptions(pruningIndex iotago.MilestoneIndex) error
func (*ProtocolStorage) StoreProtocolParametersMilestoneOption ¶
func (s *ProtocolStorage) StoreProtocolParametersMilestoneOption(protoParamsMsOption *iotago.ProtocolParamsMilestoneOpt) error
type ReadOption ¶
type ReadOption = objectstorage.ReadOption
type SnapshotInfo ¶
type SnapshotInfo struct {
// contains filtered or unexported fields
}
func (*SnapshotInfo) Deserialize ¶
func (i *SnapshotInfo) Deserialize(data []byte, _ serializer.DeSerializationMode, _ interface{}) (int, error)
func (*SnapshotInfo) EntryPointIndex ¶
func (i *SnapshotInfo) EntryPointIndex() iotago.MilestoneIndex
EntryPointIndex returns the index of the milestone of which the SEPs within the database are from.
func (*SnapshotInfo) GenesisMilestoneIndex ¶
func (i *SnapshotInfo) GenesisMilestoneIndex() iotago.MilestoneIndex
GenesisMilestoneIndex returns the index of the genesis milestone of the network.
func (*SnapshotInfo) PruningIndex ¶
func (i *SnapshotInfo) PruningIndex() iotago.MilestoneIndex
PruningIndex returns the index of the milestone before which the tangle history is pruned. This is not the same as EntryPointIndex, so we can cleanly prune again even if the pruning was aborted last time.
func (*SnapshotInfo) Serialize ¶
func (i *SnapshotInfo) Serialize(_ serializer.DeSerializationMode, _ interface{}) ([]byte, error)
func (*SnapshotInfo) SnapshotIndex ¶
func (i *SnapshotInfo) SnapshotIndex() iotago.MilestoneIndex
SnapshotIndex returns the index of the snapshot file.
func (*SnapshotInfo) SnapshotTimestamp ¶
func (i *SnapshotInfo) SnapshotTimestamp() time.Time
SnapshotTimestamp returns the timestamp of the target milestone of the snapshot.
type SolidEntryPoint ¶
type SolidEntryPoint struct { BlockID iotago.BlockID Index iotago.MilestoneIndex }
type SolidEntryPointConsumer ¶
type SolidEntryPointConsumer func(solidEntryPoint *SolidEntryPoint) bool
SolidEntryPointConsumer consumes the solid entry point during looping through all solid entry points. Returning false from this function indicates to abort the iteration.
type SolidEntryPoints ¶
type SolidEntryPoints struct {
// contains filtered or unexported fields
}
func NewSolidEntryPoints ¶
func NewSolidEntryPoints() *SolidEntryPoints
func SolidEntryPointsFromBytes ¶
func SolidEntryPointsFromBytes(solidEntryPointsBytes []byte) (*SolidEntryPoints, error)
func (*SolidEntryPoints) Add ¶
func (s *SolidEntryPoints) Add(blockID iotago.BlockID, milestoneIndex iotago.MilestoneIndex)
func (*SolidEntryPoints) Bytes ¶
func (s *SolidEntryPoints) Bytes() []byte
func (*SolidEntryPoints) Clear ¶
func (s *SolidEntryPoints) Clear()
func (*SolidEntryPoints) Contains ¶
func (s *SolidEntryPoints) Contains(blockID iotago.BlockID) bool
func (*SolidEntryPoints) Index ¶
func (s *SolidEntryPoints) Index(blockID iotago.BlockID) (iotago.MilestoneIndex, bool)
func (*SolidEntryPoints) IsModified ¶
func (s *SolidEntryPoints) IsModified() bool
func (*SolidEntryPoints) SHA256Sum ¶
func (s *SolidEntryPoints) SHA256Sum() ([]byte, error)
func (*SolidEntryPoints) SetModified ¶
func (s *SolidEntryPoints) SetModified(modified bool)
func (*SolidEntryPoints) Sorted ¶
func (s *SolidEntryPoints) Sorted() []*SolidEntryPoint
Sorted sorts the solid entry points lexicographically by their BlockID
type Storage ¶
type Storage struct { *ProtocolStorage // events Events *packageEvents // contains filtered or unexported fields }
Storage is the access layer to the node databases (partially cached).
func (*Storage) AreDatabasesCorrupted ¶
func (*Storage) AreDatabasesTainted ¶
func (*Storage) BlockExistsInStore ¶
BlockExistsInStore returns if the given block exists in the persistence layer.
func (*Storage) BlockMetadataExistsInStore ¶
BlockMetadataExistsInStore returns if the given block metadata exists in the persistence layer.
func (*Storage) BlockMetadataStorageSize ¶
func (*Storage) BlockStorageSize ¶
func (*Storage) CachedBlock ¶
func (s *Storage) CachedBlock(blockID iotago.BlockID) (*CachedBlock, error)
CachedBlock returns a cached block object. block +1
func (*Storage) CachedBlockMetadata ¶
func (s *Storage) CachedBlockMetadata(blockID iotago.BlockID) (*CachedMetadata, error)
CachedBlockMetadata returns a cached metadata object. meta +1
func (*Storage) CachedBlockMetadataOrNil ¶
func (s *Storage) CachedBlockMetadataOrNil(blockID iotago.BlockID) *CachedMetadata
CachedBlockMetadataOrNil returns a cached metadata object. meta +1
func (*Storage) CachedBlockOrNil ¶
func (s *Storage) CachedBlockOrNil(blockID iotago.BlockID) *CachedBlock
CachedBlockOrNil returns a cached block object. block +1
func (*Storage) CachedChildrenOfBlockID ¶
func (s *Storage) CachedChildrenOfBlockID(blockID iotago.BlockID, iteratorOptions ...IteratorOption) CachedChildren
CachedChildrenOfBlockID returns the cached children of a block. children +1
func (*Storage) CachedMilestoneByIndexOrNil ¶
func (s *Storage) CachedMilestoneByIndexOrNil(milestoneIndex iotago.MilestoneIndex) *CachedMilestone
CachedMilestoneByIndexOrNil returns a cached milestone object. milestone +1
func (*Storage) CachedMilestoneOrNil ¶
func (s *Storage) CachedMilestoneOrNil(milestoneID iotago.MilestoneID) *CachedMilestone
CachedMilestoneOrNil returns a cached milestone object. milestone +1
func (*Storage) CheckCorrectDatabasesVersion ¶
func (*Storage) CheckLedgerState ¶
CheckLedgerState checks if the total balance of the ledger fits the token supply in the protocol parameters.
func (*Storage) ChildrenBlockIDs ¶
func (s *Storage) ChildrenBlockIDs(blockID iotago.BlockID, iteratorOptions ...IteratorOption) (iotago.BlockIDs, error)
ChildrenBlockIDs returns the block IDs of the children of the given block. children +-0
func (*Storage) ChildrenStorageSize ¶
func (*Storage) ContainsBlock ¶
func (s *Storage) ContainsBlock(blockID iotago.BlockID, readOptions ...ReadOption) bool
ContainsBlock returns if the given block exists in the cache/persistence layer.
func (*Storage) ContainsChild ¶
func (s *Storage) ContainsChild(blockID iotago.BlockID, childBlockID iotago.BlockID, readOptions ...ReadOption) bool
ContainsChild returns if the given child exists in the cache/persistence layer.
func (*Storage) ContainsMilestoneIndex ¶
func (s *Storage) ContainsMilestoneIndex(milestoneIndex iotago.MilestoneIndex, readOptions ...ReadOption) bool
ContainsMilestoneIndex returns if the given milestone exists in the cache/persistence layer.
func (*Storage) CurrentProtocolParameters ¶
func (s *Storage) CurrentProtocolParameters() (*iotago.ProtocolParameters, error)
func (*Storage) DeleteBlock ¶
DeleteBlock deletes the block and metadata in the cache/persistence layer.
func (*Storage) DeleteBlockMetadata ¶
DeleteBlockMetadata deletes the metadata in the cache/persistence layer.
func (*Storage) DeleteChild ¶
DeleteChild deletes the child in the cache/persistence layer. child +-0
func (*Storage) DeleteChildren ¶
func (s *Storage) DeleteChildren(blockID iotago.BlockID, iteratorOptions ...IteratorOption)
DeleteChildren deletes the children of the given block in the cache/persistence layer. child +-0
func (*Storage) DeleteMilestone ¶
func (s *Storage) DeleteMilestone(milestoneIndex iotago.MilestoneIndex)
DeleteMilestone deletes the milestone in the cache/persistence layer. +-0
func (*Storage) DeleteUnreferencedBlocks ¶
func (s *Storage) DeleteUnreferencedBlocks(msIndex iotago.MilestoneIndex, iteratorOptions ...IteratorOption) int
DeleteUnreferencedBlocks deletes unreferenced block entries in the cache/persistence layer.
func (*Storage) FlushAndCloseStores ¶
func (*Storage) FlushBlocksStorage ¶
func (s *Storage) FlushBlocksStorage()
FlushBlocksStorage flushes the blocks storage.
func (*Storage) FlushChildrenStorage ¶
func (s *Storage) FlushChildrenStorage()
FlushChildrenStorage flushes the children storage.
func (*Storage) FlushMilestoneStorage ¶
func (s *Storage) FlushMilestoneStorage()
FlushMilestoneStorage flushes the milestones storage.
func (*Storage) FlushStorages ¶
func (s *Storage) FlushStorages()
FlushStorages flushes all storages.
func (*Storage) FlushUnreferencedBlocksStorage ¶
func (s *Storage) FlushUnreferencedBlocksStorage()
FlushUnreferencedBlocksStorage flushes the unreferenced blocks storage.
func (*Storage) ForEachBlockID ¶
func (s *Storage) ForEachBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
ForEachBlockID loops over all block IDs.
func (*Storage) ForEachBlockMetadataBlockID ¶
func (s *Storage) ForEachBlockMetadataBlockID(consumer BlockIDConsumer, iteratorOptions ...IteratorOption)
ForEachBlockMetadataBlockID loops over all block metadata block IDs.
func (*Storage) ForEachChild ¶
func (s *Storage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)
ForEachChild loops over all children.
func (*Storage) ForEachMilestoneIndex ¶
func (s *Storage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)
ForEachMilestoneIndex loops through all milestones.
func (*Storage) ForEachSolidEntryPointWithoutLocking ¶
func (s *Storage) ForEachSolidEntryPointWithoutLocking(consumer SolidEntryPointConsumer)
ForEachSolidEntryPointWithoutLocking loops over all solid entry points in the persistence layer. WriteLockSolidEntryPoints must be held while entering this function.
func (*Storage) ForEachUnreferencedBlock ¶
func (s *Storage) ForEachUnreferencedBlock(consumer UnreferencedBlockConsumer, iteratorOptions ...IteratorOption)
ForEachUnreferencedBlock loops over all unreferenced blocks.
func (*Storage) MarkDatabasesCorrupted ¶
func (*Storage) MarkDatabasesHealthy ¶
func (*Storage) MarkDatabasesTainted ¶
func (*Storage) MilestoneBlockIDByIndex ¶
func (s *Storage) MilestoneBlockIDByIndex(milestoneIndex iotago.MilestoneIndex) (iotago.BlockID, error)
MilestoneBlockIDByIndex returns the block ID of a milestone. Attention: this can be different from node to node, because only the first seen reattachment of milestone payload is stored in a node. This information should never be exposed via external API in any way.
func (*Storage) MilestoneParentsByIndex ¶
func (s *Storage) MilestoneParentsByIndex(milestoneIndex iotago.MilestoneIndex) (iotago.BlockIDs, error)
MilestoneParentsByIndex returns the parents of a milestone.
func (*Storage) MilestoneStorageSize ¶
MilestoneStorageSize returns the size of the milestone storage.
func (*Storage) MilestoneTimestampByIndex ¶
func (s *Storage) MilestoneTimestampByIndex(milestoneIndex iotago.MilestoneIndex) (time.Time, error)
MilestoneTimestampByIndex returns the timestamp of a milestone.
func (*Storage) MilestoneTimestampUnixByIndex ¶
func (s *Storage) MilestoneTimestampUnixByIndex(milestoneIndex iotago.MilestoneIndex) (uint32, error)
MilestoneTimestampUnixByIndex returns the unix timestamp of a milestone.
func (*Storage) NonCachedStorage ¶
func (s *Storage) NonCachedStorage() *NonCachedStorage
func (*Storage) PrintSnapshotInfo ¶
func (s *Storage) PrintSnapshotInfo()
func (*Storage) ReadLockSolidEntryPoints ¶
func (s *Storage) ReadLockSolidEntryPoints()
func (*Storage) ReadUnlockSolidEntryPoints ¶
func (s *Storage) ReadUnlockSolidEntryPoints()
func (*Storage) ResetSolidEntryPointsWithoutLocking ¶
func (s *Storage) ResetSolidEntryPointsWithoutLocking()
ResetSolidEntryPointsWithoutLocking resets the solid entry points. WriteLockSolidEntryPoints must be held while entering this function.
func (*Storage) SearchLatestMilestoneIndexInStore ¶
func (s *Storage) SearchLatestMilestoneIndexInStore() iotago.MilestoneIndex
SearchLatestMilestoneIndexInStore searches the latest milestone without accessing the cache layer.
func (*Storage) SetEntryPointIndex ¶
func (s *Storage) SetEntryPointIndex(entryPointIndex iotago.MilestoneIndex) error
func (*Storage) SetInitialSnapshotInfo ¶
func (s *Storage) SetInitialSnapshotInfo(genesisMilestoneIndex iotago.MilestoneIndex, snapshotIndex iotago.MilestoneIndex, entryPointIndex iotago.MilestoneIndex, pruningIndex iotago.MilestoneIndex, snapshotTimestamp time.Time) error
func (*Storage) SetPruningIndex ¶
func (s *Storage) SetPruningIndex(pruningIndex iotago.MilestoneIndex) error
func (*Storage) SetSnapshotIndex ¶
func (*Storage) Shutdown ¶
Shutdown flushes and closes all object storages, and then flushes and closes all stores.
func (*Storage) ShutdownBlocksStorage ¶
func (s *Storage) ShutdownBlocksStorage()
ShutdownBlocksStorage shuts down the blocks storage.
func (*Storage) ShutdownChildrenStorage ¶
func (s *Storage) ShutdownChildrenStorage()
ShutdownChildrenStorage shuts down the children storage.
func (*Storage) ShutdownMilestoneStorage ¶
func (s *Storage) ShutdownMilestoneStorage()
ShutdownMilestoneStorage shuts down milestones storage.
func (*Storage) ShutdownStorages ¶
func (s *Storage) ShutdownStorages()
ShutdownStorages shuts down all storages.
func (*Storage) ShutdownUnreferencedBlocksStorage ¶
func (s *Storage) ShutdownUnreferencedBlocksStorage()
ShutdownUnreferencedBlocksStorage shuts down the unreferenced blocks storage.
func (*Storage) SnapshotInfo ¶
func (s *Storage) SnapshotInfo() *SnapshotInfo
func (*Storage) SolidEntryPoints ¶
func (s *Storage) SolidEntryPoints() *SolidEntryPoints
func (*Storage) SolidEntryPointsAddWithoutLocking ¶
func (s *Storage) SolidEntryPointsAddWithoutLocking(blockID iotago.BlockID, milestoneIndex iotago.MilestoneIndex)
SolidEntryPointsAddWithoutLocking adds a block to the solid entry points. WriteLockSolidEntryPoints must be held while entering this function.
func (*Storage) SolidEntryPointsContain ¶
func (*Storage) SolidEntryPointsIndex ¶
func (s *Storage) SolidEntryPointsIndex(blockID iotago.BlockID) (iotago.MilestoneIndex, bool, error)
SolidEntryPointsIndex returns the index of a solid entry point and whether the block is a solid entry point or not.
func (*Storage) StoreBlockIfAbsent ¶
func (s *Storage) StoreBlockIfAbsent(block *Block) (cachedBlock *CachedBlock, newlyAdded bool)
StoreBlockIfAbsent returns a cached object and stores the block in the persistence layer if it was absent. block +1
func (*Storage) StoreChild ¶
func (s *Storage) StoreChild(parentBlockID iotago.BlockID, childBlockID iotago.BlockID) *CachedChild
StoreChild stores the child in the persistence layer and returns a cached object. child +1
func (*Storage) StoreMilestoneIfAbsent ¶
func (s *Storage) StoreMilestoneIfAbsent(milestonePayload *iotago.Milestone, blockID iotago.BlockID) (cachedMilestone *CachedMilestone, newlyAdded bool)
StoreMilestoneIfAbsent stores a milestone if it is not known yet. milestone +1
func (*Storage) StoreSolidEntryPointsWithoutLocking ¶
StoreSolidEntryPointsWithoutLocking stores the solid entry points in the persistence layer. WriteLockSolidEntryPoints must be held while entering this function.
func (*Storage) StoreUnreferencedBlock ¶
func (s *Storage) StoreUnreferencedBlock(msIndex iotago.MilestoneIndex, blockID iotago.BlockID) *CachedUnreferencedBlock
StoreUnreferencedBlock stores the unreferenced block in the persistence layer and returns a cached object. unreferencedBlock +1
func (*Storage) StoredMetadataOrNil ¶
func (s *Storage) StoredMetadataOrNil(blockID iotago.BlockID) *BlockMetadata
StoredMetadataOrNil returns a metadata object without accessing the cache layer.
func (*Storage) TangleStore ¶
func (*Storage) UTXOManager ¶
func (*Storage) UnreferencedBlockIDs ¶
func (s *Storage) UnreferencedBlockIDs(msIndex iotago.MilestoneIndex, iteratorOptions ...IteratorOption) iotago.BlockIDs
UnreferencedBlockIDs returns all block IDs of unreferenced blocks for that milestone.
func (*Storage) UnreferencedBlocksStorageSize ¶
func (*Storage) UpdateDatabasesVersion ¶
UpdateDatabasesVersion tries to migrate the existing data to the new database version.
func (*Storage) UpdateSnapshotInfo ¶
func (s *Storage) UpdateSnapshotInfo(snapshotIndex iotago.MilestoneIndex, entryPointIndex iotago.MilestoneIndex, pruningIndex iotago.MilestoneIndex, snapshotTimestamp time.Time) error
func (*Storage) WriteLockSolidEntryPoints ¶
func (s *Storage) WriteLockSolidEntryPoints()
func (*Storage) WriteUnlockSolidEntryPoints ¶
func (s *Storage) WriteUnlockSolidEntryPoints()
type StoreHealthTracker ¶
type StoreHealthTracker struct {
// contains filtered or unexported fields
}
func NewStoreHealthTracker ¶
func NewStoreHealthTracker(store kvstore.KVStore, dbVersion byte) (*StoreHealthTracker, error)
func (*StoreHealthTracker) CheckCorrectDatabaseVersion ¶
func (s *StoreHealthTracker) CheckCorrectDatabaseVersion() (bool, error)
func (*StoreHealthTracker) DatabaseVersion ¶
func (s *StoreHealthTracker) DatabaseVersion() (int, error)
DatabaseVersion returns the database version.
func (*StoreHealthTracker) IsCorrupted ¶
func (s *StoreHealthTracker) IsCorrupted() (bool, error)
func (*StoreHealthTracker) IsTainted ¶
func (s *StoreHealthTracker) IsTainted() (bool, error)
func (*StoreHealthTracker) MarkCorrupted ¶
func (s *StoreHealthTracker) MarkCorrupted() error
func (*StoreHealthTracker) MarkHealthy ¶
func (s *StoreHealthTracker) MarkHealthy() error
func (*StoreHealthTracker) MarkTainted ¶
func (s *StoreHealthTracker) MarkTainted() error
func (*StoreHealthTracker) UpdateDatabaseVersion ¶
func (s *StoreHealthTracker) UpdateDatabaseVersion() (bool, error)
UpdateDatabaseVersion tries to migrate the existing data to the new database version.
type UnreferencedBlock ¶
type UnreferencedBlock struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func NewUnreferencedBlock ¶
func NewUnreferencedBlock(msIndex iotago.MilestoneIndex, blockID iotago.BlockID) *UnreferencedBlock
func (*UnreferencedBlock) BlockID ¶
func (t *UnreferencedBlock) BlockID() iotago.BlockID
func (*UnreferencedBlock) LatestMilestoneIndex ¶
func (t *UnreferencedBlock) LatestMilestoneIndex() iotago.MilestoneIndex
func (*UnreferencedBlock) ObjectStorageKey ¶
func (t *UnreferencedBlock) ObjectStorageKey() []byte
func (*UnreferencedBlock) ObjectStorageValue ¶
func (t *UnreferencedBlock) ObjectStorageValue() []byte
func (*UnreferencedBlock) Update ¶
func (t *UnreferencedBlock) Update(_ objectstorage.StorableObject)
type UnreferencedBlockConsumer ¶
type UnreferencedBlockConsumer func(msIndex iotago.MilestoneIndex, blockID iotago.BlockID) bool
UnreferencedBlockConsumer consumes the given unreferenced block during looping through all unreferenced blocks. Returning false from this function indicates to abort the iteration.
Source Files ¶
- block.go
- block_metadata.go
- blocks_memcache.go
- blocks_storage.go
- child.go
- children_storage.go
- errors.go
- health.go
- health_db.go
- metadata_memcache.go
- milestones.go
- milestones_storage.go
- protocol_storage.go
- snapshot.go
- snapshot_db.go
- solid_entry_points.go
- solid_entry_points_store.go
- storage.go
- unreferenced_block.go
- unreferenced_blocks_storage.go