mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 03:00:42 +00:00
feat: initial contracts
This commit is contained in:
parent
58f95324f4
commit
6f0f0643fe
7 changed files with 127 additions and 0 deletions
12
internal/daemon/daemon.go
Normal file
12
internal/daemon/daemon.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"github.com/getcompanion-ai/computer-host/internal/store"
|
||||
)
|
||||
|
||||
type Runtime interface{}
|
||||
|
||||
type Daemon struct {
|
||||
Store store.Store
|
||||
Runtime Runtime
|
||||
}
|
||||
16
internal/httpapi/handlers.go
Normal file
16
internal/httpapi/handlers.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package httpapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
contracthost "github.com/getcompanion-ai/computer-host/contract"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
CreateMachine(context.Context, contracthost.CreateMachineRequest) (*contracthost.CreateMachineResponse, error)
|
||||
GetMachine(context.Context, contracthost.MachineID) (*contracthost.GetMachineResponse, error)
|
||||
ListMachines(context.Context) (*contracthost.ListMachinesResponse, error)
|
||||
StopMachine(context.Context, contracthost.MachineID) error
|
||||
DeleteMachine(context.Context, contracthost.MachineID) error
|
||||
Health(context.Context) (*contracthost.HealthResponse, error)
|
||||
}
|
||||
27
internal/model/types.go
Normal file
27
internal/model/types.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
contracthost "github.com/getcompanion-ai/computer-host/contract"
|
||||
)
|
||||
|
||||
type MachineRecord struct {
|
||||
ID contracthost.MachineID
|
||||
Phase contracthost.MachinePhase
|
||||
RuntimeHost string
|
||||
Error string
|
||||
CreatedAt time.Time
|
||||
StartedAt *time.Time
|
||||
}
|
||||
|
||||
type StoragePool string
|
||||
|
||||
type VolumeRecord struct {
|
||||
ID contracthost.VolumeID
|
||||
MachineID contracthost.MachineID
|
||||
Kind contracthost.VolumeKind
|
||||
Pool StoragePool
|
||||
Path string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
16
internal/store/store.go
Normal file
16
internal/store/store.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/getcompanion-ai/computer-host/internal/model"
|
||||
contracthost "github.com/getcompanion-ai/computer-host/contract"
|
||||
)
|
||||
|
||||
type Store interface {
|
||||
CreateMachine(context.Context, model.MachineRecord) error
|
||||
GetMachine(context.Context, contracthost.MachineID) (*model.MachineRecord, error)
|
||||
ListMachines(context.Context) ([]model.MachineRecord, error)
|
||||
UpdateMachine(context.Context, model.MachineRecord) error
|
||||
DeleteMachine(context.Context, contracthost.MachineID) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue