mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 03:00:42 +00:00
feat: deepen machine and storage contracts
This commit is contained in:
parent
6f0f0643fe
commit
04575d111c
5 changed files with 77 additions and 27 deletions
|
|
@ -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
15
contract/storage.go
Normal 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"`
|
||||
}
|
||||
|
|
@ -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"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue