storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageMetadataSolid         = 0
	MessageMetadataReferenced    = 1
	MessageMetadataNoTx          = 2
	MessageMetadataConflictingTx = 3
	MessageMetadataMilestone     = 4
)
View Source
const (
	//ConflictNone the message 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

	// ConflictInvalidDustAllowance the dust allowance for the address is invalid.
	ConflictInvalidDustAllowance = 6

	// ConflictSemanticValidationFailed the semantic validation failed.
	ConflictSemanticValidationFailed = 255
)
View Source
const (
	DbVersion = 1
)
View Source
const (
	IndexationIndexLength = 64
)

Variables

View Source
var (
	ErrSolidEntryPointsAlreadyInitialized = errors.New("solidEntryPoints already initialized")
	ErrSolidEntryPointsNotInitialized     = errors.New("solidEntryPoints not initialized")
)
View Source
var (
	ErrInvalidMilestone = errors.New("invalid milestone")
)
View Source
var (
	// ErrNothingToCleanUp is returned when nothing is there to clean up in the database.
	ErrNothingToCleanUp = errors.New("Nothing to clean up in the databases")
)
View Source
var (
	ErrParseSnapshotInfoFailed = errors.New("Parsing of snapshot info failed")
)

Functions

func CheckIfIndexation

func CheckIfIndexation(msg *Message) (indexation *iotago.Indexation)

func MessageCaller

func MessageCaller(handler interface{}, params ...interface{})

func MessageIDCaller

func MessageIDCaller(handler interface{}, params ...interface{})

func MessageMetadataCaller

func MessageMetadataCaller(handler interface{}, params ...interface{})

func MessageReferencedCaller

func MessageReferencedCaller(handler interface{}, params ...interface{})

func MetadataFactory

func MetadataFactory(key []byte, data []byte) (objectstorage.StorableObject, error)

func MilestoneCaller

func MilestoneCaller(handler interface{}, params ...interface{})

func MilestoneWithRequestedCaller

func MilestoneWithRequestedCaller(handler interface{}, params ...interface{})

func NewMessageCaller

func NewMessageCaller(handler interface{}, params ...interface{})

func PadIndexationIndex

func PadIndexationIndex(index []byte) []byte

PadIndexationIndex returns a padded indexation index.

Types

type CachedChild

type CachedChild struct {
	objectstorage.CachedObject
}

func (*CachedChild) GetChild

func (c *CachedChild) GetChild() *Child

func (*CachedChild) Retain

func (c *CachedChild) Retain() *CachedChild

type CachedChildren

type CachedChildren []*CachedChild

func (CachedChildren) Release

func (cachedChildren CachedChildren) Release(force ...bool)

func (CachedChildren) Retain

func (cachedChildren CachedChildren) Retain() CachedChildren

type CachedIndexation

type CachedIndexation struct {
	objectstorage.CachedObject
}

func (*CachedIndexation) GetIndexation

func (c *CachedIndexation) GetIndexation() *Indexation

type CachedIndexationConsumer

type CachedIndexationConsumer func(indexation *CachedIndexation) bool

CachedIndexationConsumer consumes the given indexation during looping through all indexations.

type CachedMessage

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

CachedMessage contains two cached objects, one for message data and one for metadata.

func (*CachedMessage) ConsumeMessage

func (c *CachedMessage) ConsumeMessage(consumer func(*Message))

msg -1 meta -1

func (*CachedMessage) ConsumeMessageAndMetadata

func (c *CachedMessage) ConsumeMessageAndMetadata(consumer func(*Message, *MessageMetadata))

msg -1 meta -1

func (*CachedMessage) ConsumeMetadata

func (c *CachedMessage) ConsumeMetadata(consumer func(*MessageMetadata))

msg -1 meta -1

func (*CachedMessage) Exists

func (c *CachedMessage) Exists() bool

func (*CachedMessage) GetCachedMetadata

func (c *CachedMessage) GetCachedMetadata() *CachedMetadata

meta +1

func (*CachedMessage) GetMessage

func (c *CachedMessage) GetMessage() *Message

func (*CachedMessage) GetMetadata

func (c *CachedMessage) GetMetadata() *MessageMetadata

