Documentation
¶
Overview ¶
Package metering emits append-only VM/snapshot lifecycle endpoints; tenant attribution lives upstream.
Index ¶
Constants ¶
View Source
const ( KindVMComputeStart Kind = "vm.compute.start" KindVMComputeStop Kind = "vm.compute.stop" KindVMStorageStart Kind = "vm.storage.start" KindVMStorageStop Kind = "vm.storage.stop" KindSnapStorageStart Kind = "snap.storage.start" KindSnapStorageStop Kind = "snap.storage.stop" ReasonBoot Reason = "boot" ReasonRestart Reason = "restart" ReasonClone Reason = "clone" ReasonRestore Reason = "restore" ReasonHibernateWake Reason = "hibernate-wake" ReasonStopUser Reason = "stop-user" ReasonStopCrash Reason = "stop-crash" ReasonVMRemove Reason = "vm-rm" ReasonSnapRemove Reason = "snap-rm" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaptureRecorder ¶
type CaptureRecorder struct {
// contains filtered or unexported fields
}
CaptureRecorder accumulates entries in memory; intended for tests that assert emit sequences.
func (*CaptureRecorder) Entries ¶
func (r *CaptureRecorder) Entries() []Entry
Entries returns a snapshot copy so callers can mutate freely.
type Entry ¶
type Entry struct {
Kind Kind `json:"kind"`
VMID string `json:"vm_id,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
SourceSnapshotID string `json:"source_snapshot_id,omitempty"`
Reason Reason `json:"reason,omitempty"`
Hypervisor string `json:"hypervisor,omitempty"`
Shape Shape `json:"shape"`
EmittedAt time.Time `json:"emitted_at"`
}
Entry is one append-only lifecycle event.
type FileRecorder ¶
type FileRecorder struct {
// contains filtered or unexported fields
}
FileRecorder appends JSON-encoded entries one per line under sync.Mutex; cross-process atomicity comes from O_APPEND.
type Kind ¶
type Kind string
Kind identifies a lifecycle endpoint; downstream pairs *.start with *.stop by id.
type NopRecorder ¶
type NopRecorder struct{}
NopRecorder discards every entry; zero value is usable.
Click to show internal directories.
Click to hide internal directories.