storage

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 22 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 (
	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 added in v1.2.0

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 added in v1.2.0

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 added in v1.0.5

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 added in v1.0.5

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 NewCachedMessage added in v1.2.0

func NewCachedMessage(msg objectstorage.CachedObject, metadata objectstorage.CachedObject) *CachedMessage

func (*CachedMessage) CachedMetadata added in v1.0.5

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 added in v1.0.5

func (c *CachedMessage) Message() *Message

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

func (*CachedMessage) Metadata added in v1.0.5

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 added in v1.2.0

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

type CachedMessageMetadataFunc added in v1.2.0

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 added in v1.2.0

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 added in v1.0.5

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 added in v1.0.5

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 added in v1.0.5

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 added in v1.0.5

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 added in v1.0.5

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 added in v1.0.5

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

func (*Indexation) MessageID added in v1.0.5

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 added in v1.2.0

func WithIteratorMaxIterations(maxIterations int) IteratorOption

WithIteratorMaxIterations is used to stop the iteration after a certain amount of iterations. 0 disables the limit.

func WithIteratorPrefix added in v1.2.0

func WithIteratorPrefix(prefix []byte) IteratorOption

WithIteratorPrefix is used to iterate a subset of elements with a defined prefix.

type IteratorOptions added in v1.2.0

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

IteratorOptions define options for iterations in the object storage.

type LexicalOrderedSolidEntryPoints added in v1.2.0

type LexicalOrderedSolidEntryPoints []*SolidEntryPoint

LexicalOrderedSolidEntryPoints are solid entry points ordered in lexical order by their MessageID.

func (LexicalOrderedSolidEntryPoints) Len added in v1.2.0

func (LexicalOrderedSolidEntryPoints) Less added in v1.2.0

func (LexicalOrderedSolidEntryPoints) Swap added in v1.2.0

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 added in v1.0.5

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

func (*Message) Indexation added in v1.0.5

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 added in v1.0.5

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

func (*Message) MessageID added in v1.0.5

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

func (*Message) Milestone added in v1.0.5

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

func (*Message) NetworkID added in v1.0.5

func (msg *Message) NetworkID() uint64

func (*Message) ObjectStorageKey

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

func (*Message) ObjectStorageValue

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

func (*Message) Parents added in v1.0.5

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

func (*Message) SignatureForInputIndex added in v1.0.5

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

func (*Message) Transaction added in v1.0.5

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

func (*Message) TransactionEssence added in v1.0.5

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

func (*Message) TransactionEssenceIndexation added in v1.0.5

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

func (*Message) TransactionEssenceUTXOInputs added in v1.0.5

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 added in v1.2.0

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

func (*MessageMetadata) ConeRootIndexes added in v1.0.5

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

func (*MessageMetadata) Conflict added in v1.0.5

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 added in v1.0.5

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

func (*MessageMetadata) Metadata added in v1.0.5

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 added in v1.0.5

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

func (*MessageMetadata) ReferencedWithIndex added in v1.0.5

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 added in v1.0.5

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 added in v1.2.0

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 added in v1.2.0

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 added in v1.2.0

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

NonCachedStorage is a Storage without a cache.

func (*NonCachedStorage) ForEachChild added in v1.2.0

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

ForEachChild loops over all children.

func (*NonCachedStorage) ForEachIndexation added in v1.2.0

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

ForEachIndexation loops over all indexations. indexation +1

func (*NonCachedStorage) ForEachMessageID added in v1.2.0

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

ForEachMessageID loops over all message IDs.

func (*NonCachedStorage) ForEachMessageMetadataMessageID added in v1.2.0

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

ForEachMessageMetadataMessageID loops over all message metadata message IDs.

func (*NonCachedStorage) ForEachMilestoneIndex added in v1.2.0

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

ForEachMilestoneIndex loops through all milestones.

func (*NonCachedStorage) ForEachUnreferencedMessage added in v1.2.0

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 added in v1.0.5

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

type SolidEntryPoint added in v1.1.0

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

type SolidEntryPointConsumer added in v1.1.0

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 added in v1.0.5

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 added in v1.2.0

func (s *SolidEntryPoints) SHA256Sum() ([]byte, error)

func (*SolidEntryPoints) SetModified

func (s *SolidEntryPoints) SetModified(modified bool)

func (*SolidEntryPoints) Sorted added in v1.2.0

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 added in v1.1.0

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

func (*Storage) AreDatabasesTainted added in v1.1.0

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

func (*Storage) CachedChildrenOfMessageID added in v1.0.5

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

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

func (*Storage) CachedMessage added in v1.2.0

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

CachedMessage returns a cached message object. message +1

func (*Storage) CachedMessageMetadata added in v1.2.0

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

CachedMessageMetadata returns a cached metadata object. meta +1

func (*Storage) CachedMessageMetadataOrNil added in v1.0.5

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

CachedMessageMetadataOrNil returns a cached metadata object. meta +1

func (*Storage) CachedMessageOrNil added in v1.0.5

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

CachedMessageOrNil returns a cached message object. message +1

func (*Storage) CachedMilestoneOrNil added in v1.0.5

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

CachedMilestoneOrNil returns a cached milestone object. milestone +1

func (*Storage) CheckCorrectDatabasesVersion added in v1.1.0

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

func (*Storage) ChildrenMessageIDs added in v1.0.5

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 added in v1.0.5

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.0.5

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 added in v1.0.5

func (s *Storage) IndexationStorageSize() int

func (*Storage) MarkDatabasesCorrupted added in v1.1.0

func (s *Storage) MarkDatabasesCorrupted() error

func (*Storage) MarkDatabasesHealthy added in v1.1.0

func (s *Storage) MarkDatabasesHealthy() error

func (*Storage) MarkDatabasesTainted added in v1.1.0

func (s *Storage) MarkDatabasesTainted() error

func (*Storage) Message added in v1.2.0

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 added in v1.0.5

func (s *Storage) MessageMetadataStorageSize() int

func (*Storage) MessageStorageSize added in v1.0.5

func (s *Storage) MessageStorageSize() int

func (*Storage) MilestoneCachedMessageOrNil added in v1.0.5

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 added in v1.0.5

func (s *Storage) MilestoneStorageSize() int

func (*Storage) NonCachedStorage added in v1.2.0

func (s *Storage) NonCachedStorage() *NonCachedStorage

func (*Storage) PrintSnapshotInfo added in v1.2.0

func (s *Storage) PrintSnapshotInfo()

func (*Storage) ReadLockSolidEntryPoints

func (s *Storage) ReadLockSolidEntryPoints()

func (*Storage) ReadUnlockSolidEntryPoints

func (s *Storage) ReadUnlockSolidEntryPoints()

func (*Storage) ResetSolidEntryPointsWithoutLocking added in v1.0.5

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 added in v1.0.5

func (s *Storage) SnapshotInfo() *SnapshotInfo

func (*Storage) SolidEntryPoints added in v1.2.0

func (s *Storage) SolidEntryPoints() *SolidEntryPoints

func (*Storage) SolidEntryPointsAddWithoutLocking added in v1.0.5

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 added in v1.1.0

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

milestone +1

func (*Storage) StoreSolidEntryPointsWithoutLocking added in v1.0.5

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 added in v1.0.5

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

StoredMetadataOrNil returns a metadata object without accessing the cache layer.

func (*Storage) TangleStore added in v1.2.0

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

func (*Storage) UTXOManager added in v1.1.0

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

func (*Storage) UTXOStore added in v1.2.0

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

func (*Storage) UnreferencedMessageIDs added in v1.0.5

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 added in v1.0.5

func (s *Storage) UnreferencedMessageStorageSize() int

func (*Storage) UpdateDatabasesVersion added in v1.1.0

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 added in v1.1.0

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

func NewStoreHealthTracker added in v1.1.0

func NewStoreHealthTracker(store kvstore.KVStore) (*StoreHealthTracker, error)

func (*StoreHealthTracker) CheckCorrectDatabaseVersion added in v1.1.0

func (s *StoreHealthTracker) CheckCorrectDatabaseVersion() (bool, error)

func (*StoreHealthTracker) DatabaseVersion added in v1.1.3

func (s *StoreHealthTracker) DatabaseVersion() (int, error)

DatabaseVersion returns the database version.

func (*StoreHealthTracker) IsCorrupted added in v1.1.0

func (s *StoreHealthTracker) IsCorrupted() (bool, error)

func (*StoreHealthTracker) IsTainted added in v1.1.0

func (s *StoreHealthTracker) IsTainted() (bool, error)

func (*StoreHealthTracker) MarkCorrupted added in v1.1.0

func (s *StoreHealthTracker) MarkCorrupted() error

func (*StoreHealthTracker) MarkHealthy added in v1.1.0

func (s *StoreHealthTracker) MarkHealthy() error

func (*StoreHealthTracker) MarkTainted added in v1.1.0

func (s *StoreHealthTracker) MarkTainted() error

func (*StoreHealthTracker) UpdateDatabaseVersion added in v1.1.0

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 added in v1.0.5

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

func (*UnreferencedMessage) MessageID added in v1.0.5

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