func (*CachedMessage) Release

func (c *CachedMessage) Release(force ...bool)

msg -1

func (*CachedMessage) Retain

func (c *CachedMessage) Retain() *CachedMessage

msg +1

type CachedMessages

type CachedMessages []*CachedMessage

func (CachedMessages) Release

func (cachedMsgs CachedMessages) Release(force ...bool)

msg -1

func (CachedMessages) Retain

func (cachedMsgs CachedMessages) Retain() CachedMessages

msg +1

type CachedMetadata

type CachedMetadata struct {
	objectstorage.CachedObject
}

CachedMetadata contains the cached object only for metadata.

func (*CachedMetadata) ConsumeMetadata

func (c *CachedMetadata) ConsumeMetadata(consumer func(*MessageMetadata))

meta -1

func (*CachedMetadata) GetMetadata

func (c *CachedMetadata) GetMetadata() *MessageMetadata

func (*CachedMetadata) Retain

func (c *CachedMetadata) Retain() *CachedMetadata

type CachedMilestone

type CachedMilestone struct {
	objectstorage.CachedObject
}

Cached Object

func (*CachedMilestone) GetMilestone

func (c *CachedMilestone) GetMilestone() *Milestone

func (*CachedMilestone) Retain

func (c *CachedMilestone) Retain() *CachedMilestone

milestone +1

type CachedMilestones

type CachedMilestones []*CachedMilestone

func (CachedMilestones) Release

func (c CachedMilestones) Release(force ...bool)

milestone -1

func (CachedMilestones) Retain

milestone +1

type CachedUnreferencedMessage

type CachedUnreferencedMessage struct {
	objectstorage.CachedObject
}

func (*CachedUnreferencedMessage) GetUnreferencedMessage

func (c *CachedUnreferencedMessage) GetUnreferencedMessage() *UnreferencedMessage

type CachedUnreferencedMessages

type CachedUnreferencedMessages []*CachedUnreferencedMessage

func (CachedUnreferencedMessages) Release

func (cachedUnreferencedMessages CachedUnreferencedMessages) Release(force ...bool)

type Child

type Child struct {
	objectstorage.StorableObjectFlags
	// contains filtered or unexported fields
}

func NewChild

func NewChild(parentMessageID hornet.MessageID, childMessageId hornet.MessageID) *Child

func (*Child) GetChildMessageID

func (a *Child) GetChildMessageID() hornet.MessageID

func (*Child) GetParentMessageID

func (a *Child) GetParentMessageID() hornet.MessageID

func (*Child) ObjectStorageKey

func (a *Child) ObjectStorageKey() []byte

func (*Child) ObjectStorageValue

func (a *Child) ObjectStorageValue() (_ []byte)

func (*Child) Update

func (a *Child) Update(_ objectstorage.StorableObject)

type ChildConsumer

type ChildConsumer func(messageID hornet.MessageID, childMessageID hornet.MessageID) bool

ChildConsumer consumes the given child during looping through all children.

type Conflict

type Conflict uint8

Conflict defines the reason why a message is marked as conflicting.

type CoordinatorPublicKey

type CoordinatorPublicKey struct {
	StartIndex milestone.Index
	EndIndex   milestone.Index
	PublicKey  ed25519.PublicKey
}

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 IndexConsumer

type IndexConsumer func(messageID hornet.MessageID) bool

IndexConsumer consumes the messageID during looping through all messages with given index.

type Indexation

type Indexation struct {
	objectstorage.StorableObjectFlags
	// contains filtered or unexported fields
}

func NewIndexation

func NewIndexation(index []byte, messageID hornet.MessageID) *Indexation

func (*Indexation) GetHash

func (i *Indexation) GetHash() hornet.MessageID

func (*Indexation) GetMessageID

func (i *Indexation) GetMessageID() hornet.MessageID

func (*Indexation) ObjectStorageKey

func (i *Indexation) ObjectStorageKey() []byte

func (*Indexation) ObjectStorageValue

func (i *Indexation) ObjectStorageValue() (_ []byte)

func (*Indexation) Update

type IteratorOption

type IteratorOption = objectstorage.IteratorOption

type Message

