Documentation ¶
Index ¶
- Constants
- type InternalState
- func (is *InternalState) AddDBColumnStats(c int, rowsDiff int64, keyBytesDiff int64, valueBytesDiff int64)
- func (is *InternalState) AppendBlockTime(time uint32)
- func (is *InternalState) DBSizeTotal() int64
- func (is *InternalState) FinishedMempoolSync(mempoolSize int)
- func (is *InternalState) FinishedSync(bestHeight uint32)
- func (is *InternalState) FinishedSyncNoChange()
- func (is *InternalState) GetAllDBColumnStats() []InternalStateColumn
- func (is *InternalState) GetBlockHeightOfTime(time uint32) uint32
- func (is *InternalState) GetBlockTime(height uint32) uint32
- func (is *InternalState) GetDBColumnStatValues(c int) (int64, int64, int64)
- func (is *InternalState) GetMempoolSyncState() (bool, time.Time, int)
- func (is *InternalState) GetSyncState() (bool, uint32, time.Time)
- func (is *InternalState) Pack() ([]byte, error)
- func (is *InternalState) RemoveLastBlockTimes(count int)
- func (is *InternalState) SetDBColumnStats(c int, rows int64, keyBytes int64, valueBytes int64)
- func (is *InternalState) StartedMempoolSync()
- func (is *InternalState) StartedSync()
- func (is *InternalState) UpdateBestHeight(bestHeight uint32)
- type InternalStateColumn
- type JSONNumber
- type Labels
- type Metrics
- type VersionInfo
Constants ¶
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"` BlockTimes []uint32 `json:"-"` IsMempoolSynchronized bool `json:"isMempoolSynchronized"` MempoolSize int `json:"mempoolSize"` LastMempoolSync time.Time `json:"lastMempoolSync"` DbColumns []InternalStateColumn `json:"dbColumns"` UtxoChecked bool `json:"utxoChecked"` // 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) AppendBlockTime ¶
func (is *InternalState) AppendBlockTime(time uint32)
AppendBlockTime appends block time to BlockTimes
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) GetBlockHeightOfTime ¶
func (is *InternalState) GetBlockHeightOfTime(time uint32) uint32
GetBlockHeightOfTime returns block height of the first block with time greater or equal to the given time or MaxUint32 if no such block
func (*InternalState) GetBlockTime ¶
func (is *InternalState) GetBlockTime(height uint32) uint32
GetBlockTime returns block time if block found or 0
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) RemoveLastBlockTimes ¶
func (is *InternalState) RemoveLastBlockTimes(count int)
RemoveLastBlockTimes removes last times from BlockTimes
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 ¶
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 JSONNumber ¶
type JSONNumber string
JSONNumber is used instead of json.Number after upgrade to go 1.14
to handle data which can be numbers in double quotes or possibly not numbers at all
see https://github.com/golang/go/issues/37308
func (JSONNumber) Float64 ¶
func (c JSONNumber) Float64() (float64, error)
Float64 returns JSONNumber as float64
func (JSONNumber) Int64 ¶
func (c JSONNumber) Int64() (int64, error)
Int64 returns JSONNumber as int64
func (JSONNumber) MarshalJSON ¶
func (c JSONNumber) MarshalJSON() ([]byte, error)
MarshalJSON marsalls JSONNumber to []byte if possible, return a number without quotes, otherwise string value in quotes empty string is treated as number 0
func (JSONNumber) String ¶
func (c JSONNumber) String() string
func (*JSONNumber) UnmarshalJSON ¶
func (c *JSONNumber) UnmarshalJSON(d []byte) error
UnmarshalJSON unmarshalls JSONNumber from []byte if the value is in quotes, remove them
type Labels ¶
type Labels = prometheus.Labels
Labels represents a collection of label name -> value mappings.
type Metrics ¶
type Metrics struct { SocketIORequests *prometheus.CounterVec SocketIOSubscribes *prometheus.CounterVec SocketIOClients prometheus.Gauge SocketIOReqDuration *prometheus.HistogramVec WebsocketRequests *prometheus.CounterVec WebsocketSubscribes *prometheus.CounterVec WebsocketClients prometheus.Gauge WebsocketReqDuration *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 }
Metrics holds prometheus collectors for various metrics collected by Blockbook
func GetMetrics ¶
GetMetrics returns struct holding prometheus collectors for various metrics collected by Blockbook
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"` }
VersionInfo holds information about the running Blockbook instance
func GetVersionInfo ¶
func GetVersionInfo() VersionInfo
GetVersionInfo returns VersionInfo of the running Blockbook instance