[DEPRECATED] Go implementation of plcbundle
at 4c90c2aa4383441204bab523347d2e6e2bd7dfc2 58 lines 2.5 kB view raw
1package server 2 3import "time" 4 5// StatusResponse is the /status endpoint response 6type StatusResponse struct { 7 Bundles BundleStatus `json:"bundles"` 8 Mempool *MempoolStatus `json:"mempool,omitempty"` 9 Server ServerStatus `json:"server"` 10} 11 12// ServerStatus contains server information 13type ServerStatus struct { 14 Version string `json:"version"` 15 UptimeSeconds int `json:"uptime_seconds"` 16 SyncMode bool `json:"sync_mode"` 17 SyncIntervalSeconds int `json:"sync_interval_seconds,omitempty"` 18 WebSocketEnabled bool `json:"websocket_enabled"` 19 Origin string `json:"origin,omitempty"` 20} 21 22// BundleStatus contains bundle statistics 23type BundleStatus struct { 24 Count int `json:"count"` 25 FirstBundle int `json:"first_bundle,omitempty"` 26 LastBundle int `json:"last_bundle,omitempty"` 27 TotalSize int64 `json:"total_size"` 28 UncompressedSize int64 `json:"uncompressed_size,omitempty"` 29 CompressionRatio float64 `json:"compression_ratio,omitempty"` 30 TotalOperations int `json:"total_operations,omitempty"` 31 AvgOpsPerHour int `json:"avg_ops_per_hour,omitempty"` 32 StartTime time.Time `json:"start_time,omitempty"` 33 EndTime time.Time `json:"end_time,omitempty"` 34 UpdatedAt time.Time `json:"updated_at"` 35 HeadAgeSeconds int `json:"head_age_seconds,omitempty"` 36 RootHash string `json:"root_hash,omitempty"` 37 HeadHash string `json:"head_hash,omitempty"` 38 Gaps int `json:"gaps,omitempty"` 39 HasGaps bool `json:"has_gaps"` 40 GapNumbers []int `json:"gap_numbers,omitempty"` 41} 42 43// MempoolStatus contains mempool statistics 44type MempoolStatus struct { 45 Count int `json:"count"` 46 TargetBundle int `json:"target_bundle"` 47 CanCreateBundle bool `json:"can_create_bundle"` 48 MinTimestamp time.Time `json:"min_timestamp"` 49 Validated bool `json:"validated"` 50 ProgressPercent float64 `json:"progress_percent"` 51 BundleSize int `json:"bundle_size"` 52 OperationsNeeded int `json:"operations_needed"` 53 FirstTime time.Time `json:"first_time,omitempty"` 54 LastTime time.Time `json:"last_time,omitempty"` 55 TimespanSeconds int `json:"timespan_seconds,omitempty"` 56 LastOpAgeSeconds int `json:"last_op_age_seconds,omitempty"` 57 EtaNextBundleSeconds int `json:"eta_next_bundle_seconds,omitempty"` 58}