type Message struct {
	objectstorage.StorableObjectFlags
	// contains filtered or unexported fields
}

Storable Object

func MessageFromBytes

func MessageFromBytes(data []byte, deSeriMode iotago.DeSerializationMode) (*Message, error)

func NewMessage

func NewMessage(iotaMsg *iotago.Message, deSeriMode iotago.DeSerializationMode) (*Message, error)

func (*Message) GetData

func (msg *Message) GetData() []byte

func (*Message) GetIndexation

func (msg *Message) GetIndexation() *iotago.Indexation

func (*Message) GetMessage

func (msg *Message) GetMessage() *iotago.Message

func (*Message) GetMessageID

func (msg *Message) GetMessageID() hornet.MessageID

func (*Message) GetMilestone

func (msg *Message) GetMilestone() (ms *iotago.Milestone)

func (*Message) GetNetworkID

func (msg *Message) GetNetworkID() uint64

func (*Message) GetParents

func (msg *Message) GetParents() hornet.MessageIDs

func (*Message) GetSignatureForInputIndex

func (msg *Message) GetSignatureForInputIndex(inputIndex uint16) *iotago.Ed25519Signature

func (*Message) GetTransaction

func (msg *Message) GetTransaction() *iotago.Transaction

func (*Message) GetTransactionEssence

func (msg *Message) GetTransactionEssence() *iotago.TransactionEssence

func (*Message) GetTransactionEssenceIndexation

func (msg *Message) GetTransactionEssenceIndexation() *iotago.Indexation

func (*Message) GetTransactionEssenceUTXOInputs

func (msg *Message) GetTransactionEssenceUTXOInputs() []*iotago.UTXOInputID

func (*Message) IsMilestone

func (msg *Message) IsMilestone() bool

func (*Message) IsTransaction

func (msg *Message) IsTransaction() bool

func (*Message) ObjectStorageKey

func (msg *Message) ObjectStorageKey() []byte

func (*Message) ObjectStorageValue

func (msg *Message) ObjectStorageValue() (_ []byte)

func (*Message) Update

func (msg *Message) Update(_ objectstorage.StorableObject)

type MessageIDConsumer

type MessageIDConsumer func(messageID hornet.MessageID) bool

MessageIDConsumer consumes the given message ID during looping through all messages.

type MessageMetadata

type MessageMetadata struct {
	objectstorage.StorableObjectFlags
	syncutils.RWMutex
	// contains filtered or unexported fields
}

func (*MessageMetadata) GetConeRootIndexes

func (m *MessageMetadata) GetConeRootIndexes() (ycri milestone.Index, ocri milestone.Index, ci milestone.Index)

func (*MessageMetadata) GetConflict

func (m *MessageMetadata) GetConflict() Conflict

func (*MessageMetadata) GetMessageID

func (m *MessageMetadata) GetMessageID() hornet.MessageID

func (*MessageMetadata) GetMetadata

func (m *MessageMetadata) GetMetadata() byte

func (*MessageMetadata) GetParents

func (m *MessageMetadata) GetParents() hornet.MessageIDs

func (*MessageMetadata) GetReferenced

func (m *MessageMetadata) GetReferenced() (bool, milestone.Index)

func (*MessageMetadata) GetSolidificationTimestamp

func (m *MessageMetadata) GetSolidificationTimestamp() int32

func (*MessageMetadata) IsConflictingTx

func (m *MessageMetadata) IsConflictingTx() bool

func (*MessageMetadata) IsIncludedTxInLedger

func (m *MessageMetadata) IsIncludedTxInLedger() bool

func (*MessageMetadata) IsMilestone

func (m *MessageMetadata) IsMilestone() bool

func (*MessageMetadata) IsNoTransaction

func (m *MessageMetadata) IsNoTransaction() bool

func (*MessageMetadata) IsReferenced

func (m *MessageMetadata) IsReferenced() bool

func (*MessageMetadata) IsSolid

func (m *MessageMetadata) IsSolid() bool

func (*MessageMetadata) ObjectStorageKey

func (m *MessageMetadata) ObjectStorageKey() []byte

func (*MessageMetadata) ObjectStorageValue

func (m *MessageMetadata) ObjectStorageValue() (data []byte)

