models

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	BaseModel
	ArtifactKey
	DatasetUUID        string         `gorm:"type:uuid;index:artifacts_dataset_uuid_idx"`
	Dataset            Dataset        `gorm:"association_autocreate:false"`
	ArtifactData       []ArtifactData `` /* 162-byte string literal not displayed */
	Partitions         []Partition    `gorm:"references:ArtifactID;foreignkey:ArtifactID"`
	Tags               []Tag          `gorm:"references:ArtifactID,DatasetUUID;foreignkey:ArtifactID,DatasetUUID"`
	SerializedMetadata []byte
}

type ArtifactData

type ArtifactData struct {
	BaseModel
	ArtifactKey
	Name     string `gorm:"primary_key"`
	Location string
}

type ArtifactKey

type ArtifactKey struct {
	DatasetProject string `gorm:"primary_key"`
	DatasetName    string `gorm:"primary_key"`
	DatasetDomain  string `gorm:"primary_key"`
	DatasetVersion string `gorm:"primary_key"`
	ArtifactID     string `gorm:"primary_key"`
}

type BaseModel

type BaseModel struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

type DBQueryExpr

type DBQueryExpr struct {
	Query string
	Args  interface{}
}

Encapsulates the query and necessary arguments to issue a DB query.

type Dataset

type Dataset struct {
	BaseModel
	DatasetKey
	SerializedMetadata []byte
	PartitionKeys      []PartitionKey `gorm:"references:UUID;foreignkey:DatasetUUID"`
}

func (*Dataset) BeforeCreate

func (dataset *Dataset) BeforeCreate(tx *gorm.DB) error

BeforeCreate so that we set the UUID in golang rather than from a DB function call

type DatasetKey

type DatasetKey struct {
	Project string `gorm:"primary_key;"`                          // part of pkey, no index needed as it is first column in the pkey
	Name    string `gorm:"primary_key;index:dataset_name_idx"`    // part of pkey and has separate index for filtering
	Domain  string `gorm:"primary_key;index:dataset_domain_idx"`  // part of pkey and has separate index for filtering
	Version string `gorm:"primary_key;index:dataset_version_idx"` // part of pkey and has separate index for filtering
	UUID    string `gorm:"type:uuid;unique;"`
}

type ListModelsInput

type ListModelsInput struct {
	// The filters for the list
	ModelFilters []ModelFilter
	// The number of models to list
	Limit int
	// The token to offset results by
	Offset int
	// Parameter to sort by
	SortParameter SortParameter
}

Inputs to specify to list models

type ModelFilter

type ModelFilter struct {
	ValueFilters  []ModelValueFilter
	JoinCondition ModelJoinCondition
	Entity        common.Entity
}

A single filter for a model encompasses value filters and optionally a join condition if the filter is not on the source model

type ModelJoinCondition

type ModelJoinCondition interface {
	GetJoinOnDBQueryExpression(sourceTableName string, joiningTableName string, joiningTableAlias string) (string, error)
}

Generates the join expressions for filters that require other entities

type ModelValueFilter

type ModelValueFilter interface {
	GetDBQueryExpression(tableName string) (DBQueryExpr, error)
}

Generates db filter expressions for model values

type Partition

type Partition struct {
	BaseModel
	DatasetUUID string `gorm:"primary_key;type:uuid"`
	Key         string `gorm:"primary_key"`
	Value       string `gorm:"primary_key"`
	ArtifactID  string `gorm:"primary_key;index"` // index for JOINs with the Tag/Labels table when querying artifacts
}

Main Use cases: 1. Filter artifacts by partition key/val in a dataset from UI [x] 2. Get the artifact that has the partitions (x,y,z + tag_name) = latest [x]

type PartitionKey

type PartitionKey struct {
	BaseModel
	DatasetUUID string `gorm:"type:uuid;primary_key"`
	Name        string `gorm:"primary_key"`
}

type Reservation

type Reservation struct {
	BaseModel
	ReservationKey

	// Identifies who owns the reservation
	OwnerID string

	// When the reservation will expire
	ExpiresAt          time.Time
	SerializedMetadata []byte
}

Reservation tracks the metadata needed to allow task cache serialization

type ReservationKey

type ReservationKey struct {
	DatasetProject string `gorm:"primary_key"`
	DatasetName    string `gorm:"primary_key"`
	DatasetDomain  string `gorm:"primary_key"`
	DatasetVersion string `gorm:"primary_key"`
	TagName        string `gorm:"primary_key"`
}

ReservationKey uniquely identifies a reservation

type SortParameter

type SortParameter interface {
	GetDBOrderExpression(tableName string) string
}

type Tag

type Tag struct {
	BaseModel
	TagKey
	ArtifactID  string
	DatasetUUID string   `gorm:"type:uuid;index:tags_dataset_uuid_idx"`
	Artifact    Artifact `` /* 162-byte string literal not displayed */
}

type TagKey

type TagKey struct {
	DatasetProject string `gorm:"primary_key"`
	DatasetName    string `gorm:"primary_key"`
	DatasetDomain  string `gorm:"primary_key"`
	DatasetVersion string `gorm:"primary_key"`
	TagName        string `gorm:"primary_key"`
}

Jump to

Keyboard shortcuts

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