Documentation
¶
Index ¶
- Variables
- func NewActivationService(atxProvider api.AtxProvider) *activationService
- type DebugService
- func (d DebugService) Accounts(_ context.Context, in *empty.Empty) (*pb.AccountsResponse, error)
- func (d DebugService) NetworkInfo(ctx context.Context, _ *empty.Empty) (*pb.NetworkInfoResponse, error)
- func (d DebugService) ProposalsStream(_ *emptypb.Empty, stream pb.DebugService_ProposalsStreamServer) error
- func (d DebugService) RegisterService(server *Server)
- 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) GenesisID(context.Context, *pb.GenesisIDRequest) (*pb.GenesisIDResponse, 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) RegisterService(server *Server)
- type NodeService
- func (s NodeService) Build(context.Context, *empty.Empty) (*pb.BuildResponse, error)
- 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(context.Context, *pb.SyncStartRequest) (*pb.SyncStartResponse, error)
- func (s NodeService) UpdatePoetServers(ctx context.Context, req *pb.UpdatePoetServersRequest) (*pb.UpdatePoetServersResponse, 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) StreamResults(in *pb.TransactionResultsRequest, ...) error
- 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 ¶
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
func (d DebugService) Accounts(_ context.Context, in *empty.Empty) (*pb.AccountsResponse, error)
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 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(verifier api.ChallengeVerifier) *GatewayService
NewGatewayService creates a new grpc service using config data.
func (*GatewayService) RegisterService ¶ added in v0.1.16
func (s *GatewayService) RegisterService(server *Server)
RegisterService registers this service with a grpc server instance.
func (*GatewayService) VerifyChallenge ¶
func (s *GatewayService) VerifyChallenge(ctx context.Context, in *pb.VerifyChallengeRequest) (*pb.VerifyChallengeResponse, error)
VerifyChallenge implements v1.GatewayServiceServer.
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 ¶
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 ¶
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 ¶
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) GenesisID ¶ added in v1.0.0
func (s MeshService) GenesisID(context.Context, *pb.GenesisIDRequest) (*pb.GenesisIDResponse, error)
GenesisID returns the network ID.
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) 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 ¶
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(context.Context, *pb.SyncStartRequest) (*pb.SyncStartResponse, error)
SyncStart requests that the node start syncing the mesh (if it isn't already syncing).
func (NodeService) UpdatePoetServers ¶
func (s NodeService) UpdatePoetServers(ctx context.Context, req *pb.UpdatePoetServersRequest) (*pb.UpdatePoetServersResponse, error)
UpdatePoetServers 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 ¶
func NewServerWithInterface(port int, intfce string, opts ...grpc.ServerOption) *Server
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.PostSetupProvider, smeshing api.SmeshingAPI, streamInterval time.Duration) *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 {
// 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
func (s TransactionService) StreamResults(in *pb.TransactionResultsRequest, stream pb.TransactionService_StreamResultsServer) error
StreamResults allows to query historical results and subscribe to live data using the same filter.
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.