mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
75 lines
2.7 KiB
Go
75 lines
2.7 KiB
Go
/*
|
|
Copyright 2021 Erigon contributors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package diagnostics
|
|
|
|
type PeerStatisticsGetter interface {
|
|
GetPeersStatistics() map[string]*PeerStatistics
|
|
}
|
|
|
|
type PeerStatistics struct {
|
|
BytesIn uint64
|
|
BytesOut uint64
|
|
CapBytesIn map[string]uint64
|
|
CapBytesOut map[string]uint64
|
|
TypeBytesIn map[string]uint64
|
|
TypeBytesOut map[string]uint64
|
|
}
|
|
|
|
type SnapshotDownloadStatistics struct {
|
|
Downloaded uint64 `json:"downloaded"`
|
|
Total uint64 `json:"total"`
|
|
TotalTime float64 `json:"totalTime"`
|
|
DownloadRate uint64 `json:"downloadRate"`
|
|
UploadRate uint64 `json:"uploadRate"`
|
|
Peers int32 `json:"peers"`
|
|
Files int32 `json:"files"`
|
|
Connections uint64 `json:"connections"`
|
|
Alloc uint64 `json:"alloc"`
|
|
Sys uint64 `json:"sys"`
|
|
DownloadFinished bool `json:"downloadFinished"`
|
|
SegmentsDownloading map[string]SegmentDownloadStatistics `json:"segmentsDownloading"`
|
|
SegmentIndexing SnapshotIndexingStatistics `json:"segmentsIndexing"`
|
|
TorrentMetadataReady int32 `json:"torrentMetadataReady"`
|
|
}
|
|
|
|
type SegmentDownloadStatistics struct {
|
|
Name string `json:"name"`
|
|
TotalBytes uint64 `json:"totalBytes"`
|
|
DownloadedBytes uint64 `json:"downloadedBytes"`
|
|
WebseedsCount int `json:"webseedsCount"`
|
|
PeersCount int `json:"peersCount"`
|
|
WebseedsRate uint64 `json:"webseedsRate"`
|
|
PeersRate uint64 `json:"peersRate"`
|
|
}
|
|
|
|
type SnapshotIndexingStatistics struct {
|
|
Segments map[string]int `json:"segments"`
|
|
TimeElapsed float64 `json:"timeElapsed"`
|
|
}
|
|
|
|
func (ti SnapshotDownloadStatistics) Type() Type {
|
|
return TypeOf(ti)
|
|
}
|
|
|
|
func (ti SegmentDownloadStatistics) Type() Type {
|
|
return TypeOf(ti)
|
|
}
|
|
|
|
func (ti SnapshotIndexingStatistics) Type() Type {
|
|
return TypeOf(ti)
|
|
}
|