Documentation
¶
Index ¶
- Variables
- type BlockchainTransactor
- type DB
- type EngineReader
- type Migrator
- type NodeApp
- type Opt
- type Service
- func (svc *Service) Account(ctx context.Context, req *userjson.AccountRequest) (*userjson.AccountResponse, *jsonrpc.Error)
- func (svc *Service) AuthenticatedQuery(ctx context.Context, req *userjson.AuthenticatedQueryRequest) (*userjson.QueryResponse, *jsonrpc.Error)
- func (svc *Service) Broadcast(ctx context.Context, req *userjson.BroadcastRequest) (*userjson.BroadcastResponse, *jsonrpc.Error)
- func (svc *Service) Call(ctx context.Context, req *userjson.CallRequest) (*userjson.CallResponse, *jsonrpc.Error)
- func (svc *Service) CallChallenge(ctx context.Context, req *userjson.ChallengeRequest) (*userjson.ChallengeResponse, *jsonrpc.Error)
- func (svc *Service) ChainInfo(ctx context.Context, req *userjson.ChainInfoRequest) (*userjson.ChainInfoResponse, *jsonrpc.Error)
- func (svc *Service) EstimatePrice(ctx context.Context, req *userjson.EstimatePriceRequest) (*userjson.EstimatePriceResponse, *jsonrpc.Error)
- func (svc *Service) Handlers() map[jsonrpc.Method]rpcserver.MethodHandler
- func (svc *Service) Health(ctx context.Context) (json.RawMessage, bool)
- func (svc *Service) HealthMethod(ctx context.Context, _ *userjson.HealthRequest) (*userjson.HealthResponse, *jsonrpc.Error)
- func (svc *Service) ListPendingConsensusUpdates(ctx context.Context, req *userjson.ListPendingConsensusUpdatesRequest) (*userjson.ListPendingConsensusUpdatesResponse, *jsonrpc.Error)
- func (svc *Service) ListPendingMigrations(ctx context.Context, req *userjson.ListMigrationsRequest) (*userjson.ListMigrationsResponse, *jsonrpc.Error)
- func (svc *Service) LoadChangeset(ctx context.Context, req *userjson.ChangesetRequest) (*userjson.ChangesetsResponse, *jsonrpc.Error)
- func (svc *Service) LoadChangesetMetadata(ctx context.Context, req *userjson.ChangesetMetadataRequest) (*userjson.ChangesetMetadataResponse, *jsonrpc.Error)
- func (svc *Service) Methods() map[jsonrpc.Method]rpcserver.MethodDef
- func (svc *Service) MigrationGenesisChunk(ctx context.Context, req *userjson.MigrationSnapshotChunkRequest) (*userjson.MigrationSnapshotChunkResponse, *jsonrpc.Error)
- func (svc *Service) MigrationMetadata(ctx context.Context, req *userjson.MigrationMetadataRequest) (*userjson.MigrationMetadataResponse, *jsonrpc.Error)
- func (svc *Service) MigrationStatus(ctx context.Context, req *userjson.MigrationStatusRequest) (*userjson.MigrationStatusResponse, *jsonrpc.Error)
- func (svc *Service) Name() string
- func (svc *Service) NumAccounts(ctx context.Context, req *userjson.NumAccountsRequest) (*userjson.NumAccountsResponse, *jsonrpc.Error)
- func (svc *Service) Ping(ctx context.Context, req *userjson.PingRequest) (*userjson.PingResponse, *jsonrpc.Error)
- func (svc *Service) Query(ctx context.Context, req *userjson.QueryRequest) (*userjson.QueryResponse, *jsonrpc.Error)
- func (svc *Service) TxQuery(ctx context.Context, req *userjson.TxQueryRequest) (*userjson.TxQueryResponse, *jsonrpc.Error)
- type Validators
Constants ¶
This section is empty.
Variables ¶
var ( SpecInfo = openrpc.Info{ Title: "Kwil DB user service", Description: `The JSON-RPC user service for Kwil DB.`, License: &openrpc.License{ Name: "CC0-1.0", URL: "https://creativecommons.org/publicdomain/zero/1.0/legalcode", }, Version: "0.2.0", } )
Functions ¶
This section is empty.
Types ¶
type BlockchainTransactor ¶
type BlockchainTransactor interface {
Status(ctx context.Context) (*adminTypes.Status, error)
Peers(context.Context) ([]*adminTypes.PeerInfo, error)
ConsensusParams() *types.NetworkParameters
BroadcastTx(ctx context.Context, tx *types.Transaction, sync uint8) (types.Hash, *types.TxResult, error)
TxQuery(ctx context.Context, hash types.Hash, prove bool) (*types.TxQueryResponse, error)
}
type DB ¶
type DB interface {
sql.ReadTxMaker
sql.DelayedReadTxMaker
}
type EngineReader ¶
type NodeApp ¶
type NodeApp interface {
AccountInfo(ctx context.Context, db sql.DB, account *types.AccountID, pending bool) (balance *big.Int, nonce int64, err error)
NumAccounts(ctx context.Context, db sql.Executor) (count, height int64, err error)
Price(ctx context.Context, dbTx sql.DB, tx *types.Transaction) (*big.Int, error)
GetMigrationMetadata(ctx context.Context) (*types.MigrationMetadata, error)
}
type Opt ¶
type Opt func(*serviceCfg)
Opt is a Service option.
func WithBlockAgeHealth ¶
func WithChallengeExpiry ¶
func WithChallengeRateLimit ¶
func WithPrivateMode ¶
func WithReadTxTimeout ¶
WithReadTxTimeout sets a timeout for read-only DB transactions, as used by the Query and Call methods of Service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the "user" RPC service, also known as txsvc in other contexts.
func NewService ¶
func NewService(db DB, engine EngineReader, chainClient BlockchainTransactor, nodeApp NodeApp, vals Validators, migrator Migrator, logger log.Logger, opts ...Opt) *Service
NewService creates a new instance of the user RPC service.
func (*Service) Account ¶
func (svc *Service) Account(ctx context.Context, req *userjson.AccountRequest) (*userjson.AccountResponse, *jsonrpc.Error)
func (*Service) AuthenticatedQuery ¶
func (svc *Service) AuthenticatedQuery(ctx context.Context, req *userjson.AuthenticatedQueryRequest) (*userjson.QueryResponse, *jsonrpc.Error)
func (*Service) Broadcast ¶
func (svc *Service) Broadcast(ctx context.Context, req *userjson.BroadcastRequest) (*userjson.BroadcastResponse, *jsonrpc.Error)
func (*Service) Call ¶
func (svc *Service) Call(ctx context.Context, req *userjson.CallRequest) (*userjson.CallResponse, *jsonrpc.Error)
func (*Service) CallChallenge ¶
func (svc *Service) CallChallenge(ctx context.Context, req *userjson.ChallengeRequest) (*userjson.ChallengeResponse, *jsonrpc.Error)
CallChallenge is the handler for the user.challenge RPC. It gives the user a new challenge for use with a signed call request. They are single use, and they expire according to the service's challenge expiry configuration.
func (*Service) ChainInfo ¶
func (svc *Service) ChainInfo(ctx context.Context, req *userjson.ChainInfoRequest) (*userjson.ChainInfoResponse, *jsonrpc.Error)
func (*Service) EstimatePrice ¶
func (svc *Service) EstimatePrice(ctx context.Context, req *userjson.EstimatePriceRequest) (*userjson.EstimatePriceResponse, *jsonrpc.Error)
func (*Service) Handlers ¶
func (svc *Service) Handlers() map[jsonrpc.Method]rpcserver.MethodHandler
func (*Service) Health ¶
Health for the user service responds with details from publicly available information from the chain_info response such as best block age. The health boolean also considers node state.
func (*Service) HealthMethod ¶
func (svc *Service) HealthMethod(ctx context.Context, _ *userjson.HealthRequest) (*userjson.HealthResponse, *jsonrpc.Error)
HealthMethod is a JSON-RPC method handler for service health.
func (*Service) ListPendingConsensusUpdates ¶
func (svc *Service) ListPendingConsensusUpdates(ctx context.Context, req *userjson.ListPendingConsensusUpdatesRequest) (*userjson.ListPendingConsensusUpdatesResponse, *jsonrpc.Error)
func (*Service) ListPendingMigrations ¶
func (svc *Service) ListPendingMigrations(ctx context.Context, req *userjson.ListMigrationsRequest) (*userjson.ListMigrationsResponse, *jsonrpc.Error)
func (*Service) LoadChangeset ¶
func (svc *Service) LoadChangeset(ctx context.Context, req *userjson.ChangesetRequest) (*userjson.ChangesetsResponse, *jsonrpc.Error)
func (*Service) LoadChangesetMetadata ¶
func (svc *Service) LoadChangesetMetadata(ctx context.Context, req *userjson.ChangesetMetadataRequest) (*userjson.ChangesetMetadataResponse, *jsonrpc.Error)
func (*Service) MigrationGenesisChunk ¶
func (svc *Service) MigrationGenesisChunk(ctx context.Context, req *userjson.MigrationSnapshotChunkRequest) (*userjson.MigrationSnapshotChunkResponse, *jsonrpc.Error)
func (*Service) MigrationMetadata ¶
func (svc *Service) MigrationMetadata(ctx context.Context, req *userjson.MigrationMetadataRequest) (*userjson.MigrationMetadataResponse, *jsonrpc.Error)
func (*Service) MigrationStatus ¶
func (svc *Service) MigrationStatus(ctx context.Context, req *userjson.MigrationStatusRequest) (*userjson.MigrationStatusResponse, *jsonrpc.Error)
func (*Service) NumAccounts ¶
func (svc *Service) NumAccounts(ctx context.Context, req *userjson.NumAccountsRequest) (*userjson.NumAccountsResponse, *jsonrpc.Error)
func (*Service) Ping ¶
func (svc *Service) Ping(ctx context.Context, req *userjson.PingRequest) (*userjson.PingResponse, *jsonrpc.Error)