db

package
v0.0.0-...-420b085 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type BoltDB

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

func NewBoltDB

func NewBoltDB(dbPath string) (*BoltDB, error)

func (*BoltDB) Close

func (db *BoltDB) Close() error

func (*BoltDB) GetLastBlock

func (db *BoltDB) GetLastBlock() (*big.Int, error)

func (*BoltDB) GetNodeByOperatorContractId

func (db *BoltDB) GetNodeByOperatorContractId(operatorContractId string) (*NodeData, error)

func (*BoltDB) GetNodeData

func (db *BoltDB) GetNodeData(operatorID string) (*NodeData, error)

func (*BoltDB) GetOperatorByOperatorId

func (db *BoltDB) GetOperatorByOperatorId(operatorId string) (*Operator, error)

func (*BoltDB) GetOperatorByOperatorIdContract

func (db *BoltDB) GetOperatorByOperatorIdContract(operatorIdContract uint64) (*Operator, error)

func (*BoltDB) ListNodeData

func (db *BoltDB) ListNodeData(onlyWithNotNilOperatorId bool) ([]NodeData, error)

func (*BoltDB) SaveLastBlock

func (db *BoltDB) SaveLastBlock(blockNumber *big.Int) error

func (*BoltDB) SaveOperator

func (db *BoltDB) SaveOperator(operator *Operator) error

func (*BoltDB) SaveOperatorAndUpdateNodeData

func (db *BoltDB) SaveOperatorAndUpdateNodeData(operator *Operator) error

func (*BoltDB) SaveOperatorContractIdToOperatorId

func (db *BoltDB) SaveOperatorContractIdToOperatorId(operatorId string, operatorIdContract uint64) error

func (*BoltDB) StoreNodeData

func (db *BoltDB) StoreNodeData(data *NodeData) error

type GeoData

type GeoData struct {
	CountryCode    string  `json:"country_code"`
	CountryName    string  `json:"country_name"`
	City           string  `json:"city"`
	Latitude       float64 `json:"latitude"`
	Longitude      float64 `json:"longitude"`
	AccuracyRadius uint16  `json:"accuracy_radius"`
}

type NodeData

type NodeData struct {
	UpdatedAt          time.Time `json:"updated_at"`
	IPAddress          string    `json:"ip_address"`
	GeoData            GeoData   `json:"geo_data"`
	NodeVersion        string    `json:"node_version"`
	OperatorID         string    `json:"-"`
	OperatorIDContract uint64    `json:"operator_id"`
}

type Operator

type Operator struct {
	OperatorIDContract uint64
	PublicKey          string
	OperatorID         string
}

type State

type State struct {
	LastBlock big.Int
}

Jump to

Keyboard shortcuts

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