serve

package
v5.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVER_WS_PATH      = "SERVER_WS_PATH"
	SERVER_IPC_PATH     = "SERVER_IPC_PATH"
	SERVER_HTTP_PATH    = "SERVER_HTTP_PATH"
	SERVER_GRAPHQL_PATH = "SERVER_GRAPHQL_PATH"

	SERVER_MAX_IDLE_CONNECTIONS = "SERVER_MAX_IDLE_CONNECTIONS"
	SERVER_MAX_OPEN_CONNECTIONS = "SERVER_MAX_OPEN_CONNECTIONS"
	SERVER_MAX_CONN_LIFETIME    = "SERVER_MAX_CONN_LIFETIME"

	ETH_DEFAULT_SENDER_ADDR    = "ETH_DEFAULT_SENDER_ADDR"
	ETH_RPC_GAS_CAP            = "ETH_RPC_GAS_CAP"
	ETH_CHAIN_CONFIG           = "ETH_CHAIN_CONFIG"
	ETH_SUPPORTS_STATEDIFF     = "ETH_SUPPORTS_STATEDIFF"
	ETH_STATEDIFF_TIMEOUT      = "ETH_STATEDIFF_TIMEOUT"
	ETH_FORWARD_ETH_CALLS      = "ETH_FORWARD_ETH_CALLS"
	ETH_FORWARD_GET_STORAGE_AT = "ETH_FORWARD_GET_STORAGE_AT"
	ETH_PROXY_ON_ERROR         = "ETH_PROXY_ON_ERROR"
	ETH_GETLOGS_BLOCK_LIMIT    = "ETH_GETLOGS_BLOCK_LIMIT"

	VALIDATOR_ENABLED         = "VALIDATOR_ENABLED"
	VALIDATOR_EVERY_NTH_BLOCK = "VALIDATOR_EVERY_NTH_BLOCK"

	HTTP_TIMEOUT = "HTTP_TIMEOUT"

	ETH_WS_PATH       = "ETH_WS_PATH"
	ETH_HTTP_PATH     = "ETH_HTTP_PATH"
	ETH_NODE_ID       = "ETH_NODE_ID"
	ETH_CLIENT_NAME   = "ETH_CLIENT_NAME"
	ETH_GENESIS_BLOCK = "ETH_GENESIS_BLOCK"
	ETH_NETWORK_ID    = "ETH_NETWORK_ID"
	ETH_CHAIN_ID      = "ETH_CHAIN_ID"

	DATABASE_NAME                 = "DATABASE_NAME"
	DATABASE_HOSTNAME             = "DATABASE_HOSTNAME"
	DATABASE_PORT                 = "DATABASE_PORT"
	DATABASE_USER                 = "DATABASE_USER"
	DATABASE_PASSWORD             = "DATABASE_PASSWORD"
	DATABASE_MAX_IDLE_CONNECTIONS = "DATABASE_MAX_IDLE_CONNECTIONS"
	DATABASE_MAX_OPEN_CONNECTIONS = "DATABASE_MAX_OPEN_CONNECTIONS"
	DATABASE_MAX_CONN_LIFETIME    = "DATABASE_MAX_CONN_LIFETIME"
)

Env variables

View Source
const APIName = "vdb"

APIName is the namespace used for the state diffing service API

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the state diffing service API

View Source
const (
	PayloadChanBufferSize = 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DB       *sqlx.DB
	DBConfig postgres.Config

	WSEnabled  bool
	WSEndpoint string

	HTTPEnabled  bool
	HTTPEndpoint string

	IPCEnabled  bool
	IPCEndpoint string

	EthGraphqlEnabled  bool
	EthGraphqlEndpoint string

	ChainConfig         *params.ChainConfig
	DefaultSender       *common.Address
	RPCGasCap           *big.Int
	EthHttpEndpoint     string
	Client              *rpc.Client
	SupportStateDiff    bool
	StateDiffTimeout    time.Duration
	ForwardEthCalls     bool
	ForwardGetStorageAt bool
	ProxyOnError        bool
	GetLogsBlockLimit   int64
	NodeNetworkID       string

	// Cache configuration.
	GroupCache *ethServerShared.GroupCacheConfig

	StateValidationEnabled       bool
	StateValidationEveryNthBlock uint64
}

Config struct

func NewConfig

func NewConfig() (*Config, error)

NewConfig is used to initialize a watcher config from a .toml file Separate chain watcher instances need to be ran with separate ipfs path in order to avoid lock contention on the ipfs repository lockfile

type PublicServerAPI

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

PublicServerAPI is the public api for the watcher

func NewPublicServerAPI

func NewPublicServerAPI(w Server, client *rpc.Client) *PublicServerAPI

NewPublicServerAPI creates a new PublicServerAPI with the provided underlying Server process

func (*PublicServerAPI) WatchAddress

func (api *PublicServerAPI) WatchAddress(operation types.OperationType, args []types.WatchAddressArg) error

WatchAddress makes a geth WatchAddress API call with the given operation and args

type Server

type Server interface {
	// Start() and Stop()
	ethnode.Lifecycle
	APIs() []rpc.API
	Protocols() []p2p.Protocol
	// Pub-Sub handling event loop
	Serve(wg *sync.WaitGroup)
	// Backend exposes the server's backend
	Backend() *eth.Backend
}

Server is the top level interface for streaming, converting to IPLDs, publishing, and indexing all chain data; screening this data; and serving it up to subscribed clients This service is compatible with the Ethereum service interface (node.Service)

func NewServer

func NewServer(settings *Config) (Server, error)

NewServer creates a new Server using an underlying Service struct

type Service

type Service struct {
	// Used to sync access to the Subscriptions
	sync.Mutex
	// Used to signal shutdown of the service
	QuitChan chan bool
	// contains filtered or unexported fields
}

Service is the underlying struct for the watcher

func (*Service) APIs

func (sap *Service) APIs() []rpc.API

APIs returns the RPC descriptors the watcher service offers

func (*Service) Backend

func (sap *Service) Backend() *eth.Backend

Backend exposes the server's backend

func (*Service) Protocols

func (sap *Service) Protocols() []p2p.Protocol

Protocols exports the services p2p protocols, this service has none

func (*Service) Serve

func (sap *Service) Serve(wg *sync.WaitGroup)

Serve listens for incoming converter data off the screenAndServePayload from the Sync process It filters and sends this data to any subscribers to the service This process can also be stood up alone, without an screenAndServePayload attached to a Sync process and it will hang on the WaitGroup indefinitely, allowing the Service to serve historical data requests only

func (*Service) Start

func (sap *Service) Start() error

Start is used to begin the service This is mostly just to satisfy the node.Service interface

func (*Service) Stop

func (sap *Service) Stop() error

Stop is used to close down the service This is mostly just to satisfy the node.Service interface

Jump to

Keyboard shortcuts

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