service

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MAXBLOCKS = 50

MAXBLOCKS is the maximum number of blocks returned by the /blocks/ endpoint

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Service ...

func NewService

func NewService(bindAddress string, n *node.Node, logger *logrus.Entry) *Service

NewService ...

func (*Service) GetAllValidatorSets added in v0.5.4

func (s *Service) GetAllValidatorSets(w http.ResponseWriter, r *http.Request)

GetAllValidatorSets returns the entire map of round to validator-sets which represents the history of the validator-set from the inception of the network.

Get /history returns: JSON map[int][]peers.Peer

func (*Service) GetBlock

func (s *Service) GetBlock(w http.ResponseWriter, r *http.Request)

GetBlock - DEPRECATED used /blocks/ instead

func (*Service) GetBlocks added in v0.5.4

func (s *Service) GetBlocks(w http.ResponseWriter, r *http.Request)

GetBlocks will fetch an array of blocks starting at {startIndex} and finishing {counts<=MAXBLOCKS} blocks later. If no count param is provided it will just return the index requested rather than listing blocks.

GET /blocks/{startIndex}?count={x} example: /blocks/0?count=50 returns: JSON []hashgraph.Block

func (*Service) GetGenesisPeers added in v0.5.0

func (s *Service) GetGenesisPeers(w http.ResponseWriter, r *http.Request)

GetGenesisPeers returns the genesis validator-set

Get /genesispeers returns: JSON []peers.Peer

func (*Service) GetGraph added in v0.4.1

func (s *Service) GetGraph(w http.ResponseWriter, r *http.Request)

GetGraph ...

func (*Service) GetPeers added in v0.4.1

func (s *Service) GetPeers(w http.ResponseWriter, r *http.Request)

GetPeers returns the node's current peers, which is not necessarily equivalent to the current validator-set.

GET /peers returns: JSON []peers.Peer

func (*Service) GetStats

func (s *Service) GetStats(w http.ResponseWriter, r *http.Request)

GetStats ...

func (*Service) GetValidatorSet added in v0.5.4

func (s *Service) GetValidatorSet(w http.ResponseWriter, r *http.Request)

GetValidatorSet returns the validator-set associated to a specific hashgraph round. If no round is specified, it returns the current validator-set.

Get /validators/{round} returns: JSON []peers.Peer

func (*Service) Serve

func (s *Service) Serve()

Serve calls ListenAndServe. This is a blocking call. It is not necessary to call Serve when Babble is used in-memory and another server has already been started with the DefaultServerMux and the same address:port combination. Indeed, Babble API handlers have already been registered when the service was instantiated.

Jump to

Keyboard shortcuts

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