facade

package
v1.0.124 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: GPL-3.0 Imports: 24 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

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrNilApiResolver = errors.New("nil api resolver")

ErrNilApiResolver signals that a nil api resolver instance has been provided

View Source
var ErrNilNode = errors.New("nil node")

ErrNilNode signals that a nil node instance has been provided

View Source
var ErrNoApiRoutesConfig = errors.New("no configuration found for API routes")

ErrNoApiRoutesConfig signals that no configuration was found for API routes

Functions

func NewNodeFacade added in v1.0.102

func NewNodeFacade(arg ArgNodeFacade) (*nodeFacade, error)

NewNodeFacade creates a new Facade with a NodeWrapper

Types

type ApiResolver

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

ApiResolver defines a structure capable of resolving REST API requests

type ArgNodeFacade added in v1.0.102

type ArgNodeFacade struct {
	Node                   NodeHandler
	ApiResolver            ApiResolver
	RestAPIServerDebugMode bool
	WsAntifloodConfig      config.WebServerAntifloodConfig
	FacadeConfig           config.FacadeConfig
	ApiRoutesConfig        config.ApiRoutesConfig
}

ArgNodeFacade represents the argument for the nodeFacade

type HardforkTrigger added in v1.0.102

type HardforkTrigger interface {
	Trigger(epoch uint32) error
	IsSelfTrigger() bool
	IsInterfaceNil() bool
}

HardforkTrigger defines the structure used to trigger hardforks

type NodeHandler added in v1.0.102

type NodeHandler interface {
	// 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) (*transaction.Transaction, []byte, error)

	//ValidateTransaction will validate a transaction
	ValidateTransaction(tx *transaction.Transaction) 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.UserAccountHandler, error)

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

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

	// ValidatorStatisticsApi return the statistics for all the validators
	ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)
	DirectTrigger(epoch uint32) error
	IsSelfTrigger() bool

	EncodeAddressPubkey(pk []byte) (string, error)
	DecodeAddressPubkey(pk string) ([]byte, error)

	GetQueryHandler(name string) (debug.QueryHandler, error)
}

NodeHandler 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