common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DbStateClosed means db was closed gracefully
	DbStateClosed = uint32(iota)
	// DbStateOpen means db is open or application died without closing the db
	DbStateOpen
	// DbStateInconsistent means db is in inconsistent state and cannot be used
	DbStateInconsistent
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InternalState

type InternalState struct {
	Coin         string `json:"coin"`
	CoinShortcut string `json:"coinShortcut"`
	CoinLabel    string `json:"coinLabel"`
	Host         string `json:"host"`

	DbState uint32 `json:"dbState"`

	LastStore time.Time `json:"lastStore"`

	// true if application is with flag --sync
	SyncMode bool `json:"syncMode"`

	InitialSync    bool      `json:"initialSync"`
	IsSynchronized bool      `json:"isSynchronized"`
	BestHeight     uint32    `json:"bestHeight"`
	LastSync       time.Time `json:"lastSync"`

	IsMempoolSynchronized bool      `json:"isMempoolSynchronized"`
	MempoolSize           int       `json:"mempoolSize"`
	LastMempoolSync       time.Time `json:"lastMempoolSync"`

	DbColumns []InternalStateColumn `json:"dbColumns"`
	// contains filtered or unexported fields
}

InternalState contains the data of the internal state

func UnpackInternalState

func UnpackInternalState(buf []byte) (*InternalState, error)

UnpackInternalState unmarshals internal state from json

func (*InternalState) AddDBColumnStats

func (is *InternalState) AddDBColumnStats(c int, rowsDiff int64, keyBytesDiff int64, valueBytesDiff int64)

AddDBColumnStats adds differences in column statistics to column stats

func (*InternalState) DBSizeTotal

func (is *InternalState) DBSizeTotal() int64

DBSizeTotal sums the computed sizes of all columns

func (*InternalState) FinishedMempoolSync

func (is *InternalState) FinishedMempoolSync(mempoolSize int)

FinishedMempoolSync marks end of mempool synchronization

func (*InternalState) FinishedSync

func (is *InternalState) FinishedSync(bestHeight uint32)

FinishedSync marks end of synchronization, bestHeight specifies new best block height

func (*InternalState) FinishedSyncNoChange

func (is *InternalState) FinishedSyncNoChange()

FinishedSyncNoChange marks end of synchronization in case no index update was necessary, it does not update lastSync time

func (*InternalState) GetAllDBColumnStats

func (is *InternalState) GetAllDBColumnStats() []InternalStateColumn

GetAllDBColumnStats returns stats for all columns

func (*InternalState) GetDBColumnStatValues

func (is *InternalState) GetDBColumnStatValues(c int) (int64, int64, int64)

GetDBColumnStatValues gets stat values for given column

func (*InternalState) GetMempoolSyncState

func (is *InternalState) GetMempoolSyncState() (bool, time.Time, int)

GetMempoolSyncState gets the state of mempool synchronization

func (*InternalState) GetSyncState

func (is *InternalState) GetSyncState() (bool, uint32, time.Time)

GetSyncState gets the state of synchronization

func (*InternalState) Pack

func (is *InternalState) Pack() ([]byte, error)

Pack marshals internal state to json

func (*InternalState) SetDBColumnStats

func (is *InternalState) SetDBColumnStats(c int, rows int64, keyBytes int64, valueBytes int64)

SetDBColumnStats sets new values of column stats

func (*InternalState) StartedMempoolSync

func (is *InternalState) StartedMempoolSync()

StartedMempoolSync signals start of mempool synchronization

func (*InternalState) StartedSync

func (is *InternalState) StartedSync()

StartedSync signals start of synchronization

func (*InternalState) UpdateBestHeight added in v0.1.0

func (is *InternalState) UpdateBestHeight(bestHeight uint32)

UpdateBestHeight sets new best height, without changing IsSynchronized flag

type InternalStateColumn

type InternalStateColumn struct {
	Name       string    `json:"name"`
	Version    uint32    `json:"version"`
	Rows       int64     `json:"rows"`
	KeyBytes   int64     `json:"keyBytes"`
	ValueBytes int64     `json:"valueBytes"`
	Updated    time.Time `json:"updated"`
}

InternalStateColumn contains the data of a db column

type Labels

type Labels = prometheus.Labels

type Metrics

type Metrics struct {
	SocketIORequests      *prometheus.CounterVec
	SocketIOSubscribes    *prometheus.CounterVec
	SocketIOClients       prometheus.Gauge
	SocketIOReqDuration   *prometheus.HistogramVec
	IndexResyncDuration   prometheus.Histogram
	MempoolResyncDuration prometheus.Histogram
	TxCacheEfficiency     *prometheus.CounterVec
	RPCLatency            *prometheus.HistogramVec
	IndexResyncErrors     *prometheus.CounterVec
	IndexDBSize           prometheus.Gauge
	ExplorerViews         *prometheus.CounterVec
	MempoolSize           prometheus.Gauge
	DbColumnRows          *prometheus.GaugeVec
	DbColumnSize          *prometheus.GaugeVec
	BlockbookAppInfo      *prometheus.GaugeVec
}

func GetMetrics

func GetMetrics(coin string) (*Metrics, error)

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	GitCommit string `json:"gitcommit"`
	BuildTime string `json:"buildtime"`
	GoVersion string `json:"goversion"`
	OSArch    string `json:"os/arch"`
}

func GetVersionInfo

func GetVersionInfo() VersionInfo

Jump to

Keyboard shortcuts

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