grpcserver

package
v0.2.10-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerOptions = []grpc.ServerOption{

	grpc.KeepaliveParams(keepalive.ServerParameters{
		MaxConnectionIdle:     time.Minute * 120,
		MaxConnectionAge:      time.Minute * 180,
		MaxConnectionAgeGrace: time.Minute * 10,
		Time:                  time.Minute,
		Timeout:               time.Minute * 3,
	}),
}

ServerOptions are shared by all grpc servers.

Functions

This section is empty.

Types

type DebugService added in v0.1.16

type DebugService struct {
	Mesh api.TxAPI
}

DebugService exposes global state data, output from the STF.

func NewDebugService added in v0.1.16

func NewDebugService(tx api.TxAPI) *DebugService

NewDebugService creates a new grpc service using config data.

func (DebugService) Accounts added in v0.1.16

Accounts returns current counter and balance for all accounts.

func (DebugService) RegisterService added in v0.1.16

func (d DebugService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

type GatewayService added in v0.1.16

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

GatewayService exposes transaction data, and a submit tx endpoint.

func NewGatewayService added in v0.1.16

func NewGatewayService(publisher api.Publisher) *GatewayService

NewGatewayService creates a new grpc service using config data.

func (GatewayService) BroadcastPoet added in v0.1.16

BroadcastPoet accepts a binary poet message to broadcast to the network.

func (GatewayService) RegisterService added in v0.1.16

func (s GatewayService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

type GlobalStateService

type GlobalStateService struct {
	Mesh    api.TxAPI
	Mempool api.MempoolAPI
}

GlobalStateService exposes global state data, output from the STF.

func NewGlobalStateService

func NewGlobalStateService(tx api.TxAPI, mempool api.MempoolAPI) *GlobalStateService

NewGlobalStateService creates a new grpc service using config data.

func (GlobalStateService) Account

Account returns current and projected counter and balance for one account.

func (GlobalStateService) AccountDataQuery

AccountDataQuery returns historical account data such as rewards and receipts.

func (GlobalStateService) AccountDataStream

AccountDataStream exposes a stream of account-related data.

func (GlobalStateService) AppEventStream

AppEventStream exposes a stream of emitted app events.

func (GlobalStateService) GlobalStateHash

GlobalStateHash returns the latest layer and its computed global state hash.

func (GlobalStateService) GlobalStateStream

GlobalStateStream exposes a stream of global data data items: rewards, receipts, account info, global state hash.

func (GlobalStateService) RegisterService

func (s GlobalStateService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

func (GlobalStateService) SmesherDataQuery

SmesherDataQuery returns historical info on smesher rewards.

func (GlobalStateService) SmesherRewardStream

SmesherRewardStream exposes a stream of smesher rewards.

type JSONHTTPServer

type JSONHTTPServer struct {
	Port     int
	GrpcPort int
	// contains filtered or unexported fields
}

JSONHTTPServer is a JSON http server providing the Spacemesh API. It is implemented using a grpc-gateway. See https://github.com/grpc-ecosystem/grpc-gateway .

func NewJSONHTTPServer

func NewJSONHTTPServer(port int) *JSONHTTPServer

NewJSONHTTPServer creates a new json http server.

func (*JSONHTTPServer) Close

func (s *JSONHTTPServer) Close() error

Close stops the server.

func (*JSONHTTPServer) StartService

func (s *JSONHTTPServer) StartService(
	ctx context.Context,
	services ...ServiceAPI,
) <-chan struct{}

StartService starts the json api server and listens for status (started, stopped).

type MeshService

type MeshService struct {
	Mesh             api.TxAPI // Mesh
	GenTime          api.GenesisTimeAPI
	LayersPerEpoch   uint32
	NetworkID        uint32
	LayerDurationSec int
	LayerAvgSize     int
	TxsPerBlock      int
}

MeshService exposes mesh data such as accounts, blocks, and transactions.

func NewMeshService

func NewMeshService(
	tx api.TxAPI, genTime api.GenesisTimeAPI,
	layersPerEpoch uint32, networkID uint32, layerDurationSec int,
	layerAvgSize int, txsPerBlock int) *MeshService

NewMeshService creates a new service using config data.

func (MeshService) AccountMeshDataQuery

AccountMeshDataQuery returns account data.

func (MeshService) AccountMeshDataStream

AccountMeshDataStream exposes a stream of transactions and activations for an account.

func (MeshService) CurrentEpoch

CurrentEpoch returns the current epoch number.

func (MeshService) CurrentLayer

CurrentLayer returns the current layer number.

func (MeshService) EpochNumLayers

EpochNumLayers returns the number of layers per epoch (a network parameter).

func (MeshService) GenesisTime

GenesisTime returns the network genesis time as UNIX time.

func (MeshService) LayerDuration

LayerDuration returns the layer duration in seconds (a network parameter).

func (MeshService) LayerStream

LayerStream exposes a stream of all mesh data per layer.

func (MeshService) LayersQuery

LayersQuery returns all mesh data, layer by layer.

func (MeshService) MaxTransactionsPerSecond

MaxTransactionsPerSecond returns the max number of tx per sec (a network parameter).

func (MeshService) NetID

NetID returns the network ID.

func (MeshService) RegisterService

func (s MeshService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

type NodeService

type NodeService struct {
	Mesh        api.TxAPI
	GenTime     api.GenesisTimeAPI
	PeerCounter api.PeerCounter
	Syncer      api.Syncer
	AtxAPI      api.ActivationAPI
}

NodeService is a grpc server that provides the NodeService, which exposes node-related data such as node status, software version, errors, etc. It can also be used to start the sync process, or to shut down the node.

func NewNodeService

func NewNodeService(
	peers api.PeerCounter, tx api.TxAPI, genTime api.GenesisTimeAPI, syncer api.Syncer, atxapi api.ActivationAPI) *NodeService

NewNodeService creates a new grpc service using config data.

func (NodeService) Build

Build returns the build of the node software.

func (NodeService) Close

func (s NodeService) Close()

Close closes underlying services.

func (NodeService) Echo

Echo returns the response for an echo api request. It's used for E2E tests.

func (NodeService) ErrorStream

ErrorStream exposes a stream of node errors.

func (NodeService) RegisterService

func (s NodeService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

func (NodeService) Shutdown

Shutdown requests a graceful shutdown.

func (NodeService) Status

Status returns a status object providing information about the connected peers, sync status, current and verified layer.

func (NodeService) StatusStream

StatusStream exposes a stream of node status updates.

func (NodeService) SyncStart

SyncStart requests that the node start syncing the mesh (if it isn't already syncing).

func (NodeService) UpdatePoetServer

UpdatePoetServer update server that is used for generating PoETs.

func (NodeService) Version

Version returns the version of the node software as a semver string.

type Server

type Server struct {
	Port       int
	Interface  string
	GrpcServer *grpc.Server
}

Server is a very basic grpc server.

func NewServerWithInterface

func NewServerWithInterface(port int, intfce string) *Server

NewServerWithInterface creates and returns a new Server with port and interface.

func (*Server) Close

func (s *Server) Close() error

Close stops the server.

func (*Server) Start

func (s *Server) Start() <-chan struct{}

Start starts the server.

type ServiceAPI

type ServiceAPI interface {
	RegisterService(*Server)
}

ServiceAPI allows individual grpc services to register the grpc server.

type SmesherService

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

SmesherService exposes endpoints to manage smeshing.

func NewSmesherService

func NewSmesherService(post api.PostSetupAPI, smeshing api.SmeshingAPI) *SmesherService

NewSmesherService creates a new grpc service using config data.

func (SmesherService) Coinbase

Coinbase returns the current coinbase setting of this node.

func (SmesherService) EstimatedRewards added in v0.1.16

EstimatedRewards returns estimated smeshing rewards over the next epoch.

func (SmesherService) IsSmeshing

IsSmeshing reports whether the node is smeshing.

func (SmesherService) MinGas

MinGas returns the current mingas setting of this node.

func (SmesherService) PostConfig added in v1.0.0

PostConfig returns the Post protocol config.

func (SmesherService) PostSetupComputeProviders

PostSetupComputeProviders returns a list of available Post setup compute providers.

func (SmesherService) PostSetupStatus added in v1.0.0

PostSetupStatus returns post data status.

func (SmesherService) PostSetupStatusStream added in v1.0.0

func (s SmesherService) PostSetupStatusStream(_ *empty.Empty, stream pb.SmesherService_PostSetupStatusStreamServer) error

PostSetupStatusStream exposes a stream of status updates during post setup.

func (SmesherService) RegisterService

func (s SmesherService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

func (SmesherService) SetCoinbase

SetCoinbase sets the current coinbase setting of this node.

func (SmesherService) SetMinGas

SetMinGas sets the mingas setting of this node.

func (SmesherService) SmesherID

SmesherID returns the smesher ID of this node.

func (SmesherService) StartSmeshing

StartSmeshing requests that the node begin smeshing.

func (SmesherService) StopSmeshing

StopSmeshing requests that the node stop smeshing.

type TransactionService

type TransactionService struct {
	Mesh    api.TxAPI // Mesh
	Mempool api.MempoolAPI
	// contains filtered or unexported fields
}

TransactionService exposes transaction data, and a submit tx endpoint.

func NewTransactionService

func NewTransactionService(
	publisher api.Publisher,
	tx api.TxAPI,
	mempool api.MempoolAPI,
	syncer api.Syncer,
) *TransactionService

NewTransactionService creates a new grpc service using config data.

func (TransactionService) RegisterService

func (s TransactionService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

func (TransactionService) SubmitTransaction

SubmitTransaction allows a new tx to be submitted.

func (TransactionService) TransactionsState

TransactionsState returns current tx data for one or more txs.

func (TransactionService) TransactionsStateStream

TransactionsStateStream exposes a stream of tx data.

Jump to

Keyboard shortcuts

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