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, *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
- func (s GlobalStateService) SmesherRewardStream(*pb.SmesherRewardStreamRequest, ...) error
- type JSONHTTPServer
- type MeshService
- func (s MeshService) AccountMeshDataQuery(_ 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(_ 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) 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(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) 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) CreatePostData(context.Context, *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, 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) PostComputeProviders(context.Context, *empty.Empty) (*pb.PostComputeProvidersResponse, error)
- func (s SmesherService) PostDataCreationProgressStream(*empty.Empty, pb.SmesherService_PostDataCreationProgressStreamServer) error
- func (s SmesherService) PostStatus(context.Context, *empty.Empty) (*pb.PostStatusResponse, 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(_ context.Context, in *pb.StartSmeshingRequest) (*pb.StartSmeshingResponse, error)
- func (s SmesherService) StopPostDataCreationSession(context.Context, *pb.StopPostDataCreationSessionRequest) (*pb.StopPostDataCreationSessionResponse, error)
- func (s SmesherService) StopSmeshing(context.Context, *pb.StopSmeshingRequest) (*pb.StopSmeshingResponse, error)
- type TransactionService
- func (s TransactionService) RegisterService(server *Server)
- func (s TransactionService) SubmitTransaction(_ 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 {
Network api.NetworkAPI // P2P Swarm
}
GatewayService exposes transaction data, and a submit tx endpoint
func NewGatewayService ¶ added in v0.1.16
func NewGatewayService(net api.NetworkAPI) *GatewayService
NewGatewayService creates a new grpc service using config data.
func (GatewayService) BroadcastPoet ¶ added in v0.1.16
func (s GatewayService) BroadcastPoet(_ 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 { Network api.NetworkAPI // P2P Swarm Mesh api.TxAPI Mempool api.MempoolAPI GenTime api.GenesisTimeAPI PeerCounter api.PeerCounter Syncer api.Syncer }
GlobalStateService exposes global state data, output from the STF
func NewGlobalStateService ¶
func NewGlobalStateService( net api.NetworkAPI, tx api.TxAPI, genTime api.GenesisTimeAPI, syncer api.Syncer, 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, *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
SmesherDataQuery returns historical info on smesher rewards
func (GlobalStateService) SmesherRewardStream ¶
func (s GlobalStateService) SmesherRewardStream(*pb.SmesherRewardStreamRequest, 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, grpcPort int) *JSONHTTPServer
NewJSONHTTPServer creates a new json http server.
func (*JSONHTTPServer) StartService ¶
func (s *JSONHTTPServer) StartService( startDebugService bool, startGatewayService bool, startGlobalStateService bool, startMeshService bool, startNodeService bool, startSmesherService bool, startTransactionService bool)
StartService starts the json api server and listens for status (started, stopped).
type MeshService ¶
type MeshService struct { Mesh api.TxAPI // Mesh Mempool api.MempoolAPI GenTime api.GenesisTimeAPI LayersPerEpoch int NetworkID int8 LayerDurationSec int LayerAvgSize int TxsPerBlock int }
MeshService exposes mesh data such as accounts, blocks, and transactions
func NewMeshService ¶
func NewMeshService( tx api.TxAPI, mempool api.MempoolAPI, genTime api.GenesisTimeAPI, layersPerEpoch int, networkID int8, layerDurationSec int, layerAvgSize int, txsPerBlock int) *MeshService
NewMeshService creates a new service using config data
func (MeshService) AccountMeshDataQuery ¶
func (s MeshService) AccountMeshDataQuery(_ 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(_ 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 }
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( net api.NetworkAPI, tx api.TxAPI, genTime api.GenesisTimeAPI, syncer api.Syncer) *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(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) 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 ¶
SmesherService exposes endpoints to manage smeshing
func NewSmesherService ¶
func NewSmesherService(miner api.MiningAPI) *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) CreatePostData ¶
func (s SmesherService) CreatePostData(context.Context, *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, error)
CreatePostData requests that the node begin post init
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) PostComputeProviders ¶
func (s SmesherService) PostComputeProviders(context.Context, *empty.Empty) (*pb.PostComputeProvidersResponse, error)
PostComputeProviders returns a list of available post compute providers
func (SmesherService) PostDataCreationProgressStream ¶
func (s SmesherService) PostDataCreationProgressStream(*empty.Empty, pb.SmesherService_PostDataCreationProgressStreamServer) error
PostDataCreationProgressStream exposes a stream of updates during post init
func (SmesherService) PostStatus ¶
func (s SmesherService) PostStatus(context.Context, *empty.Empty) (*pb.PostStatusResponse, error)
PostStatus returns post data status
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(_ context.Context, in *pb.StartSmeshingRequest) (*pb.StartSmeshingResponse, error)
StartSmeshing requests that the node begin smeshing
func (SmesherService) StopPostDataCreationSession ¶
func (s SmesherService) StopPostDataCreationSession(context.Context, *pb.StopPostDataCreationSessionRequest) (*pb.StopPostDataCreationSessionResponse, error)
StopPostDataCreationSession requests that the node stop ongoing post data creation
func (SmesherService) StopSmeshing ¶
func (s SmesherService) StopSmeshing(context.Context, *pb.StopSmeshingRequest) (*pb.StopSmeshingResponse, error)
StopSmeshing requests that the node stop smeshing
type TransactionService ¶
type TransactionService struct { Network api.NetworkAPI // P2P Swarm 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( net api.NetworkAPI, 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(_ 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