database

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	StorePrefixWhiteFlag               byte = 17
)
View Source
const (
	TransactionMetadataSolid       = 0
	TransactionMetadataConfirmed   = 1
	TransactionMetadataConflicting = 2
	TransactionMetadataIsHead      = 3
	TransactionMetadataIsTail      = 4
	TransactionMetadataIsValue     = 5
)
View Source
const (
	AddressTxIsValue = 1
)
View Source
const (
	BundleTxIsTail = 1
)
View Source
const (
	DBVersion = 2
)
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")
)

Functions

This section is empty.

Types

type Bundle

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

func (*Bundle) GetHead

func (bundle *Bundle) GetHead() *Transaction

func (*Bundle) GetLedgerChanges

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

func (*Bundle) GetMilestoneHash

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

func (*Bundle) GetMilestoneIndex

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

func (*Bundle) GetTail

func (bundle *Bundle) GetTail() *Transaction

func (*Bundle) GetTailHash

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

func (*Bundle) GetTransactions

func (bundle *Bundle) GetTransactions() []*Transaction

func (*Bundle) IsValid

func (bundle *Bundle) IsValid() bool

func (*Bundle) IsValueSpam

func (bundle *Bundle) IsValueSpam() bool

func (*Bundle) Unmarshal

func (bundle *Bundle) Unmarshal(data []byte) error

type Database

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

func New

func New(tangleDatabase, snapshotDatabase, spentDatabase kvstore.KVStore, skipHealthCheck bool) (*Database, error)

func (*Database) CloseDatabases

func (db *Database) CloseDatabases() error

func (*Database) ContainsAddress

func (db *Database) ContainsAddress(address hornet.Hash, txHash hornet.Hash, valueOnly bool) bool

ContainsAddress returns if the given address exists in the cache/persistence layer.

func (*Database) ContainsApprover

func (db *Database) ContainsApprover(txHash hornet.Hash, approverHash hornet.Hash) bool

ContainsApprover returns if the given approver exists in the cache/persistence layer.

func (*Database) ContainsTag

func (db *Database) ContainsTag(txTag hornet.Hash, txHash hornet.Hash) bool

ContainsTag returns if the given tag exists in the cache/persistence layer.

func (*Database) GetApproverHashes

func (db *Database) GetApproverHashes(txHash hornet.Hash, maxFind ...int) hornet.Hashes

func (*Database) GetBalanceForAddress

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

func (*Database) GetBundleOrNil

func (db *Database) GetBundleOrNil(tailTxHash hornet.Hash) *Bundle

func (*Database) GetBundleTransactionHashes

func (db *Database) GetBundleTransactionHashes(bundleHash hornet.Hash, forceRelease bool, maxFind ...int) hornet.Hashes

func (*Database) GetLatestSolidMilestoneBundle

func (db *Database) GetLatestSolidMilestoneBundle() *Bundle

GetLatestSolidMilestoneBundle returns the latest solid milestone bundle.

func (*Database) GetLedgerDiffForMilestone

func (db *Database) GetLedgerDiffForMilestone(ctx context.Context, targetIndex milestone.Index) (map[string]int64, error)

GetLedgerDiffForMilestone returns the ledger changes of that specific milestone.

func (*Database) GetLedgerIndex

func (db *Database) GetLedgerIndex() milestone.Index

func (*Database) GetLedgerStateForLSMI

func (db *Database) GetLedgerStateForLSMI(ctx context.Context) (map[string]uint64, milestone.Index, error)

GetLedgerStateForLSMI returns all balances for the current solid milestone.

func (*Database) GetLedgerStateForMilestone

func (db *Database) GetLedgerStateForMilestone(ctx context.Context, targetIndex milestone.Index) (map[string]uint64, milestone.Index, error)

func (*Database) GetMilestoneBundleOrNil

func (db *Database) GetMilestoneBundleOrNil(milestoneIndex milestone.Index) *Bundle

GetMilestoneBundleOrNil returns the Bundle of a milestone index or nil if it doesn't exist.

func (*Database) GetMilestoneOrNil

func (db *Database) GetMilestoneOrNil(milestoneIndex milestone.Index) *Milestone

