api

package
v0.50.10 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 21 Imported by: 1,599

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomGRPCHeaderMatcher

func CustomGRPCHeaderMatcher(key string) (string, bool)

CustomGRPCHeaderMatcher for mapping request headers to GRPC metadata. HTTP headers that start with 'Grpc-Metadata-' are automatically mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. We can use this CustomGRPCHeaderMatcher if headers don't start with `Grpc-Metadata-`

Types

type Server

type Server struct {
	Router            *mux.Router
	GRPCGatewayRouter *runtime.ServeMux
	ClientCtx         client.Context
	GRPCSrv           *grpc.Server
	// contains filtered or unexported fields
}

Server defines the server's API interface.

func New

func New(clientCtx client.Context, logger log.Logger, grpcSrv *grpc.Server) *Server

func (*Server) Close

func (s *Server) Close() error

Close closes the API server.

func (*Server) SetTelemetry added in v0.46.0

func (s *Server) SetTelemetry(m *telemetry.Metrics)

func (*Server) Start

func (s *Server) Start(ctx context.Context, cfg config.Config) error

Start starts the API server. Internally, the API server leverages CometBFT's JSON RPC server. Configuration options are provided via config.APIConfig and are delegated to the CometBFT JSON RPC server.

Note, this creates a blocking process if the server is started successfully. Otherwise, an error is returned. The caller is expected to provide a Context that is properly canceled or closed to indicate the server should be stopped.

Jump to

Keyboard shortcuts

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