storage

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 22 Imported by: 3

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 (
	ErrMilestoneNotFound = errors.New("milestone not found")
)
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 MessageFactory

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

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 ObjectStorageIteratorOptions

func ObjectStorageIteratorOptions(iteratorOptions ...IteratorOption) []objectstorage.IteratorOption

func PadIndexationIndex

func PadIndexationIndex(index []byte) []byte

PadIndexationIndex returns a padded indexation index.

Types

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 CachedIndexation

type CachedIndexation struct {
	objectstorage.CachedObject
}

CachedIndexation represents a cached indexation.

func (*CachedIndexation) Indexation

func (c *CachedIndexation) Indexation() *Indexation

Indexation retrieves the indexation, that is cached in this container.

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) CachedMetadata

func (c *CachedMessage) CachedMetadata() *CachedMetadata

CachedMetadata returns the underlying cached metadata. meta +1

func (*CachedMessage) ConsumeMessage

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

ConsumeMessage consumes the underlying message. message -1 meta -1

func (*CachedMessage) ConsumeMessageAndMetadata

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

ConsumeMessageAndMetadata consumes the underlying message and metadata. message -1 meta -1

func (*CachedMessage) ConsumeMetadata

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

ConsumeMetadata consumes the underlying metadata. message -1 meta -1

func (*CachedMessage) Exists

func (c *CachedMessage) Exists() bool

Exists returns true if the message in this container does exist (could be found in the database and was not marked as deleted).

func (*CachedMessage) Message

func (c *CachedMessage) Message() *Message

Message retrieves the message, that is cached in this container.

func (*CachedMessage) Metadata

func (c *CachedMessage) Metadata() *MessageMetadata

Metadata retrieves the metadata, that is cached in this container.

func (*CachedMessage) Release

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

Release releases the cached message and metadata, to be picked up by the persistence layer (as soon as all consumers are done). message -1

func (*CachedMessage) Retain

func (c *CachedMessage) Retain() *CachedMessage

Retain registers a new consumer for the cached message and metadata. message +1

type CachedMessageFunc

type CachedMessageFunc func(messageID hornet.MessageID) (*CachedMessage, error)

type CachedMessageMetadataFunc

type CachedMessageMetadataFunc func(messageID hornet.MessageID) (*CachedMetadata, error)

type CachedMessages

type CachedMessages []*CachedMessage

func (CachedMessages) Release

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

Release releases the cached messages, to be picked up by the persistence layer (as soon as all consumers are done). message -1

func (CachedMessages) Retain

func (cachedMsgs CachedMessages) Retain() CachedMessages

Retain registers a new consumer for the cached messages. message +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(*MessageMetadata))

ConsumeMetadata consumes the metadata. meta -1

func (*CachedMetadata) Metadata

func (c *CachedMetadata) Metadata() *MessageMetadata

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

Retain registers a new consumer for the cached milestones. milestone +1

type CachedUnreferencedMessage

type CachedUnreferencedMessage struct {
	objectstorage.CachedObject
}

CachedUnreferencedMessage represents a cached unreferenced message.

func (*CachedUnreferencedMessage) UnreferencedMessage

func (c *CachedUnreferencedMessage) UnreferencedMessage() *UnreferencedMessage

UnreferencedMessage retrieves the unreferenced message, that is cached in this container.

type CachedUnreferencedMessages

type CachedUnreferencedMessages []*CachedUnreferencedMessage

func (CachedUnreferencedMessages) Release

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

Release releases the cached unreferenced messages, 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 NewChild

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

func (*Child) ChildMessageID

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

func (*Child) ObjectStorageKey

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

func (*Child) ObjectStorageValue

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

func (*Child) ParentMessageID

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

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 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) Index

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

func (*Indexation) MessageID

func (i *Indexation) MessageID() 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 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 MessageID.

func (LexicalOrderedSolidEntryPoints) Len

func (LexicalOrderedSolidEntryPoints) Less

func (LexicalOrderedSolidEntryPoints) Swap

func (l LexicalOrderedSolidEntryPoints) Swap(i, j int)

type Message

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

func MessageFromBytes

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

func NewMessage

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

func (*Message) Data

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

func (*Message) Indexation

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

func (*Message) IsMilestone

func (msg *Message) IsMilestone() bool