func (*Database) GetSolidMilestoneIndex

func (db *Database) GetSolidMilestoneIndex() milestone.Index

GetSolidMilestoneIndex returns the latest solid milestone index.

func (*Database) GetTagHashes

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

func (*Database) GetTransactionHashesForAddress

func (db *Database) GetTransactionHashesForAddress(address hornet.Hash, valueOnly bool, forceRelease bool, maxFind ...int) hornet.Hashes

func (*Database) GetTransactionOrNil

func (db *Database) GetTransactionOrNil(txHash hornet.Hash) *Transaction

func (*Database) GetTxMetadataOrNil

func (db *Database) GetTxMetadataOrNil(txHash hornet.Hash) *TransactionMetadata

func (*Database) LatestSyncState

func (db *Database) LatestSyncState() *SyncState

func (*Database) SolidEntryPointsContain

func (db *Database) SolidEntryPointsContain(txHash hornet.Hash) bool

func (*Database) WasAddressSpentFrom

func (db *Database) WasAddressSpentFrom(address hornet.Hash) bool

type Milestone

type Milestone struct {
	Index milestone.Index
	Hash  hornet.Hash
}

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 (*SnapshotInfo) IsSpentAddressesEnabled

func (i *SnapshotInfo) IsSpentAddressesEnabled() bool

type SolidEntryPoints

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

func (*SolidEntryPoints) Add

func (s *SolidEntryPoints) Add(txHash hornet.Hash, milestoneIndex milestone.Index)

type SyncState

type SyncState struct {
	LatestMilestone                    trinary.Hash
	LatestMilestoneIndex               milestone.Index
	LatestSolidSubtangleMilestone      trinary.Hash
	LatestSolidSubtangleMilestoneIndex milestone.Index
	MilestoneStartIndex                milestone.Index
	LastSnapshottedMilestoneIndex      milestone.Index
	CoordinatorAddress                 trinary.Hash
}

type Transaction

type Transaction struct {

	// Decompressed iota.go Transaction containing Hash
	Tx *transaction.Transaction
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(txHash hornet.Hash) *Transaction

func (*Transaction) GetBranchHash

func (tx *Transaction) GetBranchHash() hornet.Hash

func (*Transaction) GetBundleHash

func (tx *Transaction) GetBundleHash() hornet.Hash

func (*Transaction) GetTrunkHash

func (tx *Transaction) GetTrunkHash() hornet.Hash

func (*Transaction) IsHead

func (tx *Transaction) IsHead() bool

func (*Transaction) IsTail

func (tx *Transaction) IsTail() bool

func (*Transaction) IsValue

func (tx *Transaction) IsValue() bool

func (*Transaction) Unmarshal

func (tx *Transaction) Unmarshal(data []byte) error

type TransactionMetadata

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

func NewTransactionMetadata

func NewTransactionMetadata(txHash hornet.Hash) *TransactionMetadata

func (*TransactionMetadata) GetBranchHash

func (m *TransactionMetadata) GetBranchHash() hornet.Hash

func (*TransactionMetadata) GetBundleHash

func (m *TransactionMetadata) GetBundleHash() hornet.Hash

func (*TransactionMetadata) GetConfirmed

func (m *TransactionMetadata) GetConfirmed() (bool, milestone.Index)

func (*TransactionMetadata) GetTrunkHash

func (m *TransactionMetadata) GetTrunkHash() hornet.Hash

func (*TransactionMetadata) GetTxHash

func (m *TransactionMetadata) GetTxHash() hornet.Hash

func (*TransactionMetadata) IsConfirmed

func (m *TransactionMetadata) IsConfirmed() bool

func (*TransactionMetadata) IsConflicting

func (m *TransactionMetadata) IsConflicting() bool

func (*TransactionMetadata) IsTail

func (m *TransactionMetadata) IsTail() bool

func (*TransactionMetadata) SetAdditionalTxInfo

func (m *TransactionMetadata) SetAdditionalTxInfo(trunkHash hornet.Hash, branchHash hornet.Hash, bundleHash hornet.Hash, isHead bool, isTail bool, isValue bool)

func (*TransactionMetadata) Unmarshal

func (m *TransactionMetadata) Unmarshal(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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