func (*MessageMetadata) SetConeRootIndexes

func (m *MessageMetadata) SetConeRootIndexes(ycri milestone.Index, ocri milestone.Index, ci milestone.Index)

func (*MessageMetadata) SetConflictingTx

func (m *MessageMetadata) SetConflictingTx(conflict Conflict)

func (*MessageMetadata) SetIsNoTransaction

func (m *MessageMetadata) SetIsNoTransaction(noTx bool)

func (*MessageMetadata) SetMilestone

func (m *MessageMetadata) SetMilestone(milestone bool)

func (*MessageMetadata) SetReferenced

func (m *MessageMetadata) SetReferenced(referenced bool, referencedIndex milestone.Index)

func (*MessageMetadata) SetSolid

func (m *MessageMetadata) SetSolid(solid bool)

func (*MessageMetadata) Update

type MessagesMemcache

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

func NewMessagesMemcache

func NewMessagesMemcache(storage *Storage) *MessagesMemcache

NewMessagesMemcache creates a new MessagesMemcache instance.

func (*MessagesMemcache) Cleanup

func (c *MessagesMemcache) Cleanup(forceRelease bool)

Cleanup releases all the cached objects that have been used. This MUST be called by the user at the end.

func (*MessagesMemcache) GetCachedMessageOrNil

func (c *MessagesMemcache) GetCachedMessageOrNil(messageID hornet.MessageID) *CachedMessage

msg +1

type MetadataMemcache

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

func NewMetadataMemcache

func NewMetadataMemcache(storage *Storage) *MetadataMemcache

NewMetadataMemcache creates a new NewMetadataMemcache instance.

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.

func (*MetadataMemcache) GetCachedMetadataOrNil

func (c *MetadataMemcache) GetCachedMetadataOrNil(messageID hornet.MessageID) *CachedMetadata

metadata +1

type Milestone

type Milestone struct {
	objectstorage.StorableObjectFlags

	Index     milestone.Index
	MessageID hornet.MessageID
	Timestamp time.Time
}

Storable Object

func (*Milestone) ObjectStorageKey

func (ms *Milestone) ObjectStorageKey() []byte

func (*Milestone) ObjectStorageValue

func (ms *Milestone) ObjectStorageValue() (data []byte)

func (*Milestone) Update

func (ms *Milestone) Update(_ objectstorage.StorableObject)

type MilestoneIndexConsumer

type MilestoneIndexConsumer func(index milestone.Index) bool

MilestoneIndexConsumer consumes the given index during looping through all milestones.

type ReadOption

type ReadOption = objectstorage.ReadOption

type SnapshotInfo

type SnapshotInfo struct {
	NetworkID       uint64
	SnapshotIndex   milestone.Index
	EntryPointIndex milestone.Index
	PruningIndex    milestone.Index
	Timestamp       time.Time
	Metadata        bitmask.BitMask
}

func SnapshotInfoFromBytes

func SnapshotInfoFromBytes(bytes []byte) (*SnapshotInfo, error)

func (*SnapshotInfo) GetBytes

func (i *SnapshotInfo) GetBytes() []byte

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(messageID hornet.MessageID, milestoneIndex milestone.Index)

func (*SolidEntryPoints) Clear

func (s *SolidEntryPoints) Clear()

func (*SolidEntryPoints) Contains

func (s *SolidEntryPoints) Contains(messageID hornet.MessageID) bool

func (*SolidEntryPoints) GetBytes

func (s *SolidEntryPoints) GetBytes() []byte

func (*SolidEntryPoints) Hashes

func (s *SolidEntryPoints) Hashes() hornet.MessageIDs

func (*SolidEntryPoints) Index

func (s *SolidEntryPoints) Index(messageID hornet.MessageID) (milestone.Index, bool)

func (*SolidEntryPoints) IsModified

func (s *SolidEntryPoints) IsModified() bool

func (*SolidEntryPoints) SetModified

func (s *SolidEntryPoints) SetModified(modified bool)

type Storage

type Storage struct {

	// events
	Events *packageEvents
	// contains filtered or unexported fields
}

func New

func New(databaseDirectory string, store kvstore.KVStore, cachesProfile *profile.Caches, belowMaxDepth int, keyManager *keymanager.KeyManager, milestonePublicKeyCount int) *Storage

func (*Storage) AddMessageToStorage

func (s *Storage) AddMessageToStorage(message *Message, latestMilestoneIndex milestone.Index, requested bool, forceRelease bool, reapply bool) (cachedMessage *CachedMessage, alreadyAdded bool)

msg +1

func (*Storage) CleanupDatabases

func (s *Storage) CleanupDatabases() error

func (*Storage) ContainsChild

func (s *Storage) ContainsChild(messageID hornet.MessageID, childMessageID hornet.MessageID, readOptions ...ReadOption) bool

ContainsChild returns if the given child exists in the cache/persistence layer.

func (*Storage) ContainsMessage

func (s *Storage) ContainsMessage(messageID hornet.MessageID, readOptions ...ReadOption) bool

ContainsMessage returns if the given message exists in the cache/persistence layer.

func (*Storage) ContainsMilestone

func (s *Storage) ContainsMilestone(milestoneIndex milestone.Index, readOptions ...ReadOption) bool

milestone +-0

func (*Storage) DatabaseSupportsCleanup

func (s *Storage) DatabaseSupportsCleanup() bool

func (*Storage) DeleteChild

func (s *Storage) DeleteChild(messageID hornet.MessageID, childMessageID hornet.MessageID)

child +-0

func (*Storage) DeleteChildren

func (s *Storage) DeleteChildren(messageID hornet.MessageID, iteratorOptions ...IteratorOption)

child +-0

func (*Storage) DeleteIndexation

func (s *Storage) DeleteIndexation(index []byte, messageID hornet.MessageID)

indexation +-0

func (*Storage) DeleteIndexationByKey

func (s *Storage) DeleteIndexationByKey(key []byte)

indexation +-0

func (*Storage) DeleteMessage

func (s *Storage) DeleteMessage(messageID hornet.MessageID)

DeleteMessage deletes the message and metadata in the cache/persistence layer.

func (*Storage) DeleteMessageMetadata

func (s *Storage) DeleteMessageMetadata(messageID hornet.MessageID)

DeleteMessageMetadata deletes the metadata in the cache/persistence layer.

func (*Storage) DeleteMilestone

func (s *Storage) DeleteMilestone(milestoneIndex milestone.Index)

+-0

func (*Storage) DeleteUnreferencedMessages

func (s *Storage) DeleteUnreferencedMessages(msIndex milestone.Index, iteratorOptions ...IteratorOption) int

DeleteUnreferencedMessages deletes unreferenced message entries.

func (*Storage) FindClosestNextMilestoneOrNil

func (s *Storage) FindClosestNextMilestoneOrNil(index milestone.Index) *CachedMilestone

message +1

func (*Storage) FlushChildrenStorage

func (s *Storage) FlushChildrenStorage()

func (*Storage) FlushIndexationStorage

func (s *Storage) FlushIndexationStorage()

func (*Storage) FlushMessagesStorage

func (s *Storage) FlushMessagesStorage()

func (*Storage) FlushMilestoneStorage

func (s *Storage) FlushMilestoneStorage()

func (*Storage) FlushStorages

func (s *Storage) FlushStorages()

func (*Storage) FlushUnreferencedMessagesStorage

func (s *Storage) FlushUnreferencedMessagesStorage()

func (*Storage) ForEachChild

func (s *Storage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)

ForEachChild loops over all children.

func (*Storage) ForEachIndexation

func (s *Storage) ForEachIndexation(consumer CachedIndexationConsumer, iteratorOptions ...IteratorOption)

ForEachIndexation loops over all indexations. indexation +1

func (*Storage) ForEachMessageID

func (s *Storage) ForEachMessageID(consumer MessageIDConsumer, iteratorOptions ...IteratorOption)

ForEachMessageID loops over all message IDs.

func (*Storage) ForEachMessageIDWithIndex

func (s *Storage) ForEachMessageIDWithIndex(index []byte, consumer IndexConsumer, iteratorOptions ...IteratorOption)

ForEachMessageIDWithIndex loops over all messages with the given index.

func (*Storage) ForEachMessageMetadataMessageID

