tangle

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataSolid                = 0
	MetadataValid                = 1
	MetadataConfirmed            = 2
	MetadataIsMilestone          = 3
	MetadataIsValueSpam          = 4
	MetadataValidStrictSemantics = 5
	MetadataConflicting          = 6
	MetadataInvalidPastCone      = 7
)
View Source
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
)
View Source
const (
	TangleDbFilename         = "tangle.db"
	SnapshotDbFilename       = "snapshot.db"
	SpentAddressesDbFilename = "spent.db"
)
View Source
const (
	BundleTxIsTail = 1
)
View Source
const (
	DbVersion = 1
)
View Source
const (
	SnapshotMetadataSpentAddressesEnabled = 0
)

Variables

View Source
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")
	// ErrNodeNotSynced is returned when the node is not synchronized.
	ErrNodeNotSynced = errors.New("node is not synchronized")
)
View Source
var (
	ErrSolidEntryPointsAlreadyInitialized = errors.New("solidEntryPoints already initialized")
	ErrSolidEntryPointsNotInitialized     = errors.New("solidEntryPoints not initialized")
)
View Source
var (
	ErrInvalidMilestone = errors.New("invalid milestone")
)
View Source
var (
	ErrNothingToCleanUp = errors.New("Nothing to clean up in the databases")
)
View Source
var (
	ErrParseSnapshotInfoFailed = errors.New("Parsing of snapshot info failed")
)
View Source
var Events = packageEvents{
	ReceivedValidMilestone:   events.NewEvent(BundleCaller),
	ReceivedInvalidMilestone: events.NewEvent(events.ErrorCaller),
	AddressSpent:             events.NewEvent(events.StringCaller),
}

Functions

func ApplyLedgerDiffWithoutLocking

func ApplyLedgerDiffWithoutLocking(diff map[string]int64, index milestone.Index) error

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 CheckIfMilestone(bndl *Bundle) (result bool, err error)

func CleanupDatabases

func CleanupDatabases() error

func CloseDatabases

func CloseDatabases() error

func ConfigureDatabases

func ConfigureDatabases(directory string)

func ConfigureMilestones

func ConfigureMilestones(cooAddr hornet.Hash, cooSecLvl int, cooMerkleTreeDepth uint64, cooMilestoneMerkleHashFunc crypto.Hash)

func ConfigureStorages added in v0.5.0

func ConfigureStorages(tangleStore kvstore.KVStore, snapshotStore kvstore.KVStore, spentStore kvstore.KVStore, caches profile.Caches)

func ContainsBundle

func ContainsBundle(tailTxHash hornet.Hash) bool

bundle +-0

func ContainsBundleTransaction

func ContainsBundleTransaction(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool) bool

bundleTx +-0

func ContainsMilestone

func ContainsMilestone(milestoneIndex milestone.Index) bool

milestone +-0

func ContainsTransaction

func ContainsTransaction(txHash hornet.Hash) bool

tx +-0

func DatabaseSupportsCleanup

func DatabaseSupportsCleanup() bool

func DeleteAddress

func DeleteAddress(address hornet.Hash, txHash hornet.Hash)

address +-0

func DeleteApprover

func DeleteApprover(txHash hornet.Hash, approverHash hornet.Hash)

approvers +-0

func DeleteApprovers

func DeleteApprovers(txHash hornet.Hash)

approvers +-0

func DeleteBundle

func DeleteBundle(tailTxHash hornet.Hash)

bundle +-0

func DeleteBundleTransaction

func DeleteBundleTransaction(bundleHash hornet.Hash, txHash hornet.Hash, isTail bool)

bundleTx +-0

func DeleteLedgerDiffForMilestone

func DeleteLedgerDiffForMilestone(index milestone.Index) error

func DeleteMilestone

func DeleteMilestone(milestoneIndex milestone.Index)

+-0

func DeleteTag

func DeleteTag(txTag hornet.Hash, txHash hornet.Hash)

tag +-0

func DeleteTransaction

func DeleteTransaction(txHash hornet.Hash)

tx +-0

func DeleteUnconfirmedTxs

func DeleteUnconfirmedTxs(msIndex milestone.Index)

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 FlushTagsStorage

func FlushTagsStorage()

