Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatsSocketHandler ¶
func StatsSocketHandler(sharedDir string, allowedOrigins []string, disableSystemStats bool, maxStorage int64) http.HandlerFunc
StatsSocketHandler handles WebSocket connections for real-time stats updates It fetches fresh stats from the database and system on each interval and sends them to the client
Types ¶
type ExtendedStats ¶
type ExtendedStats struct {
Downloads int `json:"downloads"`
Requests int `json:"requests"`
Uploads int `json:"uploads"`
BytesUploaded int64 `json:"bytesUploaded"`
BytesDownloaded int64 `json:"bytesDownloaded"`
StartTime time.Time `json:"startTime"`
Storage StorageUsage `json:"storage"`
System *system.SystemStats `json:"system,omitempty"`
}
ExtendedStats contains both database stats, system stats, and storage usage.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type StorageUsage ¶ added in v0.2.10
type StorageUsage struct {
// UsedBytes is the total bytes consumed by files in the shared directory
// (excluding internal .beamdrop metadata directories).
UsedBytes uint64 `json:"usedBytes"`
// TotalBytes is the total capacity of the filesystem where the shared directory lives.
TotalBytes uint64 `json:"totalBytes"`
// FreeBytes is the free space on that filesystem.
FreeBytes uint64 `json:"freeBytes"`
// AllocatedBytes is the storage cap set via -max-storage (0 = unlimited).
AllocatedBytes int64 `json:"allocatedBytes"`
// AvailableBytes is the effective space available for new uploads:
// - If maxStorage is set: max(0, allocatedBytes - usedBytes)
// - If unlimited: free space on disk
AvailableBytes uint64 `json:"availableBytes"`
// UsagePercent is the percentage of the effective limit used:
// - If maxStorage is set: usedBytes / allocatedBytes * 100
// - If unlimited: usedBytes / totalBytes * 100
UsagePercent float64 `json:"usagePercent"`
}
StorageUsage provides Beamdrop-specific storage metrics. It includes the actual disk usage of the shared directory, filesystem capacity, and any max-storage allocation set via the -max-storage flag.
Click to show internal directories.
Click to hide internal directories.