func (s *Storage) ForEachMessageMetadataMessageID(consumer MessageIDConsumer, iteratorOptions ...IteratorOption)

ForEachMessageMetadataMessageID loops over all message metadata message IDs.

func (*Storage) ForEachMilestoneIndex

func (s *Storage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)

ForEachMilestoneIndex loops through all milestones.

func (*Storage) ForEachUnreferencedMessage

func (s *Storage) ForEachUnreferencedMessage(consumer UnreferencedMessageConsumer, iteratorOptions ...IteratorOption)

ForEachUnreferencedMessage loops over all unreferenced messages.

func (*Storage) GetCachedChildrenOfMessageID

func (s *Storage) GetCachedChildrenOfMessageID(messageID hornet.MessageID, iteratorOptions ...IteratorOption) CachedChildren

GetCachedChildrenOfMessageID returns the cached children of a message. children +1

func (*Storage) GetCachedMessageMetadataOrNil

func (s *Storage) GetCachedMessageMetadataOrNil(messageID hornet.MessageID) *CachedMetadata

metadata +1

func (*Storage) GetCachedMessageOrNil

func (s *Storage) GetCachedMessageOrNil(messageID hornet.MessageID) *CachedMessage

msg +1

func (*Storage) GetCachedMilestoneOrNil

func (s *Storage) GetCachedMilestoneOrNil(milestoneIndex milestone.Index) *CachedMilestone

milestone +1

func (*Storage) GetChildrenMessageIDs

func (s *Storage) GetChildrenMessageIDs(messageID hornet.MessageID, iteratorOptions ...IteratorOption) hornet.MessageIDs

children +-0

func (*Storage) GetChildrenStorageSize

func (s *Storage) GetChildrenStorageSize() int

func (*Storage) GetConfirmedMilestoneIndex

func (s *Storage) GetConfirmedMilestoneIndex() milestone.Index

GetConfirmedMilestoneIndex returns the confirmed milestone index.

func (*Storage) GetDatabaseSize

func (s *Storage) GetDatabaseSize() (int64, error)

GetDatabaseSize returns the size of the database.

func (*Storage) GetIndexMessageIDs

func (s *Storage) GetIndexMessageIDs(index []byte, iteratorOptions ...IteratorOption) hornet.MessageIDs

indexation +-0

func (*Storage) GetIndexationStorageSize

func (s *Storage) GetIndexationStorageSize() int

func (*Storage) GetLatestMilestoneIndex

func (s *Storage) GetLatestMilestoneIndex() milestone.Index

GetLatestMilestoneIndex returns the latest milestone index.

func (*Storage) GetMessageMetadataStorageSize

func (s *Storage) GetMessageMetadataStorageSize() int

func (*Storage) GetMessageStorageSize

func (s *Storage) GetMessageStorageSize() int

func (*Storage) GetMilestoneCachedMessageOrNil

func (s *Storage) GetMilestoneCachedMessageOrNil(milestoneIndex milestone.Index) *CachedMessage

GetMilestoneOrNil returns the CachedMessage of a milestone index or nil if it doesn't exist. message +1

func (*Storage) GetMilestoneStorageSize

func (s *Storage) GetMilestoneStorageSize() int

func (*Storage) GetSnapshotInfo

func (s *Storage) GetSnapshotInfo() *SnapshotInfo

func (*Storage) GetStoredMetadataOrNil

func (s *Storage) GetStoredMetadataOrNil(messageID hornet.MessageID) *MessageMetadata

GetStoredMetadataOrNil returns a metadata object without accessing the cache layer.

func (*Storage) GetUnreferencedMessageIDs

func (s *Storage) GetUnreferencedMessageIDs(msIndex milestone.Index, iteratorOptions ...IteratorOption) hornet.MessageIDs

GetUnreferencedMessageIDs returns all message IDs of unreferenced messages for that milestone.

func (*Storage) GetUnreferencedMessageStorageSize

func (s *Storage) GetUnreferencedMessageStorageSize() int

func (*Storage) IsCorrectDatabaseVersion

func (s *Storage) IsCorrectDatabaseVersion() bool

func (*Storage) IsDatabaseCorrupted

