manager

package
v0.0.0-...-d614328 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package manager implements the management of the liquidation bot services including automatic deployment and scaling of the collector, health-checker and liquidator

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager implements the management service for the collection of services for the liquidation bot

func New

func New(
	chainID string,
	rpcEndpoint string,
	rpcWebsocketEndpoint string,
	lcdEndpoint string,
	hiveEndpoint string,
	queue interfaces.Queuer,
	metricsCache interfaces.Cacher,
	collectorQueueName string,
	healthCheckQueueName string,
	executorQueueName string,
	scalers map[string]managerinterfaces.Scaler,
	collectorContract string,
	collectorItemsPerPacket int,
	contractItemPrefix string,
	workItemType types.WorkItemType,
	metricsEnabled bool,
	logger *logrus.Entry,
) (*Manager, error)

New creates a new instance of the manager and returns the instance and an error if applicable

func (*Manager) Run

func (service *Manager) Run() error

Run the service forever

func (*Manager) Stop

func (service *Manager) Stop() error

Stop the manager service Stopping the service will take a few seconds to cleanly disconnect the websocket subscription

type Metric

type Metric struct {
	Name      string
	Value     float64
	Timestamp int64
	Chain     string
}

Metric contains a single metric to be reported

type Model

type Model struct {
	// hex-encode key to read it better (this is often ascii)
	Key github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=key,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"key,omitempty"`
	// base64-encode raw value
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) Reset

func (m *Model) Reset()

func (*Model) String

func (m *Model) String() string

type PageRequest

type PageRequest struct {
	// key is a value returned in PageResponse.next_key to begin
	// querying the next page most efficiently. Only one of offset or key
	// should be set.
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// offset is a numeric offset that can be used when key is unavailable.
	// It is less efficient than using key. Only one of offset or key should
	// be set.
	Offset uint64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`
	// limit is the total number of results to be returned in the result page.
	// If left empty it will default to a value to be set by each app.
	Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
	// count_total is set to true  to indicate that the result set should include
	// a count of the total number of items available for pagination in UIs.
	// count_total is only respected when offset is used. It is ignored when key
	// is set.
	CountTotal bool `protobuf:"varint,4,opt,name=count_total,json=countTotal,proto3" json:"count_total,omitempty"`
	// reverse is set to true if results are to be returned in the descending order.
	//
	// Since: cosmos-sdk 0.43
	Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"`
}

PageRequest is to be embedded in gRPC request messages for efficient pagination. Ex:

message SomeRequest {
        Foo some_parameter = 1;
        PageRequest pagination = 2;
}

func (*PageRequest) GetCountTotal

func (m *PageRequest) GetCountTotal() bool

func (*PageRequest) GetKey

func (m *PageRequest) GetKey() []byte

func (*PageRequest) GetLimit

func (m *PageRequest) GetLimit() uint64

func (*PageRequest) GetOffset

func (m *PageRequest) GetOffset() uint64

func (*PageRequest) GetReverse

func (m *PageRequest) GetReverse() bool

func (*PageRequest) ProtoMessage

func (*PageRequest) ProtoMessage()

func (*PageRequest) Reset

func (m *PageRequest) Reset()

func (*PageRequest) String

func (m *PageRequest) String() string

type PageResponse

type PageResponse struct {
	// next_key is the key to be passed to PageRequest.key to
	// query the next page most efficiently
	NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"`
	// total is total number of results available if PageRequest.count_total
	// was set, its value is undefined otherwise
	Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
}

PageResponse is to be embedded in gRPC response messages where the corresponding request message has used PageRequest.

message SomeResponse {
        repeated Bar results = 1;
        PageResponse page = 2;
}

func (*PageResponse) GetNextKey

func (m *PageResponse) GetNextKey() []byte

func (*PageResponse) GetTotal

func (m *PageResponse) GetTotal() uint64

func (*PageResponse) ProtoMessage

func (*PageResponse) ProtoMessage()

func (*PageResponse) Reset

func (m *PageResponse) Reset()

func (*PageResponse) String

func (m *PageResponse) String() string

type Params

type Params struct {
	Query string `json:"query"`
}

type QueryAllContractStateRequest

type QueryAllContractStateRequest struct {
	// address is the address of the contract
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method

func (*QueryAllContractStateRequest) ProtoMessage

func (*QueryAllContractStateRequest) ProtoMessage()

func (*QueryAllContractStateRequest) Reset

func (m *QueryAllContractStateRequest) Reset()

func (*QueryAllContractStateRequest) String

type QueryAllContractStateResponse

type QueryAllContractStateResponse struct {
	Models []Model `protobuf:"bytes,1,rep,name=models,proto3" json:"models"`
	// pagination defines the pagination in the response.
	Pagination *PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method

func (*QueryAllContractStateResponse) ProtoMessage

func (*QueryAllContractStateResponse) ProtoMessage()

func (*QueryAllContractStateResponse) Reset

func (m *QueryAllContractStateResponse) Reset()

func (*QueryAllContractStateResponse) String

type RPCMethodRequest

type RPCMethodRequest struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	ID      int    `json:"id"`
	Params  Params `json:"params"`
}

RPCMethodRequest defines the JSON structure of requests via the RPC websocket

type RPCNewBlockResponse

type RPCNewBlockResponse struct {
	JSONRPC string `json:"jsonrpc"`
	ID      int    `json:"id"`
	Result  struct {
		Query string `json:"query"`
		Data  struct {
			Type  string `json:"type"`
			Value struct {
				Block struct {
					Header struct {
						Version struct {
							Block string `json:"block"`
							App   string `json:"app"`
						} `json:"version"`
						ChainID string    `json:"chain_id"`
						Height  string    `json:"height"`
						Time    time.Time `json:"time"`
					} `json:"header"`
				} `json:"block"`
			} `json:"value"`
		} `json:"data"`
	} `json:"result"`
}

RPCNewBlockResponse defines the JSON structure of new block events received via RPC websocket

Jump to

Keyboard shortcuts

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