feat: deepen machine and storage contracts

This commit is contained in:
Harivansh Rathi 2026-04-08 02:32:48 +00:00
parent 6f0f0643fe
commit 04575d111c
5 changed files with 77 additions and 27 deletions

View file

@ -1,7 +1,23 @@
package host
import "time"
type Machine struct {
ID MachineID `json:"id"`
Artifact ArtifactRef `json:"artifact"`
SystemVolumeID VolumeID `json:"system_volume_id,omitempty"`
UserVolumeIDs []VolumeID `json:"user_volume_ids,omitempty"`
Phase MachinePhase `json:"phase"`
RuntimeHost string `json:"runtime_host,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
}
type CreateMachineRequest struct {
MachineID MachineID `json:"machine_id"`
MachineID MachineID `json:"machine_id"`
Artifact ArtifactRef `json:"artifact"`
UserVolumeIDs []VolumeID `json:"user_volume_ids,omitempty"`
}
type CreateMachineResponse struct {

15
contract/storage.go Normal file
View file

@ -0,0 +1,15 @@
package host
import "time"
type ArtifactRef struct {
ID ArtifactID `json:"id"`
Version ArtifactVersion `json:"version"`
}
type Volume struct {
ID VolumeID `json:"id"`
Kind VolumeKind `json:"kind"`
AttachedMachineID *MachineID `json:"attached_machine_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
}

View file

@ -1,6 +1,8 @@
package host
import "time"
type ArtifactID string
type ArtifactVersion string
type MachineID string
@ -23,12 +25,3 @@ const (
VolumeKindSystem VolumeKind = "system"
VolumeKindUser VolumeKind = "user"
)
type Machine struct {
ID MachineID `json:"id"`
Phase MachinePhase `json:"phase"`
RuntimeHost string `json:"runtime_host,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
}