57 lines
1.8 KiB
Go
57 lines
1.8 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// Pool represents a ZFS pool
|
|
type Pool struct {
|
|
Name string `json:"name"`
|
|
Status string `json:"status"` // ONLINE, DEGRADED, FAULTED, etc.
|
|
Size uint64 `json:"size"` // bytes
|
|
Allocated uint64 `json:"allocated"`
|
|
Free uint64 `json:"free"`
|
|
Health string `json:"health"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// Dataset represents a ZFS filesystem
|
|
type Dataset struct {
|
|
Name string `json:"name"`
|
|
Pool string `json:"pool"`
|
|
Type string `json:"type"` // filesystem, volume
|
|
Size uint64 `json:"size"`
|
|
Used uint64 `json:"used"`
|
|
Available uint64 `json:"available"`
|
|
Mountpoint string `json:"mountpoint"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// ZVOL represents a ZFS block device
|
|
type ZVOL struct {
|
|
Name string `json:"name"`
|
|
Pool string `json:"pool"`
|
|
Size uint64 `json:"size"` // bytes
|
|
Used uint64 `json:"used"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// Snapshot represents a ZFS snapshot
|
|
type Snapshot struct {
|
|
Name string `json:"name"`
|
|
Dataset string `json:"dataset"`
|
|
Size uint64 `json:"size"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// SnapshotPolicy defines automated snapshot rules
|
|
type SnapshotPolicy struct {
|
|
Dataset string `json:"dataset"`
|
|
Frequent int `json:"frequent"` // keep N frequent snapshots
|
|
Hourly int `json:"hourly"` // keep N hourly snapshots
|
|
Daily int `json:"daily"` // keep N daily snapshots
|
|
Weekly int `json:"weekly"` // keep N weekly snapshots
|
|
Monthly int `json:"monthly"` // keep N monthly snapshots
|
|
Yearly int `json:"yearly"` // keep N yearly snapshots
|
|
Autosnap bool `json:"autosnap"` // enable/disable
|
|
Autoprune bool `json:"autoprune"` // enable/disable
|
|
}
|