package media_shard import "time" const ( StatusUnknown = "unknown" StatusRunning = "running" StatusFailed = "failed" StatusDisabled = "disabled" ) // Shard stores only a loopback control endpoint. It is deliberately omitted // from API response DTOs so credentials and control-plane topology cannot leak. type Shard struct { ID string `gorm:"size:64;primaryKey"` Name string `gorm:"size:128;not null"` Mode string `gorm:"size:16;not null"` ControlAPI string `gorm:"size:512;not null"` Capacity int `gorm:"not null"` Status string `gorm:"size:16;not null;index"` Detail string `gorm:"size:256;not null"` LastProbeAt *time.Time `gorm:"index"` ConfigVersion int64 `gorm:"not null;default:1"` CreatedAt time.Time UpdatedAt time.Time } func (Shard) TableName() string { return "sense_media_shards" } // Assignment is the stable, Sense-owned mapping between an existing media // route and a MediaMTX shard. Failures never rewrite this record automatically. type Assignment struct { RouteID string `gorm:"size:96;primaryKey"` ShardID string `gorm:"size:64;not null;index"` Algorithm string `gorm:"size:32;not null"` CreatedAt time.Time `gorm:"not null"` UpdatedAt time.Time `gorm:"not null"` } func (Assignment) TableName() string { return "sense_media_shard_assignments" } type routeProjection struct { ID string `gorm:"column:id"` DeviceID string `gorm:"column:device_id"` ProfileToken string `gorm:"column:profile_token"` Path string `gorm:"column:path"` Desired string `gorm:"column:desired"` Actual string `gorm:"column:actual"` } func (routeProjection) TableName() string { return "sense_media_routes" } type deviceProjection struct { ID string `gorm:"column:id"` Name string `gorm:"column:name"` Location string `gorm:"column:location"` } func (deviceProjection) TableName() string { return "sense_devices" }