usersvc

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func OpenRPCSpec() openrpc.Spec

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 Migrator added in v0.9.0

type Migrator interface {
	GetChangesetMetadata(height int64) (*migrations.ChangesetMetadata, error)
	GetChangeset(height int64, index int64) ([]byte, error)
	GetGenesisSnapshotChunk(chunkIdx uint32) ([]byte, error)
}

type NodeApplication

type NodeApplication interface {
	AccountInfo(ctx context.Context, db sql.DB, identifier []byte, getUncommitted bool) (balance *big.Int, nonce int64, err error)
}

type Opt

type Opt func(*serviceCfg)

Opt is a Service option.

func WithBlockAgeHealth added in v0.9.0

func WithBlockAgeHealth(ageThresh time.Duration) Opt

func WithChallengeExpiry added in v0.9.0

func WithChallengeExpiry(expiry time.Duration) Opt

func WithChallengeRateLimit added in v0.9.0

func WithChallengeRateLimit(limit float64) Opt

func WithPrivateMode added in v0.9.0

func WithPrivateMode(privateMode bool) Opt

func WithReadTxTimeout

func WithReadTxTimeout(timeout time.Duration) Opt

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 (*Service) Broadcast

func (*Service) Call

func (*Service) CallChallenge added in v0.9.0

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 (*Service) EstimatePrice

func (*Service) Handlers

func (svc *Service) Handlers() map[jsonrpc.Method]rpcserver.MethodHandler

func (*Service) Health added in v0.9.0

func (svc *Service) Health(ctx context.Context) (json.RawMessage, bool)

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

HealthMethod is a JSON-RPC method handler for service health.

func (*Service) ListDatabases

func (*Service) ListPendingMigrations added in v0.9.0

func (*Service) LoadChangeset added in v0.9.0

func (*Service) LoadChangesetMetadata added in v0.9.0

func (*Service) Methods

func (svc *Service) Methods() map[jsonrpc.Method]rpcserver.MethodDef

func (*Service) MigrationGenesisChunk added in v0.9.0

func (*Service) MigrationMetadata added in v0.9.0

func (*Service) MigrationStatus added in v0.9.0

func (*Service) Name added in v0.9.0

func (svc *Service) Name() string

func (*Service) Ping

func (*Service) Query

func (*Service) Schema

func (*Service) TxQuery

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL