facade

package
v1.0.61 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRestInterface = "localhost:8080"

DefaultRestInterface is the default interface the rest API will start on if not specified

View Source
const DefaultRestPortOff = "off"

DefaultRestPortOff is the default value that should be passed if it is desired

to start the node without a REST endpoint available

Variables

View Source
var ErrHeartbeatsNotActive = errors.New("heartbeat system not active")

ErrHeartbeatsNotActive signals that the heartbeat system is not active

Functions

This section is empty.

Types

type ApiResolver

type ApiResolver interface {
	ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)
	StatusMetrics() external.StatusMetricsHandler
	IsInterfaceNil() bool
}

ApiResolver defines a structure capable of resolving REST API requests

type ElrondNodeFacade

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

ElrondNodeFacade represents a facade for grouping the functionality for node, transaction and address

func NewElrondNodeFacade

func NewElrondNodeFacade(node NodeWrapper, apiResolver ApiResolver, restAPIServerDebugMode bool) *ElrondNodeFacade

NewElrondNodeFacade creates a new Facade with a NodeWrapper

func (*ElrondNodeFacade) CreateTransaction

func (ef *ElrondNodeFacade) CreateTransaction(
	nonce uint64,
	value string,
	receiverHex string,
	senderHex string,
	gasPrice uint64,
	gasLimit uint64,
	data string,
	signatureHex string,
	challenge string,
) (*transaction.Transaction, error)

CreateTransaction creates a transaction from all needed fields

func (*ElrondNodeFacade) ExecuteSCQuery

func (ef *ElrondNodeFacade) ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

ExecuteSCQuery retrieves data from existing SC trie

func (*ElrondNodeFacade) GetAccount

func (ef *ElrondNodeFacade) GetAccount(address string) (*state.Account, error)

GetAccount returns an accountResponse containing information about the account correlated with provided address

func (*ElrondNodeFacade) GetBalance

func (ef *ElrondNodeFacade) GetBalance(address string) (*big.Int, error)

GetBalance gets the current balance for a specified address

func (*ElrondNodeFacade) GetCurrentPublicKey added in v1.0.3

func (ef *ElrondNodeFacade) GetCurrentPublicKey() string

GetCurrentPublicKey is just a mock method to satisfies FacadeHandler TODO: Remove this method when it will not be used in elrond facade

func (*ElrondNodeFacade) GetHeartbeats

func (ef *ElrondNodeFacade) GetHeartbeats() ([]heartbeat.PubKeyHeartbeat, error)

GetHeartbeats returns the heartbeat status for each public key from initial list or later joined to the network

func (*ElrondNodeFacade) GetTransaction

func (ef *ElrondNodeFacade) GetTransaction(hash string) (*transaction.Transaction, error)

GetTransaction gets the transaction with a specified hash

func (*ElrondNodeFacade) IsInterfaceNil

func (ef *ElrondNodeFacade) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ElrondNodeFacade) IsNodeRunning

func (ef *ElrondNodeFacade) IsNodeRunning() bool

IsNodeRunning gets if the underlying node is running

func (*ElrondNodeFacade) PprofEnabled

func (ef *ElrondNodeFacade) PprofEnabled() bool

PprofEnabled returns if profiling mode should be active or not on the application

func (*ElrondNodeFacade) PrometheusJoinURL added in v1.0.11

func (ef *ElrondNodeFacade) PrometheusJoinURL() string

PrometheusJoinURL will return the join URL from server.toml

func (*ElrondNodeFacade) PrometheusMonitoring added in v1.0.11

func (ef *ElrondNodeFacade) PrometheusMonitoring() bool

PrometheusMonitoring returns if prometheus is enabled for monitoring by the flag

func (*ElrondNodeFacade) PrometheusNetworkID added in v1.0.11

func (ef *ElrondNodeFacade) PrometheusNetworkID() string

PrometheusNetworkID will return the NetworkID from config.toml or the flag

func (*ElrondNodeFacade) RestAPIServerDebugMode

func (ef *ElrondNodeFacade) RestAPIServerDebugMode() bool

RestAPIServerDebugMode return true is debug mode for Rest API is enabled

func (*ElrondNodeFacade) RestApiInterface

func (ef *ElrondNodeFacade) RestApiInterface() string

RestApiInterface returns the interface on which the rest API should start on, based on the config file provided. The API will start on the DefaultRestInterface value unless a correct value is passed or

the value is explicitly set to off, in which case it will not start at all

func (*ElrondNodeFacade) SendBulkTransactions

func (ef *ElrondNodeFacade) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions will send a bulk of transactions on the topic channel

func (*ElrondNodeFacade) SendTransaction added in v1.0.3

func (ef *ElrondNodeFacade) SendTransaction(
	nonce uint64,
	senderHex string,
	receiverHex string,
	value string,
	gasPrice uint64,
	gasLimit uint64,
	transactionData string,
	signature []byte,
) (string, error)

SendTransaction will send a new transaction on the topic channel

func (*ElrondNodeFacade) SetConfig

func (ef *ElrondNodeFacade) SetConfig(facadeConfig *config.FacadeConfig)

SetConfig sets the configuration options for the facade

func (*ElrondNodeFacade) SetSyncer

func (ef *ElrondNodeFacade) SetSyncer(syncer ntp.SyncTimer)

SetSyncer sets the current syncer

func (*ElrondNodeFacade) SetTpsBenchmark

func (ef *ElrondNodeFacade) SetTpsBenchmark(tpsBenchmark *statistics.TpsBenchmark)

SetTpsBenchmark sets the tps benchmark handler

func (*ElrondNodeFacade) StartBackgroundServices

func (ef *ElrondNodeFacade) StartBackgroundServices()

StartBackgroundServices starts all background services needed for the correct functionality of the node

func (*ElrondNodeFacade) StartNode

func (ef *ElrondNodeFacade) StartNode() error

StartNode starts the underlying node

func (*ElrondNodeFacade) StatusMetrics

func (ef *ElrondNodeFacade) StatusMetrics() external.StatusMetricsHandler

StatusMetrics will return the node's status metrics

func (*ElrondNodeFacade) TpsBenchmark

func (ef *ElrondNodeFacade) TpsBenchmark() *statistics.TpsBenchmark

TpsBenchmark returns the tps benchmark handler

type NodeWrapper

type NodeWrapper interface {
	// Start will create a new messenger and and set up the Node state as running
	Start() error

	// P2PBootstrap starts the peer discovery process and peer connection filtering
	P2PBootstrap() error

	//IsRunning returns if the underlying node is running
	IsRunning() bool

	// StartConsensus will start the consesus service for the current node
	StartConsensus() error

	//GetBalance returns the balance for a specific address
	GetBalance(address string) (*big.Int, error)

	//CreateTransaction will return a transaction from all needed fields
	CreateTransaction(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64,
		gasLimit uint64, data string, signatureHex string, challenge string) (*transaction.Transaction, error)

	//SendTransaction will send a new transaction on the 'send transactions pipe' channel
	SendTransaction(nonce uint64, senderHex string, receiverHex string, value string, gasPrice uint64, gasLimit uint64, transactionData string, signature []byte) (string, error)

	//SendBulkTransactions will send a bulk of transactions on the 'send transactions pipe' channel
	SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

	//GetTransaction gets the transaction
	GetTransaction(hash string) (*transaction.Transaction, error)

	// GetAccount returns an accountResponse containing information
	//  about the account corelated with provided address
	GetAccount(address string) (*state.Account, error)

	// GetHeartbeats returns the heartbeat status for each public key defined in genesis.json
	GetHeartbeats() []heartbeat.PubKeyHeartbeat

	// IsInterfaceNil returns true if there is no value under the interface
	IsInterfaceNil() bool
}

NodeWrapper contains all functions that a node should contain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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