tangle

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0, BSD-2-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPROVERS_CACHE_SIZE = 50000
)
View Source
const (
	BUNDLE_CACHE_SIZE = 500
)
View Source
const (
	TRANSACTION_CACHE_SIZE = 500
)
View Source
const (
	TRANSACTION_METADATA_CACHE_SIZE = 500
)
View Source
const UnsolidInterval = time.Minute

Variables

View Source
var (
	ErrDatabaseError = errors.New("database error")
)
View Source
var Events = struct {
	TransactionStored *events.Event
	TransactionSolid  *events.Event
}{
	TransactionStored: events.NewEvent(transactionCaller),
	TransactionSolid:  events.NewEvent(transactionCaller),
}
View Source
var PLUGIN = node.NewPlugin("Tangle", node.Enabled, configure, run)

Functions

func ContainsApprovers

func ContainsApprovers(transactionHash trinary.Trytes) (result bool, err error)

func ContainsBundle

func ContainsBundle(headerTransactionHash trinary.Trytes) (result bool, err error)

func ContainsTransaction

func ContainsTransaction(transactionHash trinary.Trytes) (result bool, err error)

func ContainsTransactionMetadata

func ContainsTransactionMetadata(transactionHash trinary.Trytes) (result bool, err error)

func DeleteTransactionHashForAddressInDatabase

func DeleteTransactionHashForAddressInDatabase(address *TxHashForAddress) error

func FlushApproversCache

func FlushApproversCache()

func FlushBundleCache

func FlushBundleCache()

func FlushTransactionCache

func FlushTransactionCache()

func FlushTransactionMetadata

func FlushTransactionMetadata()

func GetApprovers

func GetApprovers(transactionHash trinary.Trytes, computeIfAbsent ...func(trinary.Trytes) *approvers.Approvers) (result *approvers.Approvers, err error)

GetApprovers retrieves approvers from the database.

func GetBundle

func GetBundle(headerTransactionHash trinary.Trytes, computeIfAbsent ...func(trinary.Trytes) (*bundle.Bundle, error)) (result *bundle.Bundle, err error)

GetBundle retrieves bundle from the database.

func GetTransaction

func GetTransaction(transactionHash trinary.Trytes, computeIfAbsent ...func(trinary.Trytes) *value_transaction.ValueTransaction) (result *value_transaction.ValueTransaction, err error)

func GetTransactionMetadata

func GetTransactionMetadata(transactionHash trinary.Trytes, computeIfAbsent ...func(trinary.Trytes) *transactionmetadata.TransactionMetadata) (result *transactionmetadata.TransactionMetadata, err error)

func ReadTransactionHashesForAddressFromDatabase

func ReadTransactionHashesForAddressFromDatabase(address trinary.Hash) ([]trinary.Hash, error)

func SetRequester

func SetRequester(req Requester)

func StoreApprovers

func StoreApprovers(approvers *approvers.Approvers)

func StoreBundle

func StoreBundle(bundle *bundle.Bundle)

func StoreTransaction

func StoreTransaction(transaction *value_transaction.ValueTransaction)

func StoreTransactionHashForAddressInDatabase

func StoreTransactionHashForAddressInDatabase(address *TxHashForAddress) error

func StoreTransactionMetadata

func StoreTransactionMetadata(transactionMetadata *transactionmetadata.TransactionMetadata)

Types

type Info

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

type Requester

type Requester interface {
	RequestTransaction(hash trinary.Hash)
}

Requester provides the functionality to request a transaction from the network.

type RequesterFunc

type RequesterFunc func(hash trinary.Hash)

func (RequesterFunc) RequestTransaction

func (f RequesterFunc) RequestTransaction(hash trinary.Hash)

type TxHashForAddress

type TxHashForAddress struct {
	Address trinary.Hash
	TxHash  trinary.Hash
}

type UnsolidTxs

type UnsolidTxs struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewUnsolidTxs

func NewUnsolidTxs() *UnsolidTxs

func (*UnsolidTxs) Add

func (u *UnsolidTxs) Add(hash string) bool

func (*UnsolidTxs) Remove

func (u *UnsolidTxs) Remove(hash string)

func (*UnsolidTxs) Update

func (u *UnsolidTxs) Update(targetTime time.Time) (result []string)

Jump to

Keyboard shortcuts

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