store

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterComponentNames = []string{
	"inference-manager-engine",
	"model-manager-loader",
	"session-manager-agent",
	"job-manager-dispatcher",
}

ClusterComponentNames is the names of cluster components.

Functions

func CreateClusterComponent added in v1.3.0

func CreateClusterComponent(tx *gorm.DB, c *ClusterComponent) error

CreateClusterComponent creates a new cluster component in the store

func DeleteClusterComponents added in v1.3.0

func DeleteClusterComponents(tx *gorm.DB, clusterID string) error

DeleteClusterComponents deletes cluster components by cluster ID.

Types

type Cluster

type Cluster struct {
	gorm.Model

	ClusterID string `gorm:"uniqueIndex"`

	TenantID string `gorm:"uniqueIndex:idx_cluster_tenant_id_name"`

	Name string `gorm:"uniqueIndex:idx_cluster_tenant_id_name"`

	RegistrationKey string
}

Cluster represents a cluster.

type ClusterComponent added in v1.3.0

type ClusterComponent struct {
	gorm.Model

	ClusterID     string `gorm:"uniqueIndex:idx_component_cluster_id_name"`
	Name          string `gorm:"uniqueIndex:idx_component_cluster_id_name"`
	IsHealthy     bool
	StatusMessage string
}

ClusterComponent represents a component in a cluster.

func FindClusterComponent added in v1.3.0

func FindClusterComponent(tx *gorm.DB, clusterID, name string) (*ClusterComponent, error)

FindClusterComponent fetches the component for the given cluster and component name.

type ClusterSpec

type ClusterSpec struct {
	ClusterID       string
	TenantID        string
	Name            string
	RegistrationKey string
}

ClusterSpec is a spec of the cluster

type S

type S struct {
	// contains filtered or unexported fields
}

S represents the data store.

func New

func New(db *gorm.DB) *S

New creates a new store instance.

func NewTest

func NewTest(t *testing.T) (*S, func())

NewTest returns a new test store.

func (*S) AutoMigrate

func (s *S) AutoMigrate() error

AutoMigrate sets up the auto-migration task of the database.

func (*S) CreateCluster

func (s *S) CreateCluster(spec ClusterSpec) (*Cluster, error)

CreateCluster creates a cluster.

func (*S) DB added in v1.3.0

func (s *S) DB() *gorm.DB

DB returns the gorm database instance.

func (*S) DeleteCluster

func (s *S) DeleteCluster(clusterID, tenantID string) error

DeleteCluster deletes a cluster by cluster ID and tenant ID.

func (*S) FindClusterComponents added in v1.3.0

func (s *S) FindClusterComponents(clusterID string) ([]ClusterComponent, error)

FindClusterComponents fetches the components for the given cluster.

func (*S) GetCluster

func (s *S) GetCluster(clusterID, tenantID string) (*Cluster, error)

GetCluster returns a cluster by cluster ID and tenant ID.

func (*S) GetClusterByNameAndTenantID

func (s *S) GetClusterByNameAndTenantID(name, tenantID string) (*Cluster, error)

GetClusterByNameAndTenantID returns a cluster by name and tenant ID.

func (*S) ListClusters

func (s *S) ListClusters() ([]*Cluster, error)

ListClusters lists clusters.

func (*S) ListClustersByTenantID

func (s *S) ListClustersByTenantID(tenantID string) ([]*Cluster, error)

ListClustersByTenantID lists clusters.

func (*S) UpdateOrCreateClusterComponent added in v1.3.0

func (s *S) UpdateOrCreateClusterComponent(c *ClusterComponent) error

UpdateOrCreateClusterComponent sets the appropriate cluster component fields in the database given a pointer to a component.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL