domain

package
v26.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// sqs_sync_check_error
	//
	// counter that is increased if node sync check fails when processing the first block
	//
	// Has the following labels:
	// * err - the error returned
	// * height - the height of the block being processed
	SQSNodeSyncCheckErrorMetricName = "sqs_sync_check_error"

	// sqs_process_block_error
	//
	// counter that is increased if ingest process block fails with error.
	//
	// Has the following labels:
	// * msg - the error returned
	// * height - the height of the block being processed
	SQSProcessBlockErrorMetricName = "sqs_process_block_error"

	// sqs_process_block_panic
	//
	// counter that is increased if ingest process block fails with panic.
	//
	// Has the following labels:
	// * msg - the error returned
	// * height - the height of the block being processed
	SQSProcessBlockPanicMetricName = "sqs_process_block_panic"

	// sqs_process_block_duration
	//
	// histogram that measures the duration of processing a block
	//
	// Has the following labels:
	// * height - the height of the block being processed
	SQSProcessBlockDurationMetricName = "sqs_process_block_duration"

	// sqs_grpc_connection_error
	//
	// counter that is increased if grpc connection fails
	//
	// Has the following labels:
	// * err - the error returned
	// * height - the height of the block being processed
	SQSGRPCConnectionErrorMetricName = "sqs_grpc_connection_error"
)
View Source
var (
	ErrNodeIsSyncing = errors.New("node is syncing, skipping block processing")
)

Functions

This section is empty.

Types

type BlockPoolUpdateTracker

type BlockPoolUpdateTracker interface {
	// TrackConcentrated tracks the concentrated pool.
	TrackConcentrated(pool poolmanagertypes.PoolI)

	// TrackConcentratedPoolIDTickChange tracks the concentrated pool ID tick change.
	// Due to internal implementation, it is non-trivial to apply tick changes.
	// As a result, we track the pool ID tick change and read the pool with all of its ticks
	// if at least one tick change was applied within the block.
	TrackConcentratedPoolIDTickChange(poolID uint64)

	// TrackCFMM tracks the CFMM pool.
	TrackCFMM(pool poolmanagertypes.PoolI)

	// TrackCosmWasm tracks the CosmWasm pool.
	TrackCosmWasm(pool poolmanagertypes.PoolI)

	// TrackCosmWasmPoolsAddressToPoolMap tracks the CosmWasm pools address to the pool object map.
	TrackCosmWasmPoolsAddressToPoolMap(pool poolmanagertypes.PoolI)

	// TrackCreatedPoolID tracks whenever a new pool is created.
	// CONTRACT: the caller calls this method only once per pool creation as observed
	// by poolmanagertypes.TypeEvtPoolCreated
	TrackCreatedPoolID(commondomain.PoolCreation)

	// GetConcentratedPools returns the tracked concentrated pools.
	GetConcentratedPools() []poolmanagertypes.PoolI

	// GetConcentratedPoolIDTickChange returns the tracked concentrated pool ID tick change.
	GetConcentratedPoolIDTickChange() map[uint64]struct{}

	// GetCFMMPools returns the tracked CFMM pools.
	GetCFMMPools() []poolmanagertypes.PoolI

	// GetCosmWasmPools returns the tracked CosmWasm pools.
	GetCosmWasmPools() []poolmanagertypes.PoolI

	// GetCosmWasmPoolsAddressToIDMap returns the tracked CosmWasm pools address to pool object map.
	GetCosmWasmPoolsAddressToIDMap() map[string]poolmanagertypes.PoolI

	// GetCreatedPoolIDs returns the tracked pool IDs that were created in the block.
	GetCreatedPoolIDs() map[uint64]commondomain.PoolCreation

	// Reset clears the internal state.
	Reset()
}

BlockPoolUpdateTracker is an interface for tracking the pools that were updated in a block. It persists the pools using "Track" methods in its internal state. It tracks the latest pool update, discarding the previous updates. Only on Reset, the internal state is cleared.

type NodeStatusChecker

type NodeStatusChecker interface {
	// IsNodeSyncing checks if the node is syncing.
	// Returns true if the node is syncing, false otherwise.
	// Returns error if the node syncing status cannot be determined.
	IsNodeSyncing(ctx sdk.Context) (bool, error)
}

NodeStatusChecker is an interface for checking the node status.

type NodeSyncCheckError

type NodeSyncCheckError struct {
	Err error
}

func (*NodeSyncCheckError) Error

func (e *NodeSyncCheckError) Error() string

type PoolsTransformer

type PoolsTransformer interface {
	// Transform processes the pool state, returning pools instrumented with all the necessary chain data.
	// Additionally, returns the taker fee map for every pool denom pair.
	// Returns error if the transformer fails to process pool data.
	Transform(ctx sdk.Context, blockPools commondomain.BlockPools) ([]sqsdomain.PoolI, sqsdomain.TakerFeeMap, error)
}

PoolsTransformer is an interface that defines the methods for the pool transformer

type SQSGRPClient

type SQSGRPClient interface {
	// PushData pushes the height, pools and taker fee data to SQS via GRPC.
	// Returns error if the GRPC client fails to push data.
	// On status.Unavailable, it closes the connection and attempts to re-establish it during the next GRPC call.
	// Note: while there are built-in mechanisms to handle retry such as exponential backoff, they are no suitable for our context.
	// In our context, we would rather continue attempting to repush the data in the next block instead of blocking the system.
	PushData(ctx context.Context, height uint64, pools []sqsdomain.PoolI, takerFeesMap sqsdomain.TakerFeeMap) error
}

SQSGRPClient is an interface that defines the methods for the graceful SQS GRPC client. It handles graceful connection management. So that, if a GRPC ingest method returns status.Unavailable, the GRPC client will reset the connection and attempt to recreate it before retrying the ingest method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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