Documentation ¶
Index ¶
- Variables
- type GlobalStateService
- func (s GlobalStateService) Account(ctx context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error)
- func (s GlobalStateService) AccountDataQuery(ctx context.Context, in *pb.AccountDataQueryRequest) (*pb.AccountDataQueryResponse, error)
- func (s GlobalStateService) AccountDataStream(in *pb.AccountDataStreamRequest, ...) error
- func (s GlobalStateService) AppEventStream(request *pb.AppEventStreamRequest, ...) error
- func (s GlobalStateService) GlobalStateHash(ctx context.Context, in *pb.GlobalStateHashRequest) (*pb.GlobalStateHashResponse, error)
- func (s GlobalStateService) GlobalStateStream(in *pb.GlobalStateStreamRequest, ...) error
- func (s GlobalStateService) RegisterService(server *Server)
- func (s GlobalStateService) SmesherDataQuery(ctx context.Context, in *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
- func (s GlobalStateService) SmesherRewardStream(request *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(ctx context.Context, in *pb.CurrentEpochRequest) (*pb.CurrentEpochResponse, error)
- func (s MeshService) CurrentLayer(ctx context.Context, in *pb.CurrentLayerRequest) (*pb.CurrentLayerResponse, error)
- func (s MeshService) EpochNumLayers(ctx context.Context, in *pb.EpochNumLayersRequest) (*pb.EpochNumLayersResponse, error)
- func (s MeshService) GenesisTime(ctx context.Context, in *pb.GenesisTimeRequest) (*pb.GenesisTimeResponse, error)
- func (s MeshService) LayerDuration(ctx context.Context, in *pb.LayerDurationRequest) (*pb.LayerDurationResponse, error)
- func (s MeshService) LayerStream(in *pb.LayerStreamRequest, stream pb.MeshService_LayerStreamServer) error
- func (s MeshService) LayersQuery(ctx context.Context, in *pb.LayersQueryRequest) (*pb.LayersQueryResponse, error)
- func (s MeshService) MaxTransactionsPerSecond(ctx context.Context, in *pb.MaxTransactionsPerSecondRequest) (*pb.MaxTransactionsPerSecondResponse, error)
- func (s MeshService) NetID(ctx context.Context, in *pb.NetIDRequest) (*pb.NetIDResponse, error)
- func (s MeshService) RegisterService(server *Server)
- type NodeService
- func (s NodeService) Build(ctx context.Context, in *empty.Empty) (*pb.BuildResponse, error)
- func (s NodeService) Echo(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error)
- func (s NodeService) ErrorStream(request *pb.ErrorStreamRequest, stream pb.NodeService_ErrorStreamServer) error
- func (s NodeService) RegisterService(server *Server)
- func (s NodeService) Shutdown(ctx context.Context, request *pb.ShutdownRequest) (*pb.ShutdownResponse, error)
- func (s NodeService) Status(ctx context.Context, request *pb.StatusRequest) (*pb.StatusResponse, error)
- func (s NodeService) StatusStream(request *pb.StatusStreamRequest, stream pb.NodeService_StatusStreamServer) error
- func (s NodeService) SyncStart(ctx context.Context, request *pb.SyncStartRequest) (*pb.SyncStartResponse, error)
- func (s NodeService) Version(ctx context.Context, in *empty.Empty) (*pb.VersionResponse, error)
- type Server
- type ServiceAPI
- type SmesherService
- func (s SmesherService) Coinbase(ctx context.Context, in *empty.Empty) (*pb.CoinbaseResponse, error)
- func (s SmesherService) CreatePostData(ctx context.Context, in *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, error)
- func (s SmesherService) IsSmeshing(ctx context.Context, in *empty.Empty) (*pb.IsSmeshingResponse, error)
- func (s SmesherService) MinGas(ctx context.Context, in *empty.Empty) (*pb.MinGasResponse, error)
- func (s SmesherService) PostComputeProviders(ctx context.Context, in *empty.Empty) (*pb.PostComputeProvidersResponse, error)
- func (s SmesherService) PostDataCreationProgressStream(request *empty.Empty, ...) error
- func (s SmesherService) PostStatus(ctx context.Context, in *empty.Empty) (*pb.PostStatusResponse, error)
- func (s SmesherService) RegisterService(server *Server)
- func (s SmesherService) SetCoinbase(ctx context.Context, in *pb.SetCoinbaseRequest) (*pb.SetCoinbaseResponse, error)
- func (s SmesherService) SetMinGas(ctx context.Context, in *pb.SetMinGasRequest) (*pb.SetMinGasResponse, error)
- func (s SmesherService) SmesherID(ctx context.Context, in *empty.Empty) (*pb.SmesherIDResponse, error)
- func (s SmesherService) StartSmeshing(ctx context.Context, in *pb.StartSmeshingRequest) (*pb.StartSmeshingResponse, error)
- func (s SmesherService) StopPostDataCreationSession(ctx context.Context, in *pb.StopPostDataCreationSessionRequest) (*pb.StopPostDataCreationSessionResponse, 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(ctx 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 GlobalStateService ¶
type GlobalStateService struct { Network api.NetworkAPI // P2P Swarm Mesh api.TxAPI // Mesh 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) *GlobalStateService
NewGlobalStateService creates a new grpc service using config data.
func (GlobalStateService) Account ¶
func (s GlobalStateService) Account(ctx context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error)
Account returns counter and balance for one account
func (GlobalStateService) AccountDataQuery ¶
func (s GlobalStateService) AccountDataQuery(ctx 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(request *pb.AppEventStreamRequest, stream pb.GlobalStateService_AppEventStreamServer) error
AppEventStream exposes a stream of emitted app events
func (GlobalStateService) GlobalStateHash ¶
func (s GlobalStateService) GlobalStateHash(ctx context.Context, in *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(ctx context.Context, in *pb.SmesherDataQueryRequest) (*pb.SmesherDataQueryResponse, error)
SmesherDataQuery returns historical info on smesher rewards
func (GlobalStateService) SmesherRewardStream ¶
func (s GlobalStateService) SmesherRewardStream(request *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, grpcPort int) *JSONHTTPServer
NewJSONHTTPServer creates a new json http server.
func (*JSONHTTPServer) StartService ¶
func (s *JSONHTTPServer) StartService(startNodeService bool, startMeshService bool, startGlobalStateService 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 *state.TxMempool 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 *state.TxMempool, 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(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(ctx context.Context, in *pb.CurrentEpochRequest) (*pb.CurrentEpochResponse, error)
CurrentEpoch returns the current epoch number
func (MeshService) CurrentLayer ¶
func (s MeshService) CurrentLayer(ctx context.Context, in *pb.CurrentLayerRequest) (*pb.CurrentLayerResponse, error)
CurrentLayer returns the current layer number
func (MeshService) EpochNumLayers ¶
func (s MeshService) EpochNumLayers(ctx context.Context, in *pb.EpochNumLayersRequest) (*pb.EpochNumLayersResponse, error)
EpochNumLayers returns the number of layers per epoch (a network parameter)
func (MeshService) GenesisTime ¶
func (s MeshService) GenesisTime(ctx context.Context, in *pb.GenesisTimeRequest) (*pb.GenesisTimeResponse, error)
GenesisTime returns the network genesis time as UNIX time
func (MeshService) LayerDuration ¶
func (s MeshService) LayerDuration(ctx context.Context, in *pb.LayerDurationRequest) (*pb.LayerDurationResponse, error)
LayerDuration returns the layer duration in seconds (a network parameter)
func (MeshService) LayerStream ¶
func (s MeshService) LayerStream(in *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(ctx context.Context, in *pb.MaxTransactionsPerSecondRequest) (*pb.MaxTransactionsPerSecondResponse, error)
MaxTransactionsPerSecond returns the max number of tx per sec (a network parameter)
func (MeshService) NetID ¶
func (s MeshService) NetID(ctx context.Context, in *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(ctx context.Context, in *empty.Empty) (*pb.BuildResponse, error)
Build returns the build of the node software
func (NodeService) Echo ¶
func (s NodeService) Echo(ctx 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(request *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(ctx context.Context, request *pb.ShutdownRequest) (*pb.ShutdownResponse, error)
Shutdown requests a graceful shutdown
func (NodeService) Status ¶
func (s NodeService) Status(ctx context.Context, request *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(request *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, request *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(ctx context.Context, in *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(ctx context.Context, in *empty.Empty) (*pb.CoinbaseResponse, error)
Coinbase returns the current coinbase setting of this node
func (SmesherService) CreatePostData ¶
func (s SmesherService) CreatePostData(ctx context.Context, in *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, error)
CreatePostData requests that the node begin post init
func (SmesherService) IsSmeshing ¶
func (s SmesherService) IsSmeshing(ctx context.Context, in *empty.Empty) (*pb.IsSmeshingResponse, error)
IsSmeshing reports whether the node is smeshing
func (SmesherService) MinGas ¶
func (s SmesherService) MinGas(ctx context.Context, in *empty.Empty) (*pb.MinGasResponse, error)
MinGas returns the current mingas setting of this node
func (SmesherService) PostComputeProviders ¶
func (s SmesherService) PostComputeProviders(ctx context.Context, in *empty.Empty) (*pb.PostComputeProvidersResponse, error)
PostComputeProviders returns a list of available post compute providers
func (SmesherService) PostDataCreationProgressStream ¶
func (s SmesherService) PostDataCreationProgressStream(request *empty.Empty, stream pb.SmesherService_PostDataCreationProgressStreamServer) error
PostDataCreationProgressStream exposes a stream of updates during post init
func (SmesherService) PostStatus ¶
func (s SmesherService) PostStatus(ctx context.Context, in *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(ctx context.Context, in *pb.SetCoinbaseRequest) (*pb.SetCoinbaseResponse, error)
SetCoinbase sets the current coinbase setting of this node
func (SmesherService) SetMinGas ¶
func (s SmesherService) SetMinGas(ctx context.Context, in *pb.SetMinGasRequest) (*pb.SetMinGasResponse, error)
SetMinGas sets the mingas setting of this node
func (SmesherService) SmesherID ¶
func (s SmesherService) SmesherID(ctx context.Context, in *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) StopPostDataCreationSession ¶
func (s SmesherService) StopPostDataCreationSession(ctx context.Context, in *pb.StopPostDataCreationSessionRequest) (*pb.StopPostDataCreationSessionResponse, error)
StopPostDataCreationSession requests that the node stop ongoing post data creation
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 { Network api.NetworkAPI // P2P Swarm Mesh api.TxAPI // Mesh Mempool *state.TxMempool }
TransactionService exposes transaction data, and a submit tx endpoint
func NewTransactionService ¶
func NewTransactionService( net api.NetworkAPI, tx api.TxAPI, mempool *state.TxMempool) *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(ctx 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