consumer

package
v0.0.0-...-2662d33 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const BATCH_SIZE = 1024

Variables

This section is empty.

Functions

func ComputeNewAverage

func ComputeNewAverage(prevAvg int32, prevCount uint64, currValidatorCount int) int32

NOTE: Not used, validator tracker logic changed

func RunConsumer

func RunConsumer(cfg *ConsumerConfig)

Types

type Column

type Column struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Nullable bool   `json:"nullable"`
}

type Consumer

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

func (*Consumer) Start

func (c *Consumer) Start(name string) error

type ConsumerConfig

type ConsumerConfig struct {
	LogLevel      string
	NatsURL       string
	Name          string
	ChCfg         ch.ClickhouseConfig
	DuneNamespace string
	DuneApiKey    string
}

type CreateTableRequest

type CreateTableRequest struct {
	Namespace   string   `json:"namespace"`
	TableName   string   `json:"table_name"`
	Schema      []Column `json:"schema"`
	IsPrivate   bool     `json:"is_private"`
	Description string   `json:"description"`
}

type Dune

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

func NewDune

func NewDune(namespace, apiKey string) *Dune

func (*Dune) ClearTableData

func (d *Dune) ClearTableData(tableName string) error

clearTableData clears the data in the Dune table

func (*Dune) CreateTable

func (d *Dune) CreateTable(tableName string, schema []Column) error

CreateTable creates a table in Dune with the specified schema

func (*Dune) Insert

func (d *Dune) Insert(tableName string, data []ValidatorNonAdminTracker) error

insertDataIntoTable inserts data into the Dune table

type IPMetaData

type IPMetaData struct {
	IP       string `json:"ip"`
	Hostname string `json:"hostname"`
	City     string `json:"city"`
	Region   string `json:"region"`
	Country  string `json:"country"`
	LatLong  string `json:"lat_long"`
	Postal   string `json:"postal"`
	ASN      string `json:"asn"`
	ASNOrg   string `json:"asn_organization"`
	ASNType  string `json:"asn_type"`
}

type ValidatorNonAdminTracker

type ValidatorNonAdminTracker struct {
	PeerID                 string  `json:"peer_id"`
	Port                   int     `json:"port"`
	LastSeen               int     `json:"last_seen"`
	LastSeenDate           string  `json:"last_seen_date"`
	LastEpoch              int     `json:"last_epoch"`
	ClientVersion          string  `json:"client_version"`
	ValidatorCount         int     `json:"validator_count"`
	ValidatorCountAccuracy float64 `json:"validator_count_accuracy"`
	TotalObservations      int     `json:"total_observations"`
	City                   string  `json:"city"`
	Region                 string  `json:"region"`
	Country                string  `json:"country"`
	Latitude               float64 `json:"latitude"`
	Longitude              float64 `json:"longitude"`
	PostalCode             string  `json:"postal_code"`
	ASN                    string  `json:"asn"`
	ASNOrganization        string  `json:"asn_organization"`
	ASNType                string  `json:"asn_type"`
}

type ValidatorTracker

type ValidatorTracker struct {
	PeerID                 string  `json:"peer_id"`
	ENR                    string  `json:"enr,omitempty"`
	Multiaddr              string  `json:"multiaddr,omitempty"`
	IP                     string  `json:"ip,omitempty"`
	Port                   int     `json:"port"`
	LastSeen               int     `json:"last_seen"`
	LastEpoch              int     `json:"last_epoch"`
	ClientVersion          string  `json:"client_version"`
	ValidatorCount         int     `json:"validator_count"`
	ValidatorCountAccuracy float64 `json:"validator_count_accuracy"`
	TotalObservations      int     `json:"total_observations"`
	Hostname               string  `json:"hostname,omitempty"`
	City                   string  `json:"city"`
	Region                 string  `json:"region"`
	Country                string  `json:"country"`
	Latitude               float64 `json:"latitude"`
	Longitude              float64 `json:"longitude"`
	PostalCode             string  `json:"postal_code"`
	ASN                    string  `json:"asn"`
	ASNOrganization        string  `json:"asn_organization"`
	ASNType                string  `json:"asn_type"`
}

Jump to

Keyboard shortcuts

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