func FlushTransactionStorage

func FlushTransactionStorage()

func FlushUnconfirmedTxsStorage

func FlushUnconfirmedTxsStorage()

func ForEachMilestoneIndex

func ForEachMilestoneIndex(consumer MilestoneIndexConsumer)

ForEachMilestoneIndex loops though all milestones in the persistence layer.

func ForEachTransaction

func ForEachTransaction(consumer TransactionConsumer)

func ForEachTransactionHash

func ForEachTransactionHash(consumer TransactionHashBytesConsumer)

ForEachTransactionHash loops over all transaction hashes.

func GetAddressesStorageSize

func GetAddressesStorageSize() int

func GetAllSnapshotBalances

func GetAllSnapshotBalances(abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)

GetAllSnapshotBalances returns all balances for the snapshot milestone.

func GetApproverHashes

func GetApproverHashes(txHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes

approvers +-0

func GetApproversStorageSize

func GetApproversStorageSize() int

func GetBalanceForAddress

func GetBalanceForAddress(address hornet.Hash) (uint64, milestone.Index, error)

func GetBalanceForAddressWithoutLocking

func GetBalanceForAddressWithoutLocking(address hornet.Hash) (uint64, milestone.Index, error)

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

func GetDatabaseSizes() (tangle int64, snapshot int64, spent int64)

GetDatabaseSizes returns the size of the different databases.

func GetLatestMilestoneIndex

func GetLatestMilestoneIndex() milestone.Index

GetLatestMilestoneIndex returns the latest milestone index.

func GetLatestSeenMilestoneIndexFromSnapshot

func GetLatestSeenMilestoneIndexFromSnapshot() milestone.Index

func GetLedgerDiffForMilestone

func GetLedgerDiffForMilestone(index milestone.Index, abortSignal <-chan struct{}) (map[string]int64, error)

func GetLedgerDiffForMilestoneWithoutLocking

func GetLedgerDiffForMilestoneWithoutLocking(index milestone.Index, abortSignal <-chan struct{}) (map[string]int64, error)

GetLedgerDiffForMilestoneWithoutLocking returns the ledger changes of that specific milestone. ReadLockLedger must be held while entering this function.

func GetLedgerStateForLSMI

func GetLedgerStateForLSMI(abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)

GetLedgerStateForLSMI returns all balances for the current solid milestone.

func GetLedgerStateForLSMIWithoutLocking

func GetLedgerStateForLSMIWithoutLocking(abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)

GetLedgerStateForLSMIWithoutLocking returns all balances for the current solid milestone. ReadLockLedger must be held while entering this function.

func GetLedgerStateForMilestone

func GetLedgerStateForMilestone(targetIndex milestone.Index, abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)

func GetLedgerStateForMilestoneWithoutLocking

func GetLedgerStateForMilestoneWithoutLocking(targetIndex milestone.Index, abortSignal <-chan struct{}) (map[string]uint64, milestone.Index, error)

func GetMilestoneMerkleHashFunc added in v0.5.0

func GetMilestoneMerkleHashFunc() crypto.Hash

func GetMilestoneStorageSize

func GetMilestoneStorageSize() int

func GetSolidMilestoneIndex

func GetSolidMilestoneIndex() milestone.Index

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 GetStoredTransactionOrNil

func GetStoredTransactionOrNil(txHash hornet.Hash) *hornet.Transaction

GetStoredTransactionOrNil returns a transaction object without accessing the cache layer.

func GetTagHashes

func GetTagHashes(txTag hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes

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

func GetUnconfirmedTxHashes(msIndex milestone.Index, forceRelease bool) hornet.Hashes

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 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 IsNodeSynced

func IsNodeSynced() bool

IsNodeSynced returns whether the node is synced.

func IsNodeSyncedWithThreshold

func IsNodeSyncedWithThreshold() bool

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

func LoadInitialValuesFromDatabase

func LoadInitialValuesFromDatabase()

func MarkAddressAsSpent

func MarkAddressAsSpent(address hornet.Hash) bool

spentAddress +-0

func MarkAddressAsSpentWithoutLocking

func MarkAddressAsSpentWithoutLocking(address hornet.Hash) bool

spentAddress +-0

func MarkDatabaseCorrupted

func MarkDatabaseCorrupted()

func MarkDatabaseHealthy

func MarkDatabaseHealthy()

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

func OverwriteSolidMilestoneIndex(index milestone.Index)

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(tx *hornet.Transaction) 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 ResetSolidEntryPoints

func ResetSolidEntryPoints()

WriteLockSolidEntryPoints must be held while entering this function

func SearchLatestMilestoneIndexInStore

func SearchLatestMilestoneIndexInStore() milestone.Index

SearchLatestMilestoneIndexInStore searches the latest milestone without accessing the cache layer.

func SetLatestMilestoneIndex

func SetLatestMilestoneIndex(index milestone.Index, updateSynced ...bool) bool

SetLatestMilestoneIndex sets the latest milestone index.

func SetLatestSeenMilestoneIndexFromSnapshot

func SetLatestSeenMilestoneIndexFromSnapshot(milestoneIndex milestone.Index)

func SetSnapshotInfo

func SetSnapshotInfo(sn *SnapshotInfo)

func SetSnapshotMilestone

func SetSnapshotMilestone(coordinatorAddress hornet.Hash, milestoneHash hornet.Hash, snapshotIndex milestone.Index, entryPointIndex milestone.Index, pruningIndex milestone.Index, timestamp int64, spentAddressesEnabled bool)

func SetSolidMilestoneIndex

func SetSolidMilestoneIndex(index milestone.Index, updateSynced ...bool)

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 added in v0.5.0

func ShutdownStorages()

func ShutdownTagsStorage

func ShutdownTagsStorage()

func ShutdownTransactionStorage

func ShutdownTransactionStorage()

func ShutdownUnconfirmedTxsStorage

func ShutdownUnconfirmedTxsStorage()

func SolidEntryPointsAdd

func SolidEntryPointsAdd(txHash hornet.Hash, milestoneIndex milestone.Index)

WriteLockSolidEntryPoints must be held while entering this function

func SolidEntryPointsContain

func SolidEntryPointsContain(txHash hornet.Hash) bool

func SolidEntryPointsIndex added in v0.4.1

func SolidEntryPointsIndex(txHash hornet.Hash) (milestone.Index, bool)

func StoreLedgerBalancesInDatabase

func StoreLedgerBalancesInDatabase(balances map[string]uint64, index milestone.Index) error

func StoreSnapshotBalancesInDatabase

func StoreSnapshotBalancesInDatabase(balances map[string]uint64, index milestone.Index) error

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 StreamSpentAddressesToWriter

func StreamSpentAddressesToWriter(buf io.Writer, abortSignal <-chan struct{}) (int32, error)

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 TransactionHashCaller added in v0.4.1

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

func WasAddressSpentFrom

func WasAddressSpentFrom(address hornet.Hash) bool

spentAddress +-0

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 Bundle

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

Storable Object

func (*Bundle) ApplySpentAddresses

func (bundle *Bundle) ApplySpentAddresses()

func (*Bundle) GetBranch

func (bundle *Bundle) GetBranch(forceRelease bool) hornet.Hash

func (*Bundle) GetBundleHash

func (bundle *Bundle) GetBundleHash() hornet.Hash

func (*Bundle) GetHead

func (bundle *Bundle) GetHead() *CachedTransaction

func (*Bundle) GetLedgerChanges

func (bundle *Bundle) GetLedgerChanges() map[string]int64

func (*Bundle) GetMetadata

func (bundle *Bundle) GetMetadata() byte

func (*Bundle) GetMilestoneHash

func (bundle *Bundle) GetMilestoneHash() hornet.Hash

func (*Bundle) GetMilestoneIndex

func (bundle *Bundle) GetMilestoneIndex() milestone.Index

func (*Bundle) GetMilestoneMerkleTreeHash added in v0.5.0

func (bundle *Bundle) GetMilestoneMerkleTreeHash() []byte

func (*Bundle) GetTail

func (bundle *Bundle) GetTail() *CachedTransaction

func (*Bundle) GetTailHash

func (bundle *Bundle) GetTailHash() hornet.Hash

func (*Bundle) GetTransactions

func (bundle *Bundle) GetTransactions() CachedTransactions

func (*Bundle) GetTrunk

func (bundle *Bundle) GetTrunk(forceRelease bool) hornet.Hash

func (*Bundle) GetTxHashes

func (bundle *Bundle) GetTxHashes() hornet.Hashes

func (*Bundle) IsConfirmed

func (bundle *Bundle) IsConfirmed() bool

func (*Bundle) IsConflicting added in v0.5.0

func (bundle *Bundle) IsConflicting() bool

func (*Bundle) IsInvalidPastCone added in v0.5.0

func (bundle *Bundle) IsInvalidPastCone() bool

func (*Bundle) IsMilestone

func (bundle *Bundle) IsMilestone() bool

func (*Bundle) IsSolid

func (bundle *Bundle) IsSolid() bool

func (*Bundle) IsValid

func (bundle *Bundle) IsValid() bool

func (*Bundle) IsValueSpam

func (bundle *Bundle) IsValueSpam() bool

func (*Bundle) ObjectStorageKey

func (bundle *Bundle) ObjectStorageKey() []byte

func (*Bundle) ObjectStorageValue

func (bundle *Bundle) ObjectStorageValue() (data []byte)

func (*Bundle) SetInvalidPastCone added in v0.5.0

func (bundle *Bundle) SetInvalidPastCone(invalidPastCone bool)

func (*Bundle) UnmarshalObjectStorageValue

func (bundle *Bundle) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)

func (*Bundle) Update

func (bundle *Bundle) Update(_ objectstorage.StorableObject)

ObjectStorage interface

func (*Bundle) ValidStrictSemantics

func (bundle *Bundle) ValidStrictSemantics() bool

type BundleTransaction

type BundleTransaction struct {
	objectstorage.StorableObjectFlags

	// Key
	BundleHash []byte
	IsTail     bool
	TxHash     []byte
}

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

func (bt *BundleTransaction) UnmarshalObjectStorageValue(_ []byte) (consumedBytes int, err error)

func (*BundleTransaction) Update

ObjectStorage interface

type CachedAddress

type CachedAddress struct {
	objectstorage.CachedObject
}

func StoreAddress

func StoreAddress(address hornet.Hash, txHash hornet.Hash, isValue bool) *CachedAddress

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 CachedMilestone

type CachedMilestone struct {
	objectstorage.CachedObject
}

Cached Object

func GetCachedMilestoneOrNil

func GetCachedMilestoneOrNil(milestoneIndex milestone.Index) *CachedMilestone

milestone +1

func StoreMilestone

func StoreMilestone(bndl *Bundle) *CachedMilestone

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
}

func StoreTag

func StoreTag(txTag hornet.Hash, txHash hornet.Hash) *CachedTag

tag +1

func (*CachedTag) GetTag

func (c *CachedTag) GetTag() *hornet.Tag

type CachedTags

type CachedTags []*CachedTag

func (CachedTags) Release

func (cachedTags CachedTags) Release(force ...bool)

tag -1

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

func (c *CachedTransaction) ConsumeTransaction(consumer func(*hornet.Transaction, *hornet.TransactionMetadata))

tx -1

func (*CachedTransaction) Exists

func (c *CachedTransaction) Exists() bool

func (*CachedTransaction) GetMetadata

func (c *CachedTransaction) GetMetadata() *hornet.TransactionMetadata

func (*CachedTransaction) GetTransaction

func (c *CachedTransaction) GetTransaction() *hornet.Transaction

func (*CachedTransaction) Release

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

tx -1

func (*CachedTransaction) Retain

func (c *CachedTransaction) Retain() *CachedTransaction

tx +1

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 Milestone

type Milestone struct {
	objectstorage.StorableObjectFlags

	Index milestone.Index
	Hash  hornet.Hash
}

Storable Object

func (*Milestone) ObjectStorageKey

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

func (*Milestone) ObjectStorageValue

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

func (*Milestone) UnmarshalObjectStorageValue

func (ms *Milestone) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)

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 though 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 TransactionConsumer

type TransactionConsumer func(cachedTx objectstorage.CachedObject, cachedTxMeta objectstorage.CachedObject)

type TransactionHashBytesConsumer

type TransactionHashBytesConsumer func(txHash hornet.Hash) bool

Jump to

Keyboard shortcuts

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