func (*Message) IsTransaction

func (msg *Message) IsTransaction() bool

func (*Message) Message

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

func (*Message) MessageID

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

func (*Message) Milestone

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

func (*Message) NetworkID

func (msg *Message) NetworkID() uint64

func (*Message) ObjectStorageKey

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

func (*Message) ObjectStorageValue

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

func (*Message) Parents

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

func (*Message) SignatureForInputIndex

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

func (*Message) Transaction

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

func (*Message) TransactionEssence

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

func (*Message) TransactionEssenceIndexation

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

func (*Message) TransactionEssenceUTXOInputs

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

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 NewMessageMetadata

func NewMessageMetadata(messageID hornet.MessageID, parents hornet.MessageIDs) *MessageMetadata

func (*MessageMetadata) ConeRootIndexes

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

func (*MessageMetadata) Conflict

func (m *MessageMetadata) Conflict() Conflict

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) MessageID

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

func (*MessageMetadata) Metadata

func (m *MessageMetadata) Metadata() byte

func (*MessageMetadata) ObjectStorageKey

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

func (*MessageMetadata) ObjectStorageValue

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

func (*MessageMetadata) Parents

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

func (*MessageMetadata) ReferencedWithIndex

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

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) SolidificationTimestamp

func (m *MessageMetadata) SolidificationTimestamp() int32

func (*MessageMetadata) Update

type MessagesMemcache

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

func NewMessagesMemcache

func NewMessagesMemcache(cachedMessageFunc CachedMessageFunc) *MessagesMemcache

NewMessagesMemcache creates a new MessagesMemcache instance.

func (*MessagesMemcache) CachedMessage

func (c *MessagesMemcache) CachedMessage(messageID hornet.MessageID) (*CachedMessage, error)

CachedMessage returns a cached message object. message +1

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.

type MetadataMemcache

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

func NewMetadataMemcache

func NewMetadataMemcache(cachedMessageMetadataFunc CachedMessageMetadataFunc) *MetadataMemcache

NewMetadataMemcache creates a new NewMetadataMemcache instance.

func (*MetadataMemcache) CachedMessageMetadata

func (c *MetadataMemcache) CachedMessageMetadata(messageID hornet.MessageID) (*CachedMetadata, error)

CachedMessageMetadata 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

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

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 NonCachedStorage

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

NonCachedStorage is a Storage without a cache.

func (*NonCachedStorage) ForEachChild

func (ns *NonCachedStorage) ForEachChild(consumer ChildConsumer, iteratorOptions ...IteratorOption)

ForEachChild loops over all children.

func (*NonCachedStorage) ForEachIndexation

func (ns *NonCachedStorage) ForEachIndexation(consumer CachedIndexationConsumer, iteratorOptions ...IteratorOption)

ForEachIndexation loops over all indexations. indexation +1

func (*NonCachedStorage) ForEachMessageID

func (ns *NonCachedStorage) ForEachMessageID(consumer MessageIDConsumer, iteratorOptions ...IteratorOption)

ForEachMessageID loops over all message IDs.

func (*NonCachedStorage) ForEachMessageMetadataMessageID

func (ns *NonCachedStorage) ForEachMessageMetadataMessageID(consumer MessageIDConsumer, iteratorOptions ...IteratorOption)

ForEachMessageMetadataMessageID loops over all message metadata message IDs.

func (*NonCachedStorage) ForEachMilestoneIndex

func (ns *NonCachedStorage) ForEachMilestoneIndex(consumer MilestoneIndexConsumer, iteratorOptions ...IteratorOption)

ForEachMilestoneIndex loops through all milestones.

func (*NonCachedStorage) ForEachUnreferencedMessage

func (ns *NonCachedStorage) ForEachUnreferencedMessage(consumer UnreferencedMessageConsumer, iteratorOptions ...IteratorOption)

ForEachUnreferencedMessage loops over all unreferenced messages.

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) Bytes

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

type SolidEntryPoint

type SolidEntryPoint struct {
	MessageID hornet.MessageID
	Index     milestone.Index
}

type SolidEntryPointConsumer

type SolidEntryPointConsumer func(solidEntryPoint *SolidEntryPoint) bool

SolidEntryPointConsumer consumes the solid entry point during looping through all solid entry points.

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) Bytes

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

func (*SolidEntryPoints) Clear

func (s *SolidEntryPoints) Clear()

func (*SolidEntryPoints) Contains

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

func (*SolidEntryPoints) Index

func (s *SolidEntryPoints) Index(messageID hornet.MessageID) (milestone.Index, 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

sort the solid entry points lexicographically by their MessageID

type Storage

type Storage struct {

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

Storage is the access layer to the node databases (partially cached).

func New

func New(tangleStore kvstore.KVStore, utxoStore kvstore.KVStore, cachesProfile ...*profile.Caches) (*Storage, error)

func (*Storage) AreDatabasesCorrupted

func (s *Storage) AreDatabasesCorrupted() (bool, error)

func (*Storage) AreDatabasesTainted

func (s *Storage) AreDatabasesTainted() (bool, error)

func (*Storage) CachedChildrenOfMessageID

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

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

func (*Storage) CachedMessage

func (s *Storage) CachedMessage(messageID hornet.MessageID) (*CachedMessage, error)

CachedMessage returns a cached message object. message +1

func (*Storage) CachedMessageMetadata

func (s *Storage) CachedMessageMetadata(messageID hornet.MessageID) (*CachedMetadata, error)

CachedMessageMetadata returns a cached metadata object. meta +1

func (*Storage) CachedMessageMetadataOrNil

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

CachedMessageMetadataOrNil returns a cached metadata object. meta +1

func (*Storage) CachedMessageOrNil

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

CachedMessageOrNil returns a cached message object. message +1

func (*Storage) CachedMilestoneOrNil

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

CachedMilestoneOrNil returns a cached milestone object. milestone +1

func (*Storage) CheckCorrectDatabasesVersion

func (s *Storage) CheckCorrectDatabasesVersion() (bool, error)

func (*Storage) ChildrenMessageIDs

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

ChildrenMessageIDs returns the message IDs of the children of the given message. children +-0

func (*Storage) ChildrenStorageSize

func (s *Storage) ChildrenStorageSize() int

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

ContainsMilestone returns if the given milestone exists in the cache/persistence layer.

func (*Storage) DeleteChild

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

DeleteChild deletes the child in the cache/persistence layer. child +-0

func (*Storage) DeleteChildren

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

DeleteChildren deletes the children of the given message in the cache/persistence layer. child +-0

func (*Storage) DeleteIndexation

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

DeleteIndexation deletes the indexation in the cache/persistence layer. indexation +-0

func (*Storage) DeleteIndexationByKey

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

DeleteIndexationByKey deletes the indexation by key in the cache/persistence layer. 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)

DeleteMilestone deletes the milestone in the cache/persistence layer. +-0

func (*Storage) DeleteUnreferencedMessages

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

DeleteUnreferencedMessages deletes unreferenced message entries in the cache/persistence layer.

func (*Storage) FlushAndCloseStores

func (s *Storage) FlushAndCloseStores() error

func (*Storage) FlushChildrenStorage

func (s *Storage) FlushChildrenStorage()

FlushChildrenStorage flushes the children storage.

func (*Storage) FlushIndexationStorage

func (s *Storage) FlushIndexationStorage()

FlushIndexationStorage flushes the indexation storage.

func (*Storage) FlushMessagesStorage

func (s *Storage) FlushMessagesStorage()

FlushMessagesStorage flushes the messages 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) FlushUnreferencedMessagesStorage

func (s *Storage) FlushUnreferencedMessagesStorage()

FlushUnreferencedMessagesStorage flushes the unreferenced messages storage.

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) 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) ForEachUnreferencedMessage

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

ForEachUnreferencedMessage loops over all unreferenced messages.

func (*Storage) IndexMessageIDs

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

IndexMessageIDs returns all known message IDs for the given index. indexation +-0

func (*Storage) IndexationStorageSize

func (s *Storage) IndexationStorageSize() int

func (*Storage) MarkDatabasesCorrupted

func (s *Storage) MarkDatabasesCorrupted() error

func (*Storage) MarkDatabasesHealthy

func (s *Storage) MarkDatabasesHealthy() error

func (*Storage) MarkDatabasesTainted

func (s *Storage) MarkDatabasesTainted() error

func (*Storage) Message

func (s *Storage) Message(messageID hornet.MessageID) (*iotago.Message, error)

Message returns an iotago message object.

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) MessageMetadataStorageSize

func (s *Storage) MessageMetadataStorageSize() int

func (*Storage) MessageStorageSize

func (s *Storage) MessageStorageSize() int

func (*Storage) MilestoneCachedMessageOrNil

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

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

func (*Storage) MilestoneStorageSize

func (s *Storage) MilestoneStorageSize() int

func (*Storage) MilestoneTimestampByIndex

func (s *Storage) MilestoneTimestampByIndex(milestoneIndex milestone.Index) (time.Time, error)

MilestoneTimestampByIndex returns the timestamp of a milestone.

func (*Storage) MilestoneTimestampUnixByIndex

func (s *Storage) MilestoneTimestampUnixByIndex(milestoneIndex milestone.Index) (int64, 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() milestone.Index

SearchLatestMilestoneIndexInStore searches the latest milestone without accessing the cache layer.

func (*Storage) SetSnapshotInfo

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

func (*Storage) SetSnapshotMilestone

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

func (*Storage) ShutdownChildrenStorage

func (s *Storage) ShutdownChildrenStorage()

ShutdownChildrenStorage shuts down the children storage.

func (*Storage) ShutdownIndexationStorage

func (s *Storage) ShutdownIndexationStorage()

ShutdownIndexationStorage shuts down the indexation storage.

func (*Storage) ShutdownMessagesStorage

func (s *Storage) ShutdownMessagesStorage()

ShutdownMessagesStorage shuts down the messages 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) ShutdownUnreferencedMessagesStorage

func (s *Storage) ShutdownUnreferencedMessagesStorage()

ShutdownUnreferencedMessagesStorage shuts down the unreferenced messages storage.

func (*Storage) SnapshotInfo

func (s *Storage) SnapshotInfo() *SnapshotInfo

func (*Storage) SolidEntryPoints

func (s *Storage) SolidEntryPoints() *SolidEntryPoints

func (*Storage) SolidEntryPointsAddWithoutLocking

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

SolidEntryPointsAddWithoutLocking adds a message to the solid entry points. WriteLockSolidEntryPoints must be held while entering this function.

func (*Storage) SolidEntryPointsContain

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

func (*Storage) SolidEntryPointsIndex

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

SolidEntryPointsIndex returns the index of a solid entry point and whether the message is a solid entry point or not.

func (*Storage) StoreChild

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

StoreChild stores the child in the persistence layer and returns a cached object. child +1

func (*Storage) StoreIndexation

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

StoreIndexation stores the indexation in the persistence layer and returns a cached object. indexation +1

func (*Storage) StoreMessageIfAbsent

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

StoreMessageIfAbsent returns a cached object and stores the message in the persistence layer if it was absent. message +1

func (*Storage) StoreMilestoneIfAbsent

func (s *Storage) StoreMilestoneIfAbsent(index milestone.Index, messageID hornet.MessageID, timestamp time.Time) (*CachedMilestone, bool)

milestone +1

func (*Storage) StoreSolidEntryPointsWithoutLocking

func (s *Storage) StoreSolidEntryPointsWithoutLocking() error

StoreSolidEntryPointsWithoutLocking stores the solid entry points in the persistence layer. WriteLockSolidEntryPoints must be held while entering this function.

func (*Storage) StoreUnreferencedMessage

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

StoreUnreferencedMessage stores the unreferenced message in the persistence layer and returns a cached object. unreferencedTx +1

func (*Storage) StoredMetadataOrNil

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

StoredMetadataOrNil returns a metadata object without accessing the cache layer.

func (*Storage) TangleStore

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

func (*Storage) UTXOManager

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

func (*Storage) UTXOStore

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

func (*Storage) UnreferencedMessageIDs

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

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

func (*Storage) UnreferencedMessageStorageSize

func (s *Storage) UnreferencedMessageStorageSize() int

func (*Storage) UpdateDatabasesVersion

func (s *Storage) UpdateDatabasesVersion() (bool, error)

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

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) (*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 UnreferencedMessage

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

func NewUnreferencedMessage

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

func (*UnreferencedMessage) LatestMilestoneIndex

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

func (*UnreferencedMessage) MessageID

func (t *UnreferencedMessage) MessageID() 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