func (s *Storage) IsDatabaseCorrupted() bool

func (*Storage) IsDatabaseTainted

func (s *Storage) IsDatabaseTainted() bool

func (*Storage) IsNodeAlmostSynced

func (s *Storage) IsNodeAlmostSynced() bool

IsNodeAlmostSynced returns whether the node is synced within "isNodeAlmostSyncedThreshold".

func (*Storage) IsNodeSynced

func (s *Storage) IsNodeSynced() bool

IsNodeSynced returns whether the node is synced.

func (*Storage) IsNodeSyncedWithThreshold

func (s *Storage) IsNodeSyncedWithThreshold(threshold milestone.Index) bool

IsNodeSyncedWithThreshold returns whether the node is synced within a given threshold.

func (*Storage) IsNodeSyncedWithinBelowMaxDepth

func (s *Storage) IsNodeSyncedWithinBelowMaxDepth() bool

IsNodeSyncedWithinBelowMaxDepth returns whether the node is synced within "belowMaxDepth".

func (*Storage) KVStore

func (s *Storage) KVStore() kvstore.KVStore

func (*Storage) KeyManager

func (s *Storage) KeyManager() *keymanager.KeyManager

func (*Storage) MarkDatabaseCorrupted

func (s *Storage) MarkDatabaseCorrupted()

func (*Storage) MarkDatabaseHealthy

func (s *Storage) MarkDatabaseHealthy()

func (*Storage) MarkDatabaseTainted

func (s *Storage) MarkDatabaseTainted()

func (*Storage) MessageExistsInStore

func (s *Storage) MessageExistsInStore(messageID hornet.MessageID) bool

MessageExistsInStore returns if the given message exists in the persistence layer.

func (*Storage) MessageMetadataExistsInStore

func (s *Storage) MessageMetadataExistsInStore(messageID hornet.MessageID) bool

MessageMetadataExistsInStore returns if the given message metadata exists in the persistence layer.

func (*Storage) OverwriteConfirmedMilestoneIndex

func (s *Storage) OverwriteConfirmedMilestoneIndex(index milestone.Index)

OverwriteConfirmedMilestoneIndex is used to set older confirmed milestones (revalidation).

func (*Storage) ReadLockSolidEntryPoints

func (s *Storage) ReadLockSolidEntryPoints()

func (*Storage) ReadUnlockSolidEntryPoints

func (s *Storage) ReadUnlockSolidEntryPoints()

func (*Storage) ResetMilestoneIndexes

func (s *Storage) ResetMilestoneIndexes()

func (*Storage) ResetSolidEntryPoints

func (s *Storage) ResetSolidEntryPoints()

WriteLockSolidEntryPoints must be held while entering this function

func (*Storage) SearchLatestMilestoneIndexInStore

func (s *Storage) SearchLatestMilestoneIndexInStore() milestone.Index

SearchLatestMilestoneIndexInStore searches the latest milestone without accessing the cache layer.

func (*Storage) SetConfirmedMilestoneIndex

func (s *Storage) SetConfirmedMilestoneIndex(index milestone.Index, updateSynced ...bool)

SetConfirmedMilestoneIndex sets the confirmed milestone index.

func (*Storage) SetLatestMilestoneIndex

func (s *Storage) SetLatestMilestoneIndex(index milestone.Index, updateSynced ...bool) bool

SetLatestMilestoneIndex sets the latest milestone index.

func (*Storage) SetSnapshotInfo

func (s *Storage) SetSnapshotInfo(sn *SnapshotInfo)

func (*Storage) SetSnapshotMilestone

func (s *Storage) SetSnapshotMilestone(networkID uint64, snapshotIndex milestone.Index, entryPointIndex milestone.Index, pruningIndex milestone.Index, timestamp time.Time)

func (*Storage) ShutdownChildrenStorage

func (s *Storage) ShutdownChildrenStorage()

func (*Storage) ShutdownIndexationStorage

func (s *Storage) ShutdownIndexationStorage()

func (*Storage) ShutdownMessagesStorage

func (s *Storage) ShutdownMessagesStorage()

func (*Storage) ShutdownMilestoneStorage

func (s *Storage) ShutdownMilestoneStorage()

