server

package
v0.0.0-...-ae8e89f Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InitialPositionLatest   = api.InitialPosition_LATEST.String()
	InitialPositionEarliest = api.InitialPosition_EARLIEST.String()
)

Functions

func Register

func Register(params RegisterParams) error

Types

type RegisterParams

type RegisterParams struct {
	fx.In
	fxparams.Params
	Manager services.SystemManager
	Server  *Server
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(params ServerParams) *Server

func (*Server) GetBlockFile

func (s *Server) GetBlockFile(ctx context.Context, req *api.GetBlockFileRequest) (*api.GetBlockFileResponse, error)

func (*Server) GetBlockFilesByRange

func (*Server) GetChainEvents

func (*Server) GetChainMetadata

func (*Server) GetLatestBlock

func (*Server) GetNativeBlock

func (*Server) GetNativeTransaction

func (*Server) GetRawBlock

func (s *Server) GetRawBlock(ctx context.Context, req *api.GetRawBlockRequest) (*api.GetRawBlockResponse, error)

func (*Server) GetRawBlocksByRange

func (*Server) GetRosettaBlock

func (*Server) StreamChainEvents

func (s *Server) StreamChainEvents(request *api.ChainEventsRequest, stream api.ChainStorage_StreamChainEventsServer) error

type ServerParams

type ServerParams struct {
	fx.In
	fxparams.Params
	MetaStorage        metastorage.MetaStorage
	BlobStorage        blobstorage.BlobStorage
	TransactionStorage metastorage.TransactionStorage
	S3Client           s3.Client
	BlockchainClient   client.Client `name:"slave"`
	Parser             parser.Parser
	Lifecycle          fx.Lifecycle
}

type Throttler

type Throttler struct {
	// contains filtered or unexported fields
}

Throttler allows a request only if all the following conditions are met:

  1. Global rate limit, shared by all client IDs, is not reached. This is configured via "api.rate_limit.global_rps".
  2. Per-client rate limit is not reached. This is configured via either "api.auth.clients" or "api.rate_limit.per_client_rps". The former supports client-specific rate limits, while the latter uses the same rate limit for all client IDs. See throttler_test.go for sample configs.

func NewThrottler

func NewThrottler(cfg *config.ApiConfig) *Throttler

func (*Throttler) Allow

func (t *Throttler) Allow(clientID string) bool

func (*Throttler) AllowN

func (t *Throttler) AllowN(clientID string, units int) bool

Jump to

Keyboard shortcuts

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