Documentation ¶
Index ¶
- Variables
- type DebugService
- type GatewayService
- type GlobalStateService
- func (s GlobalStateService) Account(_ context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error)
- func (s GlobalStateService) AccountDataQuery(_ context.Context, in *pb.AccountDataQueryRequest) (*pb.AccountDataQueryResponse, error)
- func (s GlobalStateService) AccountDataStream(in *pb.AccountDataStreamRequest, ...) error
- func (s GlobalStateService) AppEventStream(*pb.AppEventStreamRequest, pb.GlobalStateService_AppEventStreamServer) error
- func (s GlobalStateService) GlobalStateHash(context.Context, *pb.GlobalStateHashRequest) (*pb.GlobalStateHashResponse, error)
- func (s GlobalStateService) GlobalStateStream(in *pb.GlobalStateStreamRequest, ...) error
- func (s GlobalStateService) RegisterService(server *Server)
- func (s GlobalStateService) SmesherDataQuery(_ context.Context, in *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
- func (s GlobalStateService) SmesherRewardStream(in *pb.SmesherRewardStreamRequest, ...) error
- type JSONHTTPServer
- type MeshService
- func (s MeshService) AccountMeshDataQuery(ctx context.Context, in *pb.AccountMeshDataQueryRequest) (*pb.AccountMeshDataQueryResponse, error)
- func (s MeshService) AccountMeshDataStream(in *pb.AccountMeshDataStreamRequest, ...) error
- func (s MeshService) CurrentEpoch(context.Context, *pb.CurrentEpochRequest) (*pb.CurrentEpochResponse, error)
- func (s MeshService) CurrentLayer(context.Context, *pb.CurrentLayerRequest) (*pb.CurrentLayerResponse, error)
- func (s MeshService) EpochNumLayers(context.Context, *pb.EpochNumLayersRequest) (*pb.EpochNumLayersResponse, error)
- func (s MeshService) GenesisTime(context.Context, *pb.GenesisTimeRequest) (*pb.GenesisTimeResponse, error)
- func (s MeshService) LayerDuration(context.Context, *pb.LayerDurationRequest) (*pb.LayerDurationResponse, error)
- func (s MeshService) LayerStream(_ *pb.LayerStreamRequest, stream pb.MeshService_LayerStreamServer) error
- func (s MeshService) LayersQuery(ctx context.Context, in *pb.LayersQueryRequest) (*pb.LayersQueryResponse, error)
- func (s MeshService) MaxTransactionsPerSecond(context.Context, *pb.MaxTransactionsPerSecondRequest) (*pb.MaxTransactionsPerSecondResponse, error)
- func (s MeshService) NetID(context.Context, *pb.NetIDRequest) (*pb.NetIDResponse, error)
- func (s MeshService) RegisterService(server *Server)
- type NodeService
- func (s NodeService) Build(context.Context, *empty.Empty) (*pb.BuildResponse, error)
- func (s NodeService) Close()
- func (s NodeService) Echo(_ context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error)
- func (s NodeService) ErrorStream(_ *pb.ErrorStreamRequest, stream pb.NodeService_ErrorStreamServer) error
- func (s NodeService) RegisterService(server *Server)
- func (s NodeService) Shutdown(context.Context, *pb.ShutdownRequest) (*pb.ShutdownResponse, error)
- func (s NodeService) Status(ctx context.Context, _ *pb.StatusRequest) (*pb.StatusResponse, error)
- func (s NodeService) StatusStream(_ *pb.StatusStreamRequest, stream pb.NodeService_StatusStreamServer) error
- func (s NodeService) SyncStart(ctx context.Context, _ *pb.SyncStartRequest) (*pb.SyncStartResponse, error)
- func (s NodeService) UpdatePoetServer(ctx context.Context, req *pb.UpdatePoetServerRequest) (*pb.UpdatePoetServerResponse, error)
- func (s NodeService) Version(context.Context, *empty.Empty) (*pb.VersionResponse, error)
- type Server
- type ServiceAPI
- type SmesherService
- func (s SmesherService) Coinbase(context.Context, *empty.Empty) (*pb.CoinbaseResponse, error)
- func (s SmesherService) EstimatedRewards(context.Context, *pb.EstimatedRewardsRequest) (*pb.EstimatedRewardsResponse, error)
- func (s SmesherService) IsSmeshing(context.Context, *empty.Empty) (*pb.IsSmeshingResponse, error)
- func (s SmesherService) MinGas(context.Context, *empty.Empty) (*pb.MinGasResponse, error)
- func (s SmesherService) PostConfig(context.Context, *empty.Empty) (*pb.PostConfigResponse, error)
- func (s SmesherService) PostSetupComputeProviders(ctx context.Context, in *pb.PostSetupComputeProvidersRequest) (*pb.PostSetupComputeProvidersResponse, error)
- func (s SmesherService) PostSetupStatus(context.Context, *empty.Empty) (*pb.PostSetupStatusResponse, error)
- func (s SmesherService) PostSetupStatusStream(_ *empty.Empty, stream pb.SmesherService_PostSetupStatusStreamServer) error
- func (s SmesherService) RegisterService(server *Server)
- func (s SmesherService) SetCoinbase(_ context.Context, in *pb.SetCoinbaseRequest) (*pb.SetCoinbaseResponse, error)
- func (s SmesherService) SetMinGas(context.Context, *pb.SetMinGasRequest) (*pb.SetMinGasResponse, error)
- func (s SmesherService) SmesherID(context.Context, *empty.Empty) (*pb.SmesherIDResponse, error)
- func (s SmesherService) StartSmeshing(ctx context.Context, in *pb.StartSmeshingRequest) (*pb.StartSmeshingResponse, error)
- func (s SmesherService) StopSmeshing(ctx context.Context, in *pb.StopSmeshingRequest) (*pb.StopSmeshingResponse, error)
- type TransactionService
- func (s TransactionService) RegisterService(server *Server)
- func (s TransactionService) SubmitTransaction(ctx context.Context, in *pb.SubmitTransactionRequest) (*pb.SubmitTransactionResponse, error)
- func (s TransactionService) TransactionsState(_ context.Context, in *pb.TransactionsStateRequest) (*pb.TransactionsStateResponse, error)
- func (s TransactionService) TransactionsStateStream(in *pb.TransactionsStateStreamRequest, ...) error
Constants ¶
This section is empty.
Variables ¶
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
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
func (d DebugService) Accounts(_ context.Context, in *empty.Empty) (*pb.AccountsResponse, error)
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
func (s GatewayService) BroadcastPoet(ctx context.Context, in *pb.BroadcastPoetRequest) (*pb.BroadcastPoetResponse, error)
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 ¶
func (s GlobalStateService) Account(_ context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error)
Account returns current and projected counter and balance for one account.
func (GlobalStateService) AccountDataQuery ¶
func (s GlobalStateService) AccountDataQuery(_ context.Context, in *pb.AccountDataQueryRequest) (*pb.AccountDataQueryResponse, error)
AccountDataQuery returns historical account data such as rewards and receipts.
func (GlobalStateService) AccountDataStream ¶
func (s GlobalStateService) AccountDataStream(in *pb.AccountDataStreamRequest, stream pb.GlobalStateService_AccountDataStreamServer) error
AccountDataStream exposes a stream of account-related data.
func (GlobalStateService) AppEventStream ¶
func (s GlobalStateService) AppEventStream(*pb.AppEventStreamRequest, pb.GlobalStateService_AppEventStreamServer) error
AppEventStream exposes a stream of emitted app events.
func (GlobalStateService) GlobalStateHash ¶
func (s GlobalStateService) GlobalStateHash(context.Context, *pb.GlobalStateHashRequest) (*pb.GlobalStateHashResponse, error)
GlobalStateHash returns the latest layer and its computed global state hash.
func (GlobalStateService) GlobalStateStream ¶
func (s GlobalStateService) GlobalStateStream(in *pb.GlobalStateStreamRequest, stream pb.GlobalStateService_GlobalStateStreamServer) error
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 ¶
func (s GlobalStateService) SmesherDataQuery(_ context.Context, in *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
SmesherDataQuery returns historical info on smesher rewards.
func (GlobalStateService) SmesherRewardStream ¶
func (s GlobalStateService) SmesherRewardStream(in *pb.SmesherRewardStreamRequest, stream pb.GlobalStateService_SmesherRewardStreamServer) error
SmesherRewardStream exposes a stream of smesher rewards.
type JSONHTTPServer ¶
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) 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 ¶
func (s MeshService) AccountMeshDataQuery(ctx context.Context, in *pb.AccountMeshDataQueryRequest) (*pb.AccountMeshDataQueryResponse, error)
AccountMeshDataQuery returns account data.
func (MeshService) AccountMeshDataStream ¶
func (s MeshService) AccountMeshDataStream(in *pb.AccountMeshDataStreamRequest, stream pb.MeshService_AccountMeshDataStreamServer) error
AccountMeshDataStream exposes a stream of transactions and activations for an account.
func (MeshService) CurrentEpoch ¶
func (s MeshService) CurrentEpoch(context.Context, *pb.CurrentEpochRequest) (*pb.CurrentEpochResponse, error)
CurrentEpoch returns the current epoch number.
func (MeshService) CurrentLayer ¶
func (s MeshService) CurrentLayer(context.Context, *pb.CurrentLayerRequest) (*pb.CurrentLayerResponse, error)
CurrentLayer returns the current layer number.
func (MeshService) EpochNumLayers ¶
func (s MeshService) EpochNumLayers(context.Context, *pb.EpochNumLayersRequest) (*pb.EpochNumLayersResponse, error)
EpochNumLayers returns the number of layers per epoch (a network parameter).
func (MeshService) GenesisTime ¶
func (s MeshService) GenesisTime(context.Context, *pb.GenesisTimeRequest) (*pb.GenesisTimeResponse, error)
GenesisTime returns the network genesis time as UNIX time.
func (MeshService) LayerDuration ¶
func (s MeshService) LayerDuration(context.Context, *pb.LayerDurationRequest) (*pb.LayerDurationResponse, error)
LayerDuration returns the layer duration in seconds (a network parameter).
func (MeshService) LayerStream ¶
func (s MeshService) LayerStream(_ *pb.LayerStreamRequest, stream pb.MeshService_LayerStreamServer) error
LayerStream exposes a stream of all mesh data per layer.
func (MeshService) LayersQuery ¶
func (s MeshService) LayersQuery(ctx context.Context, in *pb.LayersQueryRequest) (*pb.LayersQueryResponse, error)
LayersQuery returns all mesh data, layer by layer.
func (MeshService) MaxTransactionsPerSecond ¶
func (s MeshService) MaxTransactionsPerSecond(context.Context, *pb.MaxTransactionsPerSecondRequest) (*pb.MaxTransactionsPerSecondResponse, error)
MaxTransactionsPerSecond returns the max number of tx per sec (a network parameter).
func (MeshService) NetID ¶
func (s MeshService) NetID(context.Context, *pb.NetIDRequest) (*pb.NetIDResponse, error)
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 ¶
func (s NodeService) Build(context.Context, *empty.Empty) (*pb.BuildResponse, error)
Build returns the build of the node software.
func (NodeService) Echo ¶
func (s NodeService) Echo(_ context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error)
Echo returns the response for an echo api request. It's used for E2E tests.
func (NodeService) ErrorStream ¶
func (s NodeService) ErrorStream(_ *pb.ErrorStreamRequest, stream pb.NodeService_ErrorStreamServer) error
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 ¶
func (s NodeService) Shutdown(context.Context, *pb.ShutdownRequest) (*pb.ShutdownResponse, error)
Shutdown requests a graceful shutdown.
func (NodeService) Status ¶
func (s NodeService) Status(ctx context.Context, _ *pb.StatusRequest) (*pb.StatusResponse, error)
Status returns a status object providing information about the connected peers, sync status, current and verified layer.
func (NodeService) StatusStream ¶
func (s NodeService) StatusStream(_ *pb.StatusStreamRequest, stream pb.NodeService_StatusStreamServer) error
StatusStream exposes a stream of node status updates.
func (NodeService) SyncStart ¶
func (s NodeService) SyncStart(ctx context.Context, _ *pb.SyncStartRequest) (*pb.SyncStartResponse, error)
SyncStart requests that the node start syncing the mesh (if it isn't already syncing).
func (NodeService) UpdatePoetServer ¶
func (s NodeService) UpdatePoetServer(ctx context.Context, req *pb.UpdatePoetServerRequest) (*pb.UpdatePoetServerResponse, error)
UpdatePoetServer update server that is used for generating PoETs.
func (NodeService) Version ¶
func (s NodeService) Version(context.Context, *empty.Empty) (*pb.VersionResponse, error)
Version returns the version of the node software as a semver string.
type Server ¶
Server is a very basic grpc server.
func NewServerWithInterface ¶
NewServerWithInterface creates and returns a new Server with port and interface.
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 ¶
func (s SmesherService) Coinbase(context.Context, *empty.Empty) (*pb.CoinbaseResponse, error)
Coinbase returns the current coinbase setting of this node.
func (SmesherService) EstimatedRewards ¶ added in v0.1.16
func (s SmesherService) EstimatedRewards(context.Context, *pb.EstimatedRewardsRequest) (*pb.EstimatedRewardsResponse, error)
EstimatedRewards returns estimated smeshing rewards over the next epoch.
func (SmesherService) IsSmeshing ¶
func (s SmesherService) IsSmeshing(context.Context, *empty.Empty) (*pb.IsSmeshingResponse, error)
IsSmeshing reports whether the node is smeshing.
func (SmesherService) MinGas ¶
func (s SmesherService) MinGas(context.Context, *empty.Empty) (*pb.MinGasResponse, error)
MinGas returns the current mingas setting of this node.
func (SmesherService) PostConfig ¶ added in v1.0.0
func (s SmesherService) PostConfig(context.Context, *empty.Empty) (*pb.PostConfigResponse, error)
PostConfig returns the Post protocol config.
func (SmesherService) PostSetupComputeProviders ¶
func (s SmesherService) PostSetupComputeProviders(ctx context.Context, in *pb.PostSetupComputeProvidersRequest) (*pb.PostSetupComputeProvidersResponse, error)
PostSetupComputeProviders returns a list of available Post setup compute providers.
func (SmesherService) PostSetupStatus ¶ added in v1.0.0
func (s SmesherService) PostSetupStatus(context.Context, *empty.Empty) (*pb.PostSetupStatusResponse, error)
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 ¶
func (s SmesherService) SetCoinbase(_ context.Context, in *pb.SetCoinbaseRequest) (*pb.SetCoinbaseResponse, error)
SetCoinbase sets the current coinbase setting of this node.
func (SmesherService) SetMinGas ¶
func (s SmesherService) SetMinGas(context.Context, *pb.SetMinGasRequest) (*pb.SetMinGasResponse, error)
SetMinGas sets the mingas setting of this node.
func (SmesherService) SmesherID ¶
func (s SmesherService) SmesherID(context.Context, *empty.Empty) (*pb.SmesherIDResponse, error)
SmesherID returns the smesher ID of this node.
func (SmesherService) StartSmeshing ¶
func (s SmesherService) StartSmeshing(ctx context.Context, in *pb.StartSmeshingRequest) (*pb.StartSmeshingResponse, error)
StartSmeshing requests that the node begin smeshing.
func (SmesherService) StopSmeshing ¶
func (s SmesherService) StopSmeshing(ctx context.Context, in *pb.StopSmeshingRequest) (*pb.StopSmeshingResponse, error)
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 ¶
func (s TransactionService) SubmitTransaction(ctx context.Context, in *pb.SubmitTransactionRequest) (*pb.SubmitTransactionResponse, error)
SubmitTransaction allows a new tx to be submitted.
func (TransactionService) TransactionsState ¶
func (s TransactionService) TransactionsState(_ context.Context, in *pb.TransactionsStateRequest) (*pb.TransactionsStateResponse, error)
TransactionsState returns current tx data for one or more txs.
func (TransactionService) TransactionsStateStream ¶
func (s TransactionService) TransactionsStateStream(in *pb.TransactionsStateStreamRequest, stream pb.TransactionService_TransactionsStateStreamServer) error
TransactionsStateStream exposes a stream of tx data.