func (*Storage) ShutdownStorages

func (s *Storage) ShutdownStorages()

func (*Storage) ShutdownUnreferencedMessagesStorage

func (s *Storage) ShutdownUnreferencedMessagesStorage()

func (*Storage) SolidEntryPointsAdd

func (s *Storage) SolidEntryPointsAdd(messageID hornet.MessageID, milestoneIndex milestone.Index)

WriteLockSolidEntryPoints must be held while entering this function

func (*Storage) SolidEntryPointsContain

func (s *Storage) SolidEntryPointsContain(messageID hornet.MessageID) bool

func (*Storage) SolidEntryPointsIndex

func (s *Storage) SolidEntryPointsIndex(messageID hornet.MessageID) (milestone.Index, bool)

func (*Storage) StoreChild

func (s *Storage) StoreChild(parentMessageID hornet.MessageID, childMessageID hornet.MessageID) *CachedChild

child +1

func (*Storage) StoreIndexation

func (s *Storage) StoreIndexation(index []byte, messageID hornet.MessageID) *CachedIndexation

indexation +1

func (*Storage) StoreMessageIfAbsent

func (s *Storage) StoreMessageIfAbsent(message *Message) (cachedMsg *CachedMessage, newlyAdded bool)

msg +1

func (*Storage) StoreMilestone

func (s *Storage) StoreMilestone(cachedMessage *CachedMessage, ms *iotago.Milestone, requested bool)

StoreMilestone stores the milestone in the storage layer and triggers the ReceivedValidMilestone event.

func (*Storage) StoreSolidEntryPoints

func (s *Storage) StoreSolidEntryPoints()

WriteLockSolidEntryPoints must be held while entering this function

func (*Storage) StoreUnreferencedMessage

func (s *Storage) StoreUnreferencedMessage(msIndex milestone.Index, messageID hornet.MessageID) *CachedUnreferencedMessage

unreferencedTx +1

func (*Storage) UTXO

func (s *Storage) UTXO() *utxo.Manager

func (*Storage) UpdateDatabaseVersion

func (s *Storage) UpdateDatabaseVersion() bool

UpdateDatabaseVersion tries to migrate the existing data to the new database version.

func (*Storage) VerifyMilestone

func (s *Storage) VerifyMilestone(message *Message) *iotago.Milestone

VerifyMilestone checks if the message contains a valid milestone payload. Returns a milestone payload if the signature is valid.

func (*Storage) WaitForNodeSynced

func (s *Storage) WaitForNodeSynced(timeout time.Duration) bool

WaitForNodeSynced waits at most "timeout" duration for the node to become fully sync. if it is not at least synced within threshold, it will return false immediately. this is used to avoid small glitches of IsNodeSynced when the sync state is important, but a new milestone came in lately.

func (*Storage) WriteLockSolidEntryPoints

func (s *Storage) WriteLockSolidEntryPoints()

func (*Storage) WriteUnlockSolidEntryPoints

func (s *Storage) WriteUnlockSolidEntryPoints()

type UnreferencedMessage

type UnreferencedMessage struct {
	objectstorage.StorableObjectFlags
	// contains filtered or unexported fields
}

func NewUnreferencedMessage

func NewUnreferencedMessage(msIndex milestone.Index, messageID hornet.MessageID) *UnreferencedMessage

func (*UnreferencedMessage) GetLatestMilestoneIndex

func (t *UnreferencedMessage) GetLatestMilestoneIndex() milestone.Index

func (*UnreferencedMessage) GetMessageID

func (t *UnreferencedMessage) GetMessageID() hornet.MessageID

func (*UnreferencedMessage) ObjectStorageKey

func (t *UnreferencedMessage) ObjectStorageKey() []byte

func (*UnreferencedMessage) ObjectStorageValue

func (t *UnreferencedMessage) ObjectStorageValue() (_ []byte)

func (*UnreferencedMessage) Update

type UnreferencedMessageConsumer

type UnreferencedMessageConsumer func(msIndex milestone.Index, messageID hornet.MessageID) bool

UnreferencedMessageConsumer consumes the given unreferenced message during looping through all unreferenced messages.

Jump to

Keyboard shortcuts

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