adminsvc

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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SpecInfo = openrpc.Info{
		Title:       "Kwil DB admin service",
		Description: `The JSON-RPC admin 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

This section is empty.

Types

type BlockchainTransactor

type BlockchainTransactor interface {
	Status(context.Context) (*types.Status, error)
	Peers(context.Context) ([]*types.PeerInfo, error)
	BroadcastTx(ctx context.Context, tx []byte, sync uint8) (*cmtCoreTypes.ResultBroadcastTx, error)
}

BlockchainTransactor specifies the methods required for the admin service to interact with the blockchain.

type P2P added in v0.9.0

type P2P interface {
	// AddPeer adds a peer to the node's peer list and persists it.
	AddAndPersistPeer(ctx context.Context, nodeID string) error
	// RemovePeer removes a peer from the node's peer list permanently.
	RemovePersistedPeer(ctx context.Context, nodeID string) error
	// ListPeers returns the list of peers in the node's whitelist.
	ListPeers(ctx context.Context) []string
}

type Pricer added in v0.9.0

type Pricer interface {
	Price(ctx context.Context, db sql.DB, tx *transactions.Transaction) (*big.Int, error)
}

type Service

type Service struct {
	TxApp TxApp
	// contains filtered or unexported fields
}

func NewService

func NewService(db sql.DelayedReadTxMaker, blockchain BlockchainTransactor, txApp TxApp,
	pricer Pricer, p2p P2P, signer auth.Signer, cfg *config.KwildConfig,
	chainID string, logger log.Logger) *Service

NewService constructs a new Service.

func (*Service) AddPeer added in v0.9.0

func (*Service) Approve

func (*Service) ApproveResolution added in v0.9.0

func (*Service) CreateResolution added in v0.9.0

func (*Service) GetConfig

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)

func (*Service) HealthMethod added in v0.9.0

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

func (*Service) Join

func (*Service) JoinStatus

func (*Service) Leave

func (*Service) ListPeers added in v0.9.0

func (*Service) Methods

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

func (*Service) Name added in v0.9.0

func (svc *Service) Name() string

func (*Service) Peers

func (*Service) Remove

func (*Service) RemovePeer added in v0.9.0

func (*Service) ResolutionStatus added in v0.9.0

func (*Service) Status

type TxApp

type TxApp interface {
	// AccountInfo returns the unconfirmed account info for the given identifier.
	// If unconfirmed is true, the account found in the mempool is returned.
	// Otherwise, the account found in the blockchain is returned.
	AccountInfo(ctx context.Context, db sql.DB, identifier []byte, unconfirmed bool) (balance *big.Int, nonce int64, err error)
}

Jump to

Keyboard shortcuts

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