grpcserver

package
v0.2.26-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 32 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

func NewActivationService added in v1.0.0

func NewActivationService(atxProvider api.AtxProvider) *activationService

Types

type DebugService added in v0.1.16

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

DebugService exposes global state data, output from the STF.

func NewDebugService added in v0.1.16

func NewDebugService(conState api.ConservativeState, host api.NetworkIdentity) *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) NetworkInfo added in v1.0.0

func (d DebugService) NetworkInfo(ctx context.Context, _ *empty.Empty) (*pb.NetworkInfoResponse, error)

NetworkInfo query provides NetworkInfoResponse.

func (DebugService) ProposalsStream added in v1.0.0

func (d DebugService) ProposalsStream(_ *emptypb.Empty, stream pb.DebugService_ProposalsStreamServer) error

ProposalsStream streams all proposals confirmed by hare.

func (DebugService) RegisterService added in v0.1.16

func (d DebugService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

type GlobalStateService

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

GlobalStateService exposes global state data, output from the STF.

func NewGlobalStateService

func NewGlobalStateService(msh api.MeshAPI, conState api.ConservativeState) *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 {
	// 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) Shutdown added in v1.0.0

func (s *JSONHTTPServer) Shutdown(ctx context.Context) error

Shutdown 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 {
	// contains filtered or unexported fields
}

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

func NewMeshService

func NewMeshService(
	msh api.MeshAPI, cstate api.ConservativeState, genTime api.GenesisTimeAPI,
	layersPerEpoch uint32, genesisID types.Hash20, layerDuration time.Duration,
	layerAvgSize uint32, txsPerProposal uint32,
) *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) EpochStream added in v1.0.0

func (MeshService) GenesisID added in v1.0.0

GenesisID returns the network ID.

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) RegisterService

func (s MeshService) RegisterService(server *Server)

RegisterService registers this service with a grpc server instance.

type NodeService

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

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(
	appCtx context.Context, peers api.PeerCounter, msh api.MeshAPI, 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) 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) UpdatePoetServers

UpdatePoetServers 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, opts ...grpc.ServerOption) *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.PostSetupProvider, smeshing api.SmeshingAPI, streamInterval time.Duration) *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 {
	// contains filtered or unexported fields
}

TransactionService exposes transaction data, and a submit tx endpoint.

func NewTransactionService

func NewTransactionService(
	db *sql.Database,
	publisher api.Publisher,
	msh api.MeshAPI,
	conState api.ConservativeState,
	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) StreamResults added in v1.0.0

StreamResults allows to query historical results and subscribe to live data using the same filter.

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