Documentation ¶
Index ¶
- Variables
- func OpenRPCSpec() openrpc.Spec
- type ABCI
- type BlockchainTransactor
- type DB
- type EngineReader
- type Migrator
- type NodeApplication
- type Opt
- type Service
- func (svc *Service) Account(ctx context.Context, req *userjson.AccountRequest) (*userjson.AccountResponse, *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) ListDatabases(ctx context.Context, req *userjson.ListDatabasesRequest) (*userjson.ListDatabasesResponse, *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) 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) Schema(ctx context.Context, req *userjson.SchemaRequest) (*userjson.SchemaResponse, *jsonrpc.Error)
- func (svc *Service) TxQuery(ctx context.Context, req *userjson.TxQueryRequest) (*userjson.TxQueryResponse, *jsonrpc.Error)
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.1.0", } )
Functions ¶
func OpenRPCSpec ¶
Types ¶
type ABCI ¶ added in v0.9.0
type ABCI interface { Price(ctx context.Context, db sql.DB, tx *transactions.Transaction) (*big.Int, error) GetMigrationMetadata(ctx context.Context) (*types.MigrationMetadata, error) }
type BlockchainTransactor ¶
type BlockchainTransactor interface { Status(ctx context.Context) (*adminTypes.Status, error) Peers(context.Context) ([]*adminTypes.PeerInfo, error) BroadcastTx(ctx context.Context, tx []byte, sync uint8) (*cmtCoreTypes.ResultBroadcastTx, error) TxQuery(ctx context.Context, hash []byte, prove bool) (*cmtCoreTypes.ResultTx, error) }
type DB ¶ added in v0.9.0
type DB interface { sql.ReadTxMaker sql.DelayedReadTxMaker }
type EngineReader ¶
type EngineReader interface { Procedure(ctx *common.TxContext, tx sql.DB, options *common.ExecutionData) (*sql.ResultSet, error) GetSchema(dbid string) (*types.Schema, error) ListDatasets(owner []byte) ([]*types.DatasetIdentifier, error) Execute(ctx *common.TxContext, tx sql.DB, dbid string, query string, values map[string]any) (*sql.ResultSet, error) }
type NodeApplication ¶
type Opt ¶
type Opt func(*serviceCfg)
Opt is a Service option.
func WithBlockAgeHealth ¶ added in v0.9.0
func WithChallengeExpiry ¶ added in v0.9.0
func WithChallengeRateLimit ¶ added in v0.9.0
func WithPrivateMode ¶ added in v0.9.0
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 NodeApplication, abci ABCI, 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) 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 ¶ added in v0.9.0
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 ¶ added in v0.9.0
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 ¶ added in v0.9.0
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) ListDatabases ¶
func (svc *Service) ListDatabases(ctx context.Context, req *userjson.ListDatabasesRequest) (*userjson.ListDatabasesResponse, *jsonrpc.Error)
func (*Service) ListPendingMigrations ¶ added in v0.9.0
func (svc *Service) ListPendingMigrations(ctx context.Context, req *userjson.ListMigrationsRequest) (*userjson.ListMigrationsResponse, *jsonrpc.Error)
func (*Service) LoadChangeset ¶ added in v0.9.0
func (svc *Service) LoadChangeset(ctx context.Context, req *userjson.ChangesetRequest) (*userjson.ChangesetsResponse, *jsonrpc.Error)
func (*Service) LoadChangesetMetadata ¶ added in v0.9.0
func (svc *Service) LoadChangesetMetadata(ctx context.Context, req *userjson.ChangesetMetadataRequest) (*userjson.ChangesetMetadataResponse, *jsonrpc.Error)
func (*Service) MigrationGenesisChunk ¶ added in v0.9.0
func (svc *Service) MigrationGenesisChunk(ctx context.Context, req *userjson.MigrationSnapshotChunkRequest) (*userjson.MigrationSnapshotChunkResponse, *jsonrpc.Error)
func (*Service) MigrationMetadata ¶ added in v0.9.0
func (svc *Service) MigrationMetadata(ctx context.Context, req *userjson.MigrationMetadataRequest) (*userjson.MigrationMetadataResponse, *jsonrpc.Error)
func (*Service) MigrationStatus ¶ added in v0.9.0
func (svc *Service) MigrationStatus(ctx context.Context, req *userjson.MigrationStatusRequest) (*userjson.MigrationStatusResponse, *jsonrpc.Error)
func (*Service) Ping ¶
func (svc *Service) Ping(ctx context.Context, req *userjson.PingRequest) (*userjson.PingResponse, *jsonrpc.Error)
func (*Service) Query ¶
func (svc *Service) Query(ctx context.Context, req *userjson.QueryRequest) (*userjson.QueryResponse, *jsonrpc.Error)