server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeServer

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

BridgeServer defines the fields required for bridge event updates.

type LiquidationServer

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

LiquidationServer defines the fields required for liquidation updates.

type PriceFeedServer

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

PriceFeedServer defines the fields required for price updates.

type Server

type Server struct {
	BridgeServer
	PriceFeedServer
	LiquidationServer
	// contains filtered or unexported fields
}

Server struct defines the shared gRPC server for all daemons. The struct contains fields related to gRPC server that are common to all daemons. In addition, the struct contains fields that are specific to various daemon services. needed for various services.

func NewServer

func NewServer(
	logger log.Logger,
	grpcServer daemontypes.GrpcServer,
	fileHandler daemontypes.FileHandler,
	socketAddress string,
	uniqueTestIdentifier string,
) *Server

NewServer creates a single gRPC server that's shared across multiple daemons for communication. uniqueTestIdentifier is a string that can be used to identify services spawned by a particular test case, so that they can be cleaned up after the test case is complete.

func (*Server) AddBridgeEvents

func (s *Server) AddBridgeEvents(
	ctx context.Context,
	req *api.AddBridgeEventsRequest,
) (
	*api.AddBridgeEventsResponse,
	error,
)

AddBridgeEvents stores any bridge events recognized by the daemon in a go-routine safe slice.

func (*Server) DisableUpdateMonitoringForTesting added in v0.3.0

func (server *Server) DisableUpdateMonitoringForTesting()

DisableUpdateMonitoringForTesting disables the update monitor for testing purposes. This is needed in integration tests that do not run the full protocol.

func (*Server) ExpectBridgeDaemon added in v0.3.0

func (server *Server) ExpectBridgeDaemon(maximumAcceptableUpdateDelay time.Duration)

ExpectBridgeDaemon registers the bridge daemon with the server. This is required in order to ensure that the daemon service is called at least once during every maximumAcceptableUpdateDelay duration. It will cause the protocol to panic if the daemon does not respond within maximumAcceptableUpdateDelay duration.

func (*Server) ExpectLiquidationsDaemon added in v0.3.0

func (server *Server) ExpectLiquidationsDaemon(maximumAcceptableUpdateDelay time.Duration)

ExpectLiquidationsDaemon registers the liquidations daemon with the server. This is required in order to ensure that the daemon service is called at least once during every maximumAcceptableUpdateDelay duration. It will cause the protocol to panic if the daemon does not respond within maximumAcceptableUpdateDelay duration.

func (*Server) ExpectMetricsDaemon added in v0.4.0

func (server *Server) ExpectMetricsDaemon(maximumAcceptableUpdateDelay time.Duration)

ExpectMetricsDaemon registers the periodic metrics daemon with the server. This is required in order to ensure that the daemon service is called at least once during every maximumAcceptableUpdateDelay duration. It will cause the protocol to panic if the daemon does not respond within maximumAcceptableUpdateDelay duration.

func (*Server) ExpectPricefeedDaemon added in v0.3.0

func (server *Server) ExpectPricefeedDaemon(maximumAcceptableUpdateDelay time.Duration)

ExpectPricefeedDaemon registers the pricefeed daemon with the server. This is required in order to ensure that the daemon service is called at least once during every maximumAcceptableUpdateDelay duration. It will cause the protocol to panic if the daemon does not respond within maximumAcceptableUpdateDelay duration.

func (*Server) LiquidateSubaccounts

func (s *Server) LiquidateSubaccounts(
	ctx context.Context,
	req *api.LiquidateSubaccountsRequest,
) (*api.LiquidateSubaccountsResponse, error)

LiquidateSubaccounts stores the list of potentially liquidatable subaccount ids in a go-routine safe slice.

func (*Server) Start

func (server *Server) Start()

Start clears the current socket and establishes a new socket connection on the local filesystem. See URL for more information: https://eli.thegreenplace.net/2019/unix-domain-sockets-in-go/

func (*Server) Stop

func (server *Server) Stop()

Stop stops the daemon server's gRPC service.

func (*Server) UpdateMarketPrices

func (s *Server) UpdateMarketPrices(
	ctx context.Context,
	req *api.UpdateMarketPricesRequest,
) (*api.UpdateMarketPricesResponse, error)

UpdateMarketPrices updates prices from exchanges for each market provided.

func (*Server) WithBridgeEventManager

func (server *Server) WithBridgeEventManager(
	bridgeEventManager *bdtypes.BridgeEventManager,
) *Server

WithBridgeEventManager sets the `bridgeEventManager` field. This is updated by the bridge service with a list of recognized bridge events.

func (*Server) WithLiquidatableSubaccountIds

func (server *Server) WithLiquidatableSubaccountIds(
	liquidatableSubaccountIds *liquidationtypes.LiquidatableSubaccountIds,
) *Server

WithLiquidatableSubaccountIds sets the `liquidatableSubaccountIds` field. This is updated by the liquidation service with a list of potentially liquidatable subaccount ids to be processed by the `PerpetualLiquidationsKeeper`.

func (*Server) WithPriceFeedMarketToExchangePrices

func (server *Server) WithPriceFeedMarketToExchangePrices(
	marketToExchange *pricefeedtypes.MarketToExchangePrices,
) *Server

WithPriceFeedMarketToExchangePrices sets the `MarketToExchangePrices` field. This is used by the price feed service to communicate price updates to the main application.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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