Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyLedgerDiffWithoutLocking(diff map[string]int64, index milestone.Index) error
- func BundleCaller(handler interface{}, params ...interface{})
- func CheckIfMilestone(bndl *Bundle) (result bool, err error)
- func CleanupDatabases() error
- func CloseDatabases() error
- func ConfigureDatabases(directory string)
- func ConfigureMilestones(cooAddr hornet.Hash, cooSecLvl int, cooMerkleTreeDepth uint64, ...)
- func ConfigureStorages(tangleStore kvstore.KVStore, snapshotStore kvstore.KVStore, ...)
- func ContainsAddress(address hornet.Hash, txHash hornet.Hash, valueOnly bool) bool
- func ContainsApprover(txHash hornet.Hash, approverHash hornet.Hash) bool
- func ContainsBundle(tailTxHash hornet.Hash) bool
- func ContainsBundleTransaction(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool) bool
- func ContainsMilestone(milestoneIndex milestone.Index) bool
- func ContainsTag(txTag hornet.Hash, txHash hornet.Hash) bool
- func ContainsTransaction(txHash hornet.Hash) bool
- func DatabaseSupportsCleanup() bool
- func DeleteAddress(address hornet.Hash, txHash hornet.Hash)
- func DeleteApprover(txHash hornet.Hash, approverHash hornet.Hash)
- func DeleteApprovers(txHash hornet.Hash)
- func DeleteBundle(tailTxHash hornet.Hash)
- func DeleteBundleTransaction(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool)
- func DeleteLedgerDiffForMilestone(index milestone.Index) error
- func DeleteMilestone(milestoneIndex milestone.Index)
- func DeleteTag(txTag hornet.Hash, txHash hornet.Hash)
- func DeleteTransaction(txHash hornet.Hash)
- func DeleteTransactionMetadata(txHash hornet.Hash)
- func DeleteUnconfirmedTxs(msIndex milestone.Index) int
- func FlushAddressStorage()
- func FlushApproversStorage()
- func FlushBundleStorage()
- func FlushBundleTransactionsStorage()
- func FlushMilestoneStorage()
- func FlushSpentAddressesStorage()
- func FlushStorages()
- func FlushTagsStorage()
- func FlushTransactionStorage()
- func FlushUnconfirmedTxsStorage()
- func ForEachAddress(consumer AddressConsumer, skipCache bool)
- func ForEachApprover(consumer ApproverConsumer, skipCache bool)
- func ForEachBundle(bundleHash hornet.Hash, consumer func(*Bundle) bool, maxFind ...int)
- func ForEachBundleHash(consumer BundleHashConsumer, skipCache bool)
- func ForEachBundleTailTransactionHash(bundleHash hornet.Hash, consumer func(txTailHash hornet.Hash) bool, ...)
- func ForEachBundleTransaction(consumer BundleTransactionConsumer, skipCache bool)
- func ForEachLedgerDiffHash(consumer LedgerDiffHashConsumer, skipCache bool)
- func ForEachMilestoneIndex(consumer MilestoneIndexConsumer, skipCache bool)
- func ForEachTag(consumer TagConsumer, skipCache bool)
- func ForEachTransactionHash(consumer TransactionHashConsumer, skipCache bool)
- func ForEachTransactionMetadataHash(consumer TransactionHashConsumer, skipCache bool)
- func ForEachUnconfirmedTx(consumer UnconfirmedTxConsumer, skipCache bool)
- func GetAddressesStorageSize() int
- func GetAllBundleTransactionHashes(maxFind ...int) hornet.Hashes
- func GetAllSnapshotBalances(abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)
- func GetApproverHashes(txHash hornet.Hash, maxFind ...int) hornet.Hashes
- func GetApproversStorageSize() int
- func GetBalanceForAddress(address hornet.Hash) (uint64, milestone.Index, error)
- func GetBalanceForAddressWithoutLocking(address hornet.Hash) (uint64, milestone.Index, error)
- func GetBundleStorageSize() int
- func GetBundleTailTransactionHashes(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes
- func GetBundleTransactionHashes(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes
- func GetBundleTransactionsStorageSize() int
- func GetDatabaseSizes() (tangle int64, snapshot int64, spent int64)
- func GetLatestMilestoneIndex() milestone.Index
- func GetLatestSeenMilestoneIndexFromSnapshot() milestone.Index
- func GetLedgerDiffForMilestone(ctx context.Context, index milestone.Index) (map[string]int64, error)
- func GetLedgerDiffForMilestoneWithoutLocking(ctx context.Context, index milestone.Index) (map[string]int64, error)
- func GetLedgerStateForLSMI(ctx context.Context) (map[string]uint64, milestone.Index, error)
- func GetLedgerStateForLSMIWithoutLocking(ctx context.Context) (map[string]uint64, milestone.Index, error)
- func GetLedgerStateForMilestone(ctx context.Context, targetIndex milestone.Index) (map[string]uint64, milestone.Index, error)
- func GetLedgerStateForMilestoneWithoutLocking(ctx context.Context, targetIndex milestone.Index) (map[string]uint64, milestone.Index, error)
- func GetMilestoneMerkleHashFunc() crypto.Hash
- func GetMilestoneStorageSize() int
- func GetMilestoneTimestamp(milestoneIndex milestone.Index) (uint64, error)
- func GetSolidMilestoneIndex() milestone.Index
- func GetSpentAddressesStorageSize() int
- func GetStoredMetadataOrNil(txHash hornet.Hash) *hornet.TransactionMetadata
- func GetTagHashes(txTag hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes
- func GetTagsStorageSize() int
- func GetTransactionHashesForAddress(address hornet.Hash, valueOnly bool, forceRelease bool, maxFind ...int) hornet.Hashes
- func GetTransactionStorageSize() int
- func GetUnconfirmedTxHashes(msIndex milestone.Index, forceRelease bool) hornet.Hashes
- func GetUnconfirmedTxStorageSize() int
- func IsCorrectDatabaseVersion() bool
- func IsDatabaseCorrupted() bool
- func IsDatabaseTainted() bool
- func IsMaybeMilestone(cachedTx *CachedTransaction) bool
- func IsMaybeMilestoneTx(cachedTx *CachedTransaction) bool
- func IsNodeSynced() bool
- func IsNodeSyncedWithThreshold() bool
- func LoadInitialValuesFromDatabase()
- func MarkAddressAsSpent(address hornet.Hash) bool
- func MarkAddressAsSpentWithoutLocking(address hornet.Hash) bool
- func MarkDatabaseCorrupted()
- func MarkDatabaseHealthy()
- func MarkDatabaseTainted()
- func NewTransactionCaller(handler interface{}, params ...interface{})
- func OnTailTransactionSolid(cachedTx *CachedTransaction)
- func OverwriteSolidMilestoneIndex(index milestone.Index)
- func ReadLockLedger()
- func ReadLockSolidEntryPoints()
- func ReadLockSpentAddresses()
- func ReadUnlockLedger()
- func ReadUnlockSolidEntryPoints()
- func ReadUnlockSpentAddresses()
- func RemoveTransactionFromBundle(txMeta *hornet.TransactionMetadata) map[string]struct{}
- func ResetMilestoneIndexes()
- func ResetSolidEntryPoints()
- func SearchLatestMilestoneIndexInStore() milestone.Index
- func SetLatestMilestoneIndex(index milestone.Index, updateSynced ...bool) bool
- func SetLatestSeenMilestoneIndexFromSnapshot(milestoneIndex milestone.Index)
- func SetSnapshotInfo(sn *SnapshotInfo)
- func SetSnapshotMilestone(coordinatorAddress hornet.Hash, milestoneHash hornet.Hash, ...)
- func SetSolidMilestoneIndex(index milestone.Index, updateSynced ...bool)
- func ShutdownAddressStorage()
- func ShutdownApproversStorage()
- func ShutdownBundleStorage()
- func ShutdownBundleTransactionsStorage()
- func ShutdownMilestoneStorage()
- func ShutdownSpentAddressesStorage()
- func ShutdownStorages()
- func ShutdownTagsStorage()
- func ShutdownTransactionStorage()
- func ShutdownUnconfirmedTxsStorage()
- func SolidEntryPointsAdd(txHash hornet.Hash, milestoneIndex milestone.Index)
- func SolidEntryPointsContain(txHash hornet.Hash) bool
- func SolidEntryPointsIndex(txHash hornet.Hash) (milestone.Index, bool)
- func StoreLedgerBalancesInDatabase(balances map[string]uint64, index milestone.Index) error
- func StoreSnapshotBalancesInDatabase(balances map[string]uint64, index milestone.Index) error
- func StoreSolidEntryPoints()
- func StoreWhiteFlagConfirmation(conf *WhiteFlagConfirmation) error
- func StreamSpentAddressesToWriter(ctx context.Context, buf io.Writer) (int32, error)
- func TransactionCaller(handler interface{}, params ...interface{})
- func TransactionConfirmedCaller(handler interface{}, params ...interface{})
- func TransactionExistsInStore(txHash hornet.Hash) bool
- func TransactionHashCaller(handler interface{}, params ...interface{})
- func UpdateDatabaseVersion() bool
- func WaitForNodeSynced(timeout time.Duration) bool
- func WasAddressSpentFrom(address hornet.Hash) bool
- func WriteLockLedger()
- func WriteLockSolidEntryPoints()
- func WriteLockSpentAddresses()
- func WriteUnlockLedger()
- func WriteUnlockSolidEntryPoints()
- func WriteUnlockSpentAddresses()
- type AddressConsumer
- type ApproverConsumer
- type Bundle
- func (bundle *Bundle) ApplySpentAddresses()
- func (bundle *Bundle) GetBranchHash(forceRelease bool) hornet.Hash
- func (bundle *Bundle) GetBundleHash() hornet.Hash
- func (bundle *Bundle) GetHead() *CachedTransaction
- func (bundle *Bundle) GetHeadMetadata() *CachedMetadata
- func (bundle *Bundle) GetLedgerChanges() map[string]int64
- func (bundle *Bundle) GetMetadata() byte
- func (bundle *Bundle) GetMilestoneHash() hornet.Hash
- func (bundle *Bundle) GetMilestoneIndex() milestone.Index
- func (bundle *Bundle) GetMilestoneMerkleTreeHash() ([]byte, error)
- func (bundle *Bundle) GetTail() *CachedTransaction
- func (bundle *Bundle) GetTailHash() hornet.Hash
- func (bundle *Bundle) GetTailMetadata() *CachedMetadata
- func (bundle *Bundle) GetTransactions() CachedTransactions
- func (bundle *Bundle) GetTrunkHash(forceRelease bool) hornet.Hash
- func (bundle *Bundle) GetTxHashes() hornet.Hashes
- func (bundle *Bundle) IsConfirmed() bool
- func (bundle *Bundle) IsConflicting() bool
- func (bundle *Bundle) IsInvalidPastCone() bool
- func (bundle *Bundle) IsMilestone() bool
- func (bundle *Bundle) IsSolid() bool
- func (bundle *Bundle) IsValid() bool
- func (bundle *Bundle) IsValueSpam() bool
- func (bundle *Bundle) ObjectStorageKey() []byte
- func (bundle *Bundle) ObjectStorageValue() (data []byte)
- func (bundle *Bundle) SetInvalidPastCone(invalidPastCone bool)
- func (bundle *Bundle) UnmarshalObjectStorageValue(data []byte) (err error)
- func (bundle *Bundle) Update(_ objectstorage.StorableObject)
- func (bundle *Bundle) ValidStrictSemantics() bool
- type BundleHashConsumer
- type BundleTransaction
- type BundleTransactionConsumer
- type CachedAddress
- type CachedAddresses
- type CachedAppprovers
- type CachedApprover
- type CachedBundle
- type CachedBundleTransaction
- type CachedBundleTransactions
- type CachedBundles
- type CachedMetadata
- type CachedMilestone
- type CachedSpentAddress
- type CachedTag
- type CachedTags
- type CachedTransaction
- func AddTransactionToStorage(hornetTx *hornet.Transaction, latestMilestoneIndex milestone.Index, ...) (cachedTx *CachedTransaction, alreadyAdded bool)
- func GetCachedTransactionOrNil(txHash hornet.Hash) *CachedTransaction
- func StoreTransactionIfAbsent(transaction *hornet.Transaction) (cachedTx *CachedTransaction, newlyAdded bool)
- func (c *CachedTransaction) ConsumeMetadata(consumer func(*hornet.TransactionMetadata))
- func (c *CachedTransaction) ConsumeTransaction(consumer func(*hornet.Transaction))
- func (c *CachedTransaction) ConsumeTransactionAndMetadata(consumer func(*hornet.Transaction, *hornet.TransactionMetadata))
- func (c *CachedTransaction) Exists() bool
- func (c *CachedTransaction) GetCachedMetadata() *CachedMetadata
- func (c *CachedTransaction) GetMetadata() *hornet.TransactionMetadata
- func (c *CachedTransaction) GetTransaction() *hornet.Transaction
- func (c *CachedTransaction) Release(force ...bool)
- func (c *CachedTransaction) Retain() *CachedTransaction
- type CachedTransactions
- type CachedUnconfirmedTx
- type CachedUnconfirmedTxs
- type ErrDatabaseError
- type LedgerDiffHashConsumer
- type Milestone
- type MilestoneIndexConsumer
- type SnapshotInfo
- type TagConsumer
- type TransactionHashConsumer
- type UnconfirmedTxConsumer
- type WhiteFlagConfirmation
- type WhiteFlagMutations
Constants ¶
const ( MetadataSolid = 0 MetadataValid = 1 MetadataConfirmed = 2 MetadataIsMilestone = 3 MetadataIsValueSpam = 4 MetadataValidStrictSemantics = 5 MetadataConflicting = 6 MetadataInvalidPastCone = 7 )
const ( StorePrefixHealth byte = 0 StorePrefixTransactions byte = 1 StorePrefixTransactionMetadata byte = 2 StorePrefixBundleTransactions byte = 3 StorePrefixBundles byte = 4 StorePrefixAddresses byte = 5 StorePrefixMilestones byte = 6 StorePrefixLedgerState byte = 7 StorePrefixLedgerBalance byte = 8 StorePrefixLedgerDiff byte = 9 StorePrefixApprovers byte = 10 StorePrefixTags byte = 11 StorePrefixSnapshot byte = 12 StorePrefixSnapshotLedger byte = 13 StorePrefixUnconfirmedTransactions byte = 14 StorePrefixSpentAddresses byte = 15 StorePrefixAutopeering byte = 16 StorePrefixWhiteFlag byte = 17 )
const ( TangleDbFilename = "tangle.db" SnapshotDbFilename = "snapshot.db" SpentAddressesDbFilename = "spent.db" )
const (
BundleTxIsTail = 1
)
const (
DbVersion = 2
)
const (
SnapshotMetadataSpentAddressesEnabled = 0
)
Variables ¶
var ( // ErrOperationAborted is returned when the operation was aborted e.g. by a shutdown signal. ErrOperationAborted = errors.New("operation was aborted") // ErrTransactionNotFound is returned when a transaction was not found. ErrTransactionNotFound = errors.New("transaction not found") // ErrBundleNotFound is returned when a bundle was not found. ErrBundleNotFound = errors.New("bundle not found") // ErrNodeNotSynced is returned when the node is not synchronized. ErrNodeNotSynced = errors.New("node is not synchronized") // ErrNodeLoadTooHigh is returned when the load on the node is too high. ErrNodeLoadTooHigh = errors.New("node load is too high") )
var ( ErrSolidEntryPointsAlreadyInitialized = errors.New("solidEntryPoints already initialized") ErrSolidEntryPointsNotInitialized = errors.New("solidEntryPoints not initialized") )
var ( // Returned when a wf-confirmation is already stored for a given milestone index. ErrWFConfirmationAlreadyStored = errors.New("wf-confirmation already stored") // Returned when a WhiteFlagConfirmation does not contain a WhiteFlagMutations. ErrWFMustContainMutations = errors.New("wf-confirmation must contain mutations struct") )
var ( // ErrInvalidAuditPathLength is returned when audit path is too long to fit in the message fragment. ErrInvalidAuditPathLength = errors.New("invalid audit path length") )
var (
ErrInvalidMilestone = errors.New("invalid milestone")
)
var (
ErrNothingToCleanUp = errors.New("Nothing to clean up in the databases")
)
var (
ErrParseSnapshotInfoFailed = errors.New("Parsing of snapshot info failed")
)
var Events = packageEvents{ ReceivedValidMilestone: events.NewEvent(BundleCaller), ReceivedInvalidMilestone: events.NewEvent(events.ErrorCaller), AddressSpent: events.NewEvent(events.StringCaller), }
Functions ¶
func ApplyLedgerDiffWithoutLocking ¶
ApplyLedgerDiffWithoutLocking applies the changes to the ledger. WriteLockLedger must be held while entering this function.
func BundleCaller ¶
func BundleCaller(handler interface{}, params ...interface{})
func CheckIfMilestone ¶
func CleanupDatabases ¶
func CleanupDatabases() error
func CloseDatabases ¶
func CloseDatabases() error
func ConfigureDatabases ¶
func ConfigureDatabases(directory string)
func ConfigureMilestones ¶
func ConfigureStorages ¶
func ContainsAddress ¶
ContainsAddress returns if the given address exists in the cache/persistence layer.
func ContainsApprover ¶
ContainsApprover returns if the given approver exists in the cache/persistence layer.
func ContainsBundleTransaction ¶
bundleTx +-0
func ContainsTag ¶
ContainsTag returns if the given tag exists in the cache/persistence layer.
func ContainsTransaction ¶
ContainsTransaction returns if the given transaction exists in the cache/persistence layer.
func DatabaseSupportsCleanup ¶
func DatabaseSupportsCleanup() bool
func DeleteApprover ¶
approvers +-0
func DeleteBundleTransaction ¶
bundleTx +-0
func DeleteTransaction ¶
DeleteTransaction deletes the transaction and metadata in the cache/persistence layer.
func DeleteTransactionMetadata ¶
DeleteTransactionMetadata deletes the metadata in the cache/persistence layer.
func DeleteUnconfirmedTxs ¶
DeleteUnconfirmedTxs deletes unconfirmed transaction entries.
func FlushAddressStorage ¶
func FlushAddressStorage()
func FlushApproversStorage ¶
func FlushApproversStorage()
func FlushBundleStorage ¶
func FlushBundleStorage()
func FlushBundleTransactionsStorage ¶
func FlushBundleTransactionsStorage()
func FlushMilestoneStorage ¶
func FlushMilestoneStorage()
func FlushSpentAddressesStorage ¶
func FlushSpentAddressesStorage()
func FlushStorages ¶
func FlushStorages()
func FlushTagsStorage ¶
func FlushTagsStorage()
func FlushTransactionStorage ¶
func FlushTransactionStorage()
func FlushUnconfirmedTxsStorage ¶
func FlushUnconfirmedTxsStorage()
func ForEachAddress ¶
func ForEachAddress(consumer AddressConsumer, skipCache bool)
ForEachAddress loops over all addresses.
func ForEachApprover ¶
func ForEachApprover(consumer ApproverConsumer, skipCache bool)
ForEachApprover loops over all approvers.
func ForEachBundle ¶
ForEachBundle loops over all existing bundle instances for that bundle hash.
func ForEachBundleHash ¶
func ForEachBundleHash(consumer BundleHashConsumer, skipCache bool)
ForEachBundleHash loops over all bundle hashes.
func ForEachBundleTransaction ¶
func ForEachBundleTransaction(consumer BundleTransactionConsumer, skipCache bool)
ForEachBundleTransaction loops over all bundle transactions.
func ForEachLedgerDiffHash ¶
func ForEachLedgerDiffHash(consumer LedgerDiffHashConsumer, skipCache bool)
ForEachLedgerDiffHash loops over all ledger diffs.
func ForEachMilestoneIndex ¶
func ForEachMilestoneIndex(consumer MilestoneIndexConsumer, skipCache bool)
ForEachMilestoneIndex loops through all milestones in the persistence layer.
func ForEachTag ¶
func ForEachTag(consumer TagConsumer, skipCache bool)
ForEachTag loops over all tags.
func ForEachTransactionHash ¶
func ForEachTransactionHash(consumer TransactionHashConsumer, skipCache bool)
ForEachTransactionHash loops over all transaction hashes.
func ForEachTransactionMetadataHash ¶
func ForEachTransactionMetadataHash(consumer TransactionHashConsumer, skipCache bool)
ForEachTransactionMetadataHash loops over all transaction metadata hashes.
func ForEachUnconfirmedTx ¶
func ForEachUnconfirmedTx(consumer UnconfirmedTxConsumer, skipCache bool)
ForEachUnconfirmedTx loops over all unconfirmed transactions.
func GetAddressesStorageSize ¶
func GetAddressesStorageSize() int
func GetAllBundleTransactionHashes ¶
bundleTx +1
func GetAllSnapshotBalances ¶
func GetAllSnapshotBalances(abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)
GetAllSnapshotBalances returns all balances for the snapshot milestone.
func GetApproverHashes ¶
approvers +-0
func GetApproversStorageSize ¶
func GetApproversStorageSize() int
func GetBalanceForAddress ¶
func GetBundleStorageSize ¶
func GetBundleStorageSize() int
func GetBundleTailTransactionHashes ¶
func GetBundleTailTransactionHashes(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes
bundleTx +1
func GetBundleTransactionHashes ¶
func GetBundleTransactionHashes(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes
bundleTx +-0
func GetBundleTransactionsStorageSize ¶
func GetBundleTransactionsStorageSize() int
func GetDatabaseSizes ¶
GetDatabaseSizes returns the size of the different databases.
func GetLatestMilestoneIndex ¶
GetLatestMilestoneIndex returns the latest milestone index.
func GetLedgerDiffForMilestoneWithoutLocking ¶
func GetLedgerDiffForMilestoneWithoutLocking(ctx context.Context, index milestone.Index) (map[string]int64, error)
GetLedgerDiffForMilestoneWithoutLocking returns the ledger changes of that specific milestone. ReadLockLedger must be held while entering this function.
func GetLedgerStateForLSMI ¶
GetLedgerStateForLSMI returns all balances for the current solid milestone.
func GetLedgerStateForLSMIWithoutLocking ¶
func GetLedgerStateForLSMIWithoutLocking(ctx context.Context) (map[string]uint64, milestone.Index, error)
GetLedgerStateForLSMIWithoutLocking returns all balances for the current solid milestone. ReadLockLedger must be held while entering this function.
func GetMilestoneStorageSize ¶
func GetMilestoneStorageSize() int
func GetMilestoneTimestamp ¶
MilestoneTimestamp returns the timestamp of a milestone.
func GetSolidMilestoneIndex ¶
GetSolidMilestoneIndex returns the latest solid milestone index.
func GetSpentAddressesStorageSize ¶
func GetSpentAddressesStorageSize() int
func GetStoredMetadataOrNil ¶
func GetStoredMetadataOrNil(txHash hornet.Hash) *hornet.TransactionMetadata
GetStoredMetadataOrNil returns a metadata object without accessing the cache layer.
func GetTagHashes ¶
tag +-0
func GetTagsStorageSize ¶
func GetTagsStorageSize() int
func GetTransactionHashesForAddress ¶
func GetTransactionHashesForAddress(address hornet.Hash, valueOnly bool, forceRelease bool, maxFind ...int) hornet.Hashes
address +-0
func GetTransactionStorageSize ¶
func GetTransactionStorageSize() int
func GetUnconfirmedTxHashes ¶
GetUnconfirmedTxHashes returns all hashes of unconfirmed transactions for that milestone.
func GetUnconfirmedTxStorageSize ¶
func GetUnconfirmedTxStorageSize() int
func IsCorrectDatabaseVersion ¶
func IsCorrectDatabaseVersion() bool
func IsDatabaseCorrupted ¶
func IsDatabaseCorrupted() bool
func IsDatabaseTainted ¶
func IsDatabaseTainted() bool
func IsMaybeMilestone ¶
func IsMaybeMilestone(cachedTx *CachedTransaction) bool
Checks if the the tx could be part of a milestone.
func IsMaybeMilestoneTx ¶
func IsMaybeMilestoneTx(cachedTx *CachedTransaction) bool
Checks if the the tx could be part of a milestone.
func IsNodeSyncedWithThreshold ¶
func IsNodeSyncedWithThreshold() bool
IsNodeSyncedWithThreshold returns whether the node is synced within a certain threshold.
func LoadInitialValuesFromDatabase ¶
func LoadInitialValuesFromDatabase()
func MarkAddressAsSpentWithoutLocking ¶
spentAddress +-0
func MarkDatabaseCorrupted ¶
func MarkDatabaseCorrupted()
func MarkDatabaseHealthy ¶
func MarkDatabaseHealthy()
func MarkDatabaseTainted ¶
func MarkDatabaseTainted()
func NewTransactionCaller ¶
func NewTransactionCaller(handler interface{}, params ...interface{})
func OnTailTransactionSolid ¶
func OnTailTransactionSolid(cachedTx *CachedTransaction)
Create a new bundle instance as soon as a tailTx gets solid
func OverwriteSolidMilestoneIndex ¶
OverwriteSolidMilestoneIndex is used to set older solid milestones (revalidation).
func ReadLockLedger ¶
func ReadLockLedger()
func ReadLockSolidEntryPoints ¶
func ReadLockSolidEntryPoints()
func ReadLockSpentAddresses ¶
func ReadLockSpentAddresses()
func ReadUnlockLedger ¶
func ReadUnlockLedger()
func ReadUnlockSolidEntryPoints ¶
func ReadUnlockSolidEntryPoints()
func ReadUnlockSpentAddresses ¶
func ReadUnlockSpentAddresses()
func RemoveTransactionFromBundle ¶
func RemoveTransactionFromBundle(txMeta *hornet.TransactionMetadata) map[string]struct{}
RemoveTransactionFromBundle removes the transaction if non-tail and not associated to a bundle instance or if tail, it removes all the transactions of the bundle from the storage that are not used in another bundle instance.
func ResetMilestoneIndexes ¶
func ResetMilestoneIndexes()
func ResetSolidEntryPoints ¶
func ResetSolidEntryPoints()
WriteLockSolidEntryPoints must be held while entering this function
func SearchLatestMilestoneIndexInStore ¶
SearchLatestMilestoneIndexInStore searches the latest milestone without accessing the cache layer.
func SetLatestMilestoneIndex ¶
SetLatestMilestoneIndex sets the latest milestone index.
func SetSnapshotInfo ¶
func SetSnapshotInfo(sn *SnapshotInfo)
func SetSnapshotMilestone ¶
func SetSolidMilestoneIndex ¶
SetSolidMilestoneIndex sets the solid milestone index.
func ShutdownAddressStorage ¶
func ShutdownAddressStorage()
func ShutdownApproversStorage ¶
func ShutdownApproversStorage()
func ShutdownBundleStorage ¶
func ShutdownBundleStorage()
func ShutdownBundleTransactionsStorage ¶
func ShutdownBundleTransactionsStorage()
func ShutdownMilestoneStorage ¶
func ShutdownMilestoneStorage()
func ShutdownSpentAddressesStorage ¶
func ShutdownSpentAddressesStorage()
func ShutdownStorages ¶
func ShutdownStorages()
func ShutdownTagsStorage ¶
func ShutdownTagsStorage()
func ShutdownTransactionStorage ¶
func ShutdownTransactionStorage()
func ShutdownUnconfirmedTxsStorage ¶
func ShutdownUnconfirmedTxsStorage()
func SolidEntryPointsAdd ¶
WriteLockSolidEntryPoints must be held while entering this function
func SolidEntryPointsContain ¶
func StoreSnapshotBalancesInDatabase ¶
StoreSnapshotBalancesInDatabase deletes all old entries and stores the ledger state of the snapshot index
func StoreSolidEntryPoints ¶
func StoreSolidEntryPoints()
WriteLockSolidEntryPoints must be held while entering this function
func StoreWhiteFlagConfirmation ¶
func StoreWhiteFlagConfirmation(conf *WhiteFlagConfirmation) error
StoreWhiteFlagConfirmation persists the given wf-confirmation object.
func StreamSpentAddressesToWriter ¶
StreamSpentAddressesToWriter streams all spent addresses directly to an io.Writer.
func TransactionCaller ¶
func TransactionCaller(handler interface{}, params ...interface{})
func TransactionConfirmedCaller ¶
func TransactionConfirmedCaller(handler interface{}, params ...interface{})
func TransactionExistsInStore ¶
TransactionExistsInStore returns if the given transaction exists in the persistence layer.
func TransactionHashCaller ¶
func TransactionHashCaller(handler interface{}, params ...interface{})
func UpdateDatabaseVersion ¶
func UpdateDatabaseVersion() bool
UpdateDatabaseVersion tries to migrate the existing data to the new database version.
func WaitForNodeSynced ¶
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 WriteLockLedger ¶
func WriteLockLedger()
func WriteLockSolidEntryPoints ¶
func WriteLockSolidEntryPoints()
func WriteLockSpentAddresses ¶
func WriteLockSpentAddresses()
func WriteUnlockLedger ¶
func WriteUnlockLedger()
func WriteUnlockSolidEntryPoints ¶
func WriteUnlockSolidEntryPoints()
func WriteUnlockSpentAddresses ¶
func WriteUnlockSpentAddresses()
Types ¶
type AddressConsumer ¶
AddressConsumer consumes the given address during looping through all addresses in the persistence layer.
type ApproverConsumer ¶
ApproverConsumer consumes the given approver during looping through all approvers in the persistence layer.
type Bundle ¶
type Bundle struct { objectstorage.StorableObjectFlags syncutils.RWMutex // contains filtered or unexported fields }
Storable Object
func GetStoredBundleOrNil ¶
GetStoredBundleOrNil returns a bundle object without accessing the cache layer.
func (*Bundle) ApplySpentAddresses ¶
func (bundle *Bundle) ApplySpentAddresses()
func (*Bundle) GetBundleHash ¶
func (*Bundle) GetHead ¶
func (bundle *Bundle) GetHead() *CachedTransaction
func (*Bundle) GetHeadMetadata ¶
func (bundle *Bundle) GetHeadMetadata() *CachedMetadata
func (*Bundle) GetLedgerChanges ¶
func (*Bundle) GetMetadata ¶
func (*Bundle) GetMilestoneHash ¶
func (*Bundle) GetMilestoneIndex ¶
func (*Bundle) GetMilestoneMerkleTreeHash ¶
GetMilestoneMerkleTreeHash returns the Merle tree hash in the milestone bundle.
func (*Bundle) GetTail ¶
func (bundle *Bundle) GetTail() *CachedTransaction
func (*Bundle) GetTailHash ¶
func (*Bundle) GetTailMetadata ¶
func (bundle *Bundle) GetTailMetadata() *CachedMetadata
func (*Bundle) GetTransactions ¶
func (bundle *Bundle) GetTransactions() CachedTransactions
func (*Bundle) GetTxHashes ¶
func (*Bundle) IsConfirmed ¶
func (*Bundle) IsConflicting ¶
func (*Bundle) IsInvalidPastCone ¶
func (*Bundle) IsMilestone ¶
func (*Bundle) IsValueSpam ¶
func (*Bundle) ObjectStorageKey ¶
func (*Bundle) ObjectStorageValue ¶
func (*Bundle) SetInvalidPastCone ¶
func (*Bundle) UnmarshalObjectStorageValue ¶
func (*Bundle) Update ¶
func (bundle *Bundle) Update(_ objectstorage.StorableObject)
ObjectStorage interface
func (*Bundle) ValidStrictSemantics ¶
type BundleHashConsumer ¶
BundleHashConsumer consumes the given tailTxHash during looping through all bundles in the persistence layer.
type BundleTransaction ¶
type BundleTransaction struct { objectstorage.StorableObjectFlags // Key BundleHash hornet.Hash IsTail bool TxHash hornet.Hash }
Storable Object
func (*BundleTransaction) GetBundleHash ¶
func (bt *BundleTransaction) GetBundleHash() hornet.Hash
func (*BundleTransaction) GetTxHash ¶
func (bt *BundleTransaction) GetTxHash() hornet.Hash
func (*BundleTransaction) ObjectStorageKey ¶
func (bt *BundleTransaction) ObjectStorageKey() []byte
func (*BundleTransaction) ObjectStorageValue ¶
func (bt *BundleTransaction) ObjectStorageValue() (_ []byte)
func (*BundleTransaction) Update ¶
func (bt *BundleTransaction) Update(_ objectstorage.StorableObject)
ObjectStorage interface
type BundleTransactionConsumer ¶
BundleTransactionConsumer consumes the given bundle transaction during looping through all bundle transactions in the persistence layer.
type CachedAddress ¶
type CachedAddress struct {
objectstorage.CachedObject
}
func StoreAddress ¶
address +1
func (*CachedAddress) GetAddress ¶
func (c *CachedAddress) GetAddress() *hornet.Address
type CachedAddresses ¶
type CachedAddresses []*CachedAddress
func (CachedAddresses) Release ¶
func (cachedAddresses CachedAddresses) Release(force ...bool)
type CachedAppprovers ¶
type CachedAppprovers []*CachedApprover
func (CachedAppprovers) Release ¶
func (cachedApprovers CachedAppprovers) Release(force ...bool)
type CachedApprover ¶
type CachedApprover struct {
objectstorage.CachedObject
}
func StoreApprover ¶
func StoreApprover(txHash hornet.Hash, approverHash hornet.Hash) *CachedApprover
approvers +1
func (*CachedApprover) GetApprover ¶
func (c *CachedApprover) GetApprover() *hornet.Approver
type CachedBundle ¶
type CachedBundle struct {
objectstorage.CachedObject
}
Cached Object
func FindClosestNextMilestoneOrNil ¶
func FindClosestNextMilestoneOrNil(index milestone.Index) *CachedBundle
bundle +1
func GetCachedBundleOrNil ¶
func GetCachedBundleOrNil(tailTxHash hornet.Hash) *CachedBundle
bundle +1
func GetMilestoneOrNil ¶
func GetMilestoneOrNil(milestoneIndex milestone.Index) *CachedBundle
GetMilestoneOrNil returns the CachedBundle of a milestone index or nil if it doesn't exist. bundle +1
func (*CachedBundle) ConsumeBundle ¶
func (c *CachedBundle) ConsumeBundle(consumer func(*Bundle))
func (*CachedBundle) GetBundle ¶
func (c *CachedBundle) GetBundle() *Bundle
func (*CachedBundle) Retain ¶
func (c *CachedBundle) Retain() *CachedBundle
type CachedBundleTransaction ¶
type CachedBundleTransaction struct {
objectstorage.CachedObject
}
Cached Object
func GetCachedBundleTransactionOrNil ¶
func GetCachedBundleTransactionOrNil(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool) *CachedBundleTransaction
bundleTx +1
func StoreBundleTransaction ¶
func StoreBundleTransaction(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool) *CachedBundleTransaction
bundleTx +1
func (*CachedBundleTransaction) GetBundleTransaction ¶
func (c *CachedBundleTransaction) GetBundleTransaction() *BundleTransaction
type CachedBundleTransactions ¶
type CachedBundleTransactions []*CachedBundleTransaction
func (CachedBundleTransactions) Release ¶
func (cachedBundleTransactions CachedBundleTransactions) Release(force ...bool)
func (CachedBundleTransactions) Retain ¶
func (cachedBundleTransactions CachedBundleTransactions) Retain() CachedBundleTransactions
type CachedBundles ¶
type CachedBundles []*CachedBundle
func GetBundles ¶
func GetBundles(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) CachedBundles
GetBundles returns all existing bundle instances for that bundle hash bundle +1
func GetBundlesOfTransactionOrNil ¶
func GetBundlesOfTransactionOrNil(txHash hornet.Hash, forceRelease bool) CachedBundles
GetBundlesOfTransactionOrNil gets all bundle instances in which this transaction is present. A transaction can be in multiple bundle instances simultaneously due to the nature of reattached transactions being able to form infinite amount of bundles which attach to the same underlying bundle transaction. For example it is possible to reattach a bundle's tail transaction directly "on top" of the origin one. bundle +1
func (CachedBundles) Release ¶
func (cachedBundles CachedBundles) Release(force ...bool)
func (CachedBundles) Retain ¶
func (cachedBundles CachedBundles) Retain() CachedBundles
type CachedMetadata ¶
type CachedMetadata struct {
objectstorage.CachedObject
}
CachedMetadata contains the cached object only for metadata.
func GetCachedTxMetadataOrNil ¶
func GetCachedTxMetadataOrNil(txHash hornet.Hash) *CachedMetadata
metadata +1
func (*CachedMetadata) ConsumeMetadata ¶
func (c *CachedMetadata) ConsumeMetadata(consumer func(*hornet.TransactionMetadata))
meta -1
func (*CachedMetadata) GetMetadata ¶
func (c *CachedMetadata) GetMetadata() *hornet.TransactionMetadata
func (*CachedMetadata) Retain ¶
func (c *CachedMetadata) Retain() *CachedMetadata
type CachedMilestone ¶
type CachedMilestone struct {
objectstorage.CachedObject
}
Cached Object
func GetCachedMilestoneOrNil ¶
func GetCachedMilestoneOrNil(milestoneIndex milestone.Index) *CachedMilestone
milestone +1
func StoreMilestoneIfAbsent ¶
func StoreMilestoneIfAbsent(bndl *Bundle) (cachedMilestone *CachedMilestone, newlyAdded bool)
milestone +1
func (*CachedMilestone) GetMilestone ¶
func (c *CachedMilestone) GetMilestone() *Milestone
type CachedSpentAddress ¶
type CachedSpentAddress struct {
objectstorage.CachedObject
}
func (*CachedSpentAddress) GetSpentAddress ¶
func (c *CachedSpentAddress) GetSpentAddress() *hornet.SpentAddress
type CachedTag ¶
type CachedTag struct {
objectstorage.CachedObject
}
type CachedTags ¶
type CachedTags []*CachedTag
type CachedTransaction ¶
type CachedTransaction struct {
// contains filtered or unexported fields
}
CachedTransaction contains two cached objects, one for transaction data and one for metadata.
func AddTransactionToStorage ¶
func AddTransactionToStorage(hornetTx *hornet.Transaction, latestMilestoneIndex milestone.Index, requested bool, forceRelease bool, reapply bool) (cachedTx *CachedTransaction, alreadyAdded bool)
tx +1
func GetCachedTransactionOrNil ¶
func GetCachedTransactionOrNil(txHash hornet.Hash) *CachedTransaction
tx +1
func StoreTransactionIfAbsent ¶
func StoreTransactionIfAbsent(transaction *hornet.Transaction) (cachedTx *CachedTransaction, newlyAdded bool)
tx +1
func (*CachedTransaction) ConsumeMetadata ¶
func (c *CachedTransaction) ConsumeMetadata(consumer func(*hornet.TransactionMetadata))
tx -1 meta -1
func (*CachedTransaction) ConsumeTransaction ¶
func (c *CachedTransaction) ConsumeTransaction(consumer func(*hornet.Transaction))
tx -1 meta -1
func (*CachedTransaction) ConsumeTransactionAndMetadata ¶
func (c *CachedTransaction) ConsumeTransactionAndMetadata(consumer func(*hornet.Transaction, *hornet.TransactionMetadata))
tx -1 meta -1
func (*CachedTransaction) Exists ¶
func (c *CachedTransaction) Exists() bool
func (*CachedTransaction) GetCachedMetadata ¶
func (c *CachedTransaction) GetCachedMetadata() *CachedMetadata
meta +1
func (*CachedTransaction) GetMetadata ¶
func (c *CachedTransaction) GetMetadata() *hornet.TransactionMetadata
func (*CachedTransaction) GetTransaction ¶
func (c *CachedTransaction) GetTransaction() *hornet.Transaction
type CachedTransactions ¶
type CachedTransactions []*CachedTransaction
func (CachedTransactions) Release ¶
func (cachedTxs CachedTransactions) Release(force ...bool)
tx -1
func (CachedTransactions) Retain ¶
func (cachedTxs CachedTransactions) Retain() CachedTransactions
tx +1
type CachedUnconfirmedTx ¶
type CachedUnconfirmedTx struct {
objectstorage.CachedObject
}
func StoreUnconfirmedTx ¶
func StoreUnconfirmedTx(msIndex milestone.Index, txHash hornet.Hash) *CachedUnconfirmedTx
unconfirmedTx +1
func (*CachedUnconfirmedTx) GetUnconfirmedTx ¶
func (c *CachedUnconfirmedTx) GetUnconfirmedTx() *hornet.UnconfirmedTx
type CachedUnconfirmedTxs ¶
type CachedUnconfirmedTxs []*CachedUnconfirmedTx
func (CachedUnconfirmedTxs) Release ¶
func (cachedUnconfirmedTxs CachedUnconfirmedTxs) Release(force ...bool)
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 LedgerDiffHashConsumer ¶
LedgerDiffHashConsumer consumes the given ledger diff addresses during looping through all ledger diffs in the persistence layer.
type Milestone ¶
type Milestone struct { objectstorage.StorableObjectFlags Index milestone.Index Hash hornet.Hash }
Storable Object
func (*Milestone) ObjectStorageKey ¶
func (*Milestone) ObjectStorageValue ¶
func (*Milestone) Update ¶
func (ms *Milestone) Update(_ objectstorage.StorableObject)
type MilestoneIndexConsumer ¶
MilestoneIndexConsumer consumes the given index during looping through all milestones in the persistence layer.
type SnapshotInfo ¶
type SnapshotInfo struct { CoordinatorAddress hornet.Hash Hash hornet.Hash SnapshotIndex milestone.Index EntryPointIndex milestone.Index PruningIndex milestone.Index Timestamp int64 Metadata bitmask.BitMask }
func GetSnapshotInfo ¶
func GetSnapshotInfo() *SnapshotInfo
func SnapshotInfoFromBytes ¶
func SnapshotInfoFromBytes(bytes []byte) (*SnapshotInfo, error)
func (*SnapshotInfo) GetBytes ¶
func (i *SnapshotInfo) GetBytes() []byte
func (*SnapshotInfo) IsSpentAddressesEnabled ¶
func (i *SnapshotInfo) IsSpentAddressesEnabled() bool
func (*SnapshotInfo) SetSpentAddressesEnabled ¶
func (i *SnapshotInfo) SetSpentAddressesEnabled(enabled bool)
type TagConsumer ¶
TagConsumer consumes the given tag during looping through all tags in the persistence layer.
type TransactionHashConsumer ¶
TransactionHashConsumer consumes the given transaction hash during looping through all transactions in the persistence layer.
type UnconfirmedTxConsumer ¶
UnconfirmedTxConsumer consumes the given unconfirmed transaction during looping through all unconfirmed transactions in the persistence layer.
type WhiteFlagConfirmation ¶
type WhiteFlagConfirmation struct { // The index of the milestone that got confirmed. MilestoneIndex milestone.Index `bson:"milestoneIndex" json:"milestone"` // The transaction hash of the tail transaction of the milestone that got confirmed. MilestoneHash hornet.Hash `bson:"milestoneHash" json:"milestoneHash"` // The ledger mutations and referenced transactions of this milestone. Mutations *WhiteFlagMutations `bson:"mutations" json:"mutations"` }
WhiteFlagConfirmation represents a confirmation done via a milestone under the "white-flag" approach.
func GetWhiteFlagConfirmation ¶
func GetWhiteFlagConfirmation(index milestone.Index) (*WhiteFlagConfirmation, error)
GetWhiteFlagConfirmation gets the wf-confirmation object for the given milestone.
func (*WhiteFlagConfirmation) MarshalBinary ¶
func (w *WhiteFlagConfirmation) MarshalBinary() (data []byte, err error)
func (*WhiteFlagConfirmation) UnmarshalBinary ¶
func (w *WhiteFlagConfirmation) UnmarshalBinary(data []byte) error
type WhiteFlagMutations ¶
type WhiteFlagMutations struct { // The tails of bundles which mutate the ledger in the order in which they were applied. TailsIncluded hornet.Hashes `bson:"tailsIncluded" json:"tailsIncluded"` // The tails of bundles which were excluded as they were conflicting with the mutations. TailsExcludedConflicting hornet.Hashes `bson:"tailsExcludedConflicting" json:"tailsExcludedConflicting"` // The tails which were excluded because they were part of a zero or spam value transfer. TailsExcludedZeroValue hornet.Hashes `bson:"tailsExcludedZeroValue" json:"tailsExcludedZeroValue"` // The tails which were referenced by the milestone (should be the sum of TailsIncluded + TailsExcludedConflicting + TailsExcludedZeroValue). TailsReferenced hornet.Hashes `bson:"tailsReferenced" json:"tailsReferenced"` // Contains the updated state of the addresses which were mutated by the given confirmation. NewAddressState map[string]int64 `bson:"newAddressState" json:"newAddressState"` // Contains the mutations to the state of the addresses for the given confirmation. AddressMutations map[string]int64 `bson:"addressMutations" json:"addressMutations"` // The merkle tree root hash of all tails. MerkleTreeHash []byte `bson:"merkleTreeHash" json:"merkleTreeHash"` }
WhiteFlagMutations contains the ledger mutations and referenced transactions applied to a cone under the "white-flag" approach.
Source Files ¶
- address_storage.go
- approvers_storage.go
- bundle.go
- bundle_milestone.go
- bundle_storage.go
- bundle_transaction_storage.go
- database_prefixes.go
- errors.go
- events.go
- health_db.go
- ledger_db.go
- milestones.go
- milestones_storage.go
- snapshot.go
- snapshot_db.go
- solid_entry_points.go
- spent_addresses_storage.go
- tags_storage.go
- tangle.go
- transaction_storage.go
- unconfirmed_tx_storage.go
- wf_storage.go