Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoMigrate ¶
AutoMigrate runs migrations for all registered models.
func RegisterModel ¶
func RegisterModel(model any)
RegisterModel adds a model to the migration registry. Call this in init() of each model file.
Types ¶
type APIKey ¶
type APIKey struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_api_keys_id"`
Name string `gorm:"column:name;size:255;not null;default:'';index:idx_api_keys_name"`
KeyHash string `gorm:"column:key_hash;size:255;not null;default:''"`
KeyPrefix string `gorm:"column:key_prefix;size:255;not null;default:''"`
Deleted bool `gorm:"column:deleted;not null;default:false;index"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
}
APIKey maps api_keys table.
type Deployment ¶
type Deployment struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_deployments_id"`
Name string `gorm:"column:name;size:255;not null;default:'';index:idx_deployments_name"`
DeploymentID string `gorm:"column:deployment_id;size:255;not null;default:''"`
BaseModel string `gorm:"column:base_model;size:255;not null;default:'';index:idx_deployments_base_model"`
BaseModelID string `gorm:"column:base_model_id;size:255;not null;default:''"`
MinReplicas int32 `gorm:"column:min_replicas;not null;default:1"`
MaxReplicas int32 `gorm:"column:max_replicas;not null;default:1"`
GpusPerReplica int32 `gorm:"column:gpus_per_replica;not null;default:0"`
GpuType string `gorm:"column:gpu_type;size:255;not null;default:''"`
Region string `gorm:"column:region;size:255;not null;default:''"`
CreatedBy string `gorm:"column:created_by;size:255;not null;default:'';index:idx_deployments_created_by"`
Status string `gorm:"column:status;size:255;not null;default:'Deploying';index:idx_deployments_status"`
ModelSource string `gorm:"column:model_source;size:255;not null;default:''"`
ModelArtifactURL string `gorm:"column:model_artifact_url;size:1000;not null;default:''"`
Engine string `gorm:"column:engine;size:255;not null;default:''"`
StartupCommand string `gorm:"column:startup_command;type:text"`
EnvVars datatypes.JSON `gorm:"column:env_vars"`
ExtraArgs datatypes.JSON `gorm:"column:extra_args"`
Namespace string `gorm:"column:namespace;size:255;not null;default:'default'"`
K8sResourceName string `gorm:"column:k8s_resource_name;size:255;not null;default:''"`
Deleted bool `gorm:"column:deleted;not null;default:false;index"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
Deployment maps to deployments table.
func (*Deployment) FromPB ¶
func (d *Deployment) FromPB(src *pb.Deployment) error
FromPB converts a pb.Deployment to Deployment.
func (Deployment) TableName ¶
func (Deployment) TableName() string
func (*Deployment) ToPB ¶
func (d *Deployment) ToPB() (*pb.Deployment, error)
ToPB converts Deployment to pb.Deployment.
type Job ¶
type Job struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:64;not null;uniqueIndex:uniq_jobs_id"`
Endpoint string `gorm:"column:endpoint;size:255;not null;default:''"`
Model string `gorm:"column:model;size:255;not null;default:'';index:idx_jobs_model"`
InputDataset string `gorm:"column:input_dataset;size:255;not null;default:''"`
CompletionWindow string `gorm:"column:completion_window;size:64;not null;default:''"`
Status string `gorm:"column:status;size:64;not null;default:'';index:idx_jobs_status"`
OutputDataset string `gorm:"column:output_dataset;size:255;not null;default:''"`
ErrorDataset string `gorm:"column:error_dataset;size:255;not null;default:''"`
BatchCreatedAt *time.Time `gorm:"column:batch_created_at"`
InProgressAt *time.Time `gorm:"column:in_progress_at"`
ExpiresAt *time.Time `gorm:"column:expires_at"`
FinalizingAt *time.Time `gorm:"column:finalizing_at"`
CompletedAt *time.Time `gorm:"column:completed_at"`
FailedAt *time.Time `gorm:"column:failed_at"`
ExpiredAt *time.Time `gorm:"column:expired_at"`
CancellingAt *time.Time `gorm:"column:cancelling_at"`
CancelledAt *time.Time `gorm:"column:cancelled_at"`
RequestCounts datatypes.JSON `gorm:"column:request_counts"`
Usage datatypes.JSON `gorm:"column:usage_stats"`
Metadata datatypes.JSON `gorm:"column:metadata"`
Name string `gorm:"column:name;size:255;not null;default:''"`
CreatedBy string `gorm:"column:created_by;size:255;not null;default:''"`
ModelTemplateName string `gorm:"column:model_template_name;size:255;not null;default:''"`
ModelTemplateVersion string `gorm:"column:model_template_version;size:64;not null;default:''"`
BatchID string `gorm:"column:batch_id;size:64;not null;default:'';index:idx_jobs_batch_id"`
ProvisionID string `gorm:"column:provision_id;size:36;not null;default:''"`
QueuedAt *time.Time `gorm:"column:queued_at"`
ResourcePreparingAt *time.Time `gorm:"column:resource_preparing_at"`
SubmittingAt *time.Time `gorm:"column:submitting_at"`
ResourceFailedAt *time.Time `gorm:"column:resource_failed_at"`
SubmitFailedAt *time.Time `gorm:"column:submit_failed_at"`
CancelRequestedAt *time.Time `gorm:"column:cancel_requested_at"`
ErrorMessage string `gorm:"column:error_msg;type:TEXT"`
Deleted bool `gorm:"column:deleted;not null;default:false;index:idx_jobs_deleted"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;index:idx_jobs_created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
Job stores full batch job records including metadata-service owned fields.
type Model ¶
type Model struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_models_id"`
Name string `gorm:"column:name;size:255;not null;default:'';index:idx_models_name"`
Provider string `gorm:"column:provider;size:255;not null;default:'';index:idx_models_provider"`
IconBg string `gorm:"column:icon_bg;size:255;not null;default:''"`
IconText string `gorm:"column:icon_text;size:255;not null;default:''"`
IconTextColor string `gorm:"column:icon_text_color;size:255;not null;default:''"`
Categories datatypes.JSON `gorm:"column:categories"`
IsNew bool `gorm:"column:is_new;not null;default:false"`
Pricing datatypes.JSON `gorm:"column:pricing"`
ContextLength string `gorm:"column:context_length;size:255;not null;default:''"`
Description string `gorm:"column:description;type:text"`
Metadata datatypes.JSON `gorm:"column:metadata"`
Specification datatypes.JSON `gorm:"column:specification"`
Tags datatypes.JSON `gorm:"column:tags"`
ServingName string `gorm:"column:serving_name;size:255;not null;default:''"`
Deleted bool `gorm:"column:deleted;not null;default:false;index"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
Model maps model catalog table.
type ModelDeploymentTemplate ¶
type ModelDeploymentTemplate struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_model_tpl_id"`
Name string `gorm:"column:name;size:255;not null;default:'';uniqueIndex:uniq_model_tpl_name_ver,priority:2"`
Version string `gorm:"column:version;size:64;not null;default:'';uniqueIndex:uniq_model_tpl_name_ver,priority:3"`
Status string `gorm:"column:status;size:64;not null;default:'active';index:idx_model_tpl_status"`
ModelID string `gorm:"column:model_id;size:36;not null;default:'';index:idx_model_tpl_status;uniqueIndex:uniq_model_tpl_name_ver,priority:1"`
Spec datatypes.JSON `gorm:"column:spec"`
Deleted bool `gorm:"column:deleted;not null;default:false;index:idx_model_tpl_deleted"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
ModelDeploymentTemplate maps model_deployment_templates table.
func (*ModelDeploymentTemplate) FromPB ¶
func (t *ModelDeploymentTemplate) FromPB(src *pb.ModelDeploymentTemplate) error
FromPB converts a pb.ModelDeploymentTemplate to ModelDeploymentTemplate.
func (ModelDeploymentTemplate) TableName ¶
func (ModelDeploymentTemplate) TableName() string
func (*ModelDeploymentTemplate) ToPB ¶
func (t *ModelDeploymentTemplate) ToPB() (*pb.ModelDeploymentTemplate, error)
ToPB converts ModelDeploymentTemplate to pb.ModelDeploymentTemplate.
type ProvisionResult ¶
type ProvisionResult struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
IdempotencyKey string `gorm:"column:idempotency_key;size:255;not null;default:'';uniqueIndex:uniq_provision_results_idempotency_key"`
ProvisionID string `gorm:"column:provision_id;size:36;not null;default:'';uniqueIndex:uniq_provision_results_provision_id"`
Provider string `gorm:"column:provider;size:32;not null;default:'kubernetes';index:idx_provision_results_provider"`
Region string `gorm:"column:region;size:255;not null;default:'';index:idx_provision_results_region"`
Status string `gorm:"column:status;size:64;not null;index:idx_provision_results_status_deleted,priority:1"`
Payload datatypes.JSON `gorm:"column:payload"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
Deleted bool `gorm:"column:deleted;not null;default:false;index:idx_provision_results_status_deleted,priority:2"`
}
ProvisionResult maps provision_results table.
func (ProvisionResult) TableName ¶
func (ProvisionResult) TableName() string
type Quota ¶
type Quota struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_quotas_id"`
Name string `gorm:"column:name;size:255;not null;default:'';index:idx_quotas_name"`
QuotaID string `gorm:"column:quota_id;size:255;not null;default:'';uniqueIndex:uniq_quotas_quota_id"`
CurrentUsage int32 `gorm:"column:current_usage;not null;default:0"`
Quota int32 `gorm:"column:quota;not null;default:0"`
Deleted bool `gorm:"column:deleted;not null;default:false;index"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
Quota maps quotas table.
type Secret ¶
type Secret struct {
RowID uint64 `gorm:"column:row_id;primaryKey;autoIncrement"`
ID string `gorm:"column:id;size:36;not null;uniqueIndex:uniq_secrets_id"`
Name string `gorm:"column:name;size:255;not null;default:'';index:idx_secrets_name"`
EncryptedValue string `gorm:"column:encrypted_value;type:text"`
Deleted bool `gorm:"column:deleted;not null;default:false;index"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
}
Secret maps secrets table.