backends

package
v0.0.0-...-e91ad15 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStorageBackend

type ConfigStorageBackend interface {
	WriteCodeSource(ns, name, codeSource string) error
	GetCodeSource(ns, name string) (string, error)
	ListCodeSource(ns string) ([]string, error)
	DeleteCodeSource(ns, name string) error

	WriteDataSource(ns, name, codeSource string) error
	GetDataSource(ns, name string) (string, error)
	ListDataSource(ns string) ([]string, error)
	DeleteDataSource(ns, name string) error
}

type CronQuery

type CronQuery struct {
	UID                 string
	UserName            string
	CronID              string
	Name                string
	Namespace           string
	Type                string
	RegionID            string
	ClusterID           string
	Status              string
	StartTime           time.Time
	EndTime             time.Time
	Deleted             *int
	Pagination          *QueryPagination
	AllocatedNamespaces []string
}

CronQuery contains a collection of options needed for querying a list of conrs persisted in database.

type CronStorageBackend

type CronStorageBackend interface {
	ListCrons(query *CronQuery) ([]*dmo.Cron, error)
	GetCron(ns, name, cronID string) (*dmo.Cron, error)
	DeleteCron(ns, name, cronID string) error
	WriteCron(cron *appsv1alpha1.Cron) error
	ListCronHistories(ns, name, jobName, jobStatus, cronID string) ([]*dmo.Job, error)
}

type EvaluateJobQuery

type EvaluateJobQuery struct {
	StartTime           time.Time
	EndTime             time.Time
	Pagination          *QueryPagination
	AllocatedNamespaces []string
}

type EvaluateJobStorageBackend

type EvaluateJobStorageBackend interface {
	ListEvaluateJobs(query *EvaluateJobQuery) ([]*dmo.EvaluateJob, error)
	GetEvaluateJob(ns, name, evaluateJobID string) (*dmo.EvaluateJob, error)
	DeleteEvaluateJob(ns, name, evaluateJobID string) error
	WriteEvaluateJob(evaluateJob *batch.Job, PV_OSMap map[string]string) error
}

type EventStorageBackend

type EventStorageBackend interface {
	// Initialize initializes a backend storage service with local or remote
	// event hub.
	Initialize() error
	// Close shutdown backend event storage service or disconnect the event hub.
	Close() error
	// Name returns backend name.
	Name() string

	UserName(userName string) EventStorageBackend
	// SaveEvent append or update a event record to backend.
	SaveEvent(event *v1.Event, region string) error
	// ListEvents list all events created by the object with namespaced name.
	ListEvents(namespace, name string, from, to time.Time) ([]*dmo.Event, error)
	// ListLogs list log entries generated by the pod with namespaced name.
	ListLogs(namespace, jobKind, jobName, name string, maxLine int64, from, to time.Time) ([]string, error)
}

EventStorageBackend provides a collection of abstract methods to interact with different storage backends, write/read events.

type JobStorageBackend

type JobStorageBackend interface {
	// WriteJob append or update a job record to backend, region is optional.
	WriteJob(job metav1.Object, kind string, specs map[apiv1.ReplicaType]*apiv1.ReplicaSpec, runPolicy *apiv1.RunPolicy, jobStatus *apiv1.JobStatus, region string) error
	// ReadJob retrieve a job from backend, region is optional.
	ReadJob(ns, name, jobID, kind, region string) (*dmo.Job, error)
	// ListJobs lists those jobs who satisfied with query conditions.
	ListJobs(query *Query) ([]*dmo.Job, error)
	// UpdateJobRecordStopped updates status of job record as stooped.
	UpdateJobRecordStopped(ns, name, jobID, kind, region string) error
	// RemoveJobRecord updates job as deleted from api-server, but not delete job record
	// from backend, region is optional.
	RemoveJobRecord(ns, name, jobID, kind, region string) error
}

type ModelsQuery

type ModelsQuery struct {
	Pagination   *QueryPagination
	ModelName    string
	ModelVersion string
}

type ModelsStorageBackend

type ModelsStorageBackend interface {
	ListModels(query *ModelsQuery) ([]*dmo.Model, error)
	GetModel(modelID string) (*dmo.Model, error)
	DeleteModel(modelID string) error
	WriteModel(model *dmo.Model) error
}

type NotebookQuery

type NotebookQuery struct {
	UID       string
	UserName  string
	Namespace string
}

type NotebookStorageBackend

type NotebookStorageBackend interface {
	ListNotebook(query *NotebookQuery) ([]*dmo.Notebook, error)
	ListAllNotebook(query *NotebookQuery) ([]*dmo.Notebook, error)
	DeleteNotebook(namespace, name string) error
	WriteNotebook(notebook *notebookv1.Notebook) error
	GetNotebook(namespace, name string) (*dmo.Notebook, error)
	UpdateNotebookToken(namespace, name, token string) error
}

type ObjectClientBackend

type ObjectClientBackend interface {
	// Initialize initializes a backend service with local or remote
	// event hub.
	Initialize() error
	// Close shutdown backend service or disconnect the event hub.
	Close() error
	// Name returns backend name.
	Name() string

	UserName(userName string) ObjectClientBackend

	SubmitJob(*dmo.SubmitJobInfo) error
	SubmitEvaluateJob(*dmo.SubmitEvaluateJobInfo) error
	StopJob(ns, name, jobID, kind string) error
	DeleteEvaluateJob(ns, name string) error

	SuspendCron(ns, name, cronID string) error
	ResumeCron(ns, name, cronID string) error
	StopCron(ns, name, cronID string) error
}

type ObjectStorageBackend

type ObjectStorageBackend interface {
	// Initialize initializes a backend storage service with local or remote
	// database.
	Initialize() error
	// Close shutdown backend storage service.
	Close() error
	// Name returns backend name.
	Name() string

	UserName(userName string) ObjectStorageBackend

	PodStorageBackend

	JobStorageBackend

	CronStorageBackend
	EvaluateJobStorageBackend
	ModelsStorageBackend
	NotebookStorageBackend
}

ObjectStorageBackend provides a collection of abstract methods to interact with different storage backends, write/read pod and job objects.

type PodStorageBackend

type PodStorageBackend interface {
	// WritePod append or update a pod record to backend, region is optional.
	WritePod(pod *v1.Pod) error
	// ListPods lists pods controlled by some job, region is optional.
	ListPods(ns, kind, name, jobID string) ([]*dmo.Pod, error)
	// UpdatePodRecordStopped updates status of pod record as stopped.
	UpdatePodRecordStopped(ns, name, podID string) error
}

type Query

type Query struct {
	UID                 string
	UserName            string
	JobID               string
	Name                string
	Namespace           string
	Type                string
	RegionID            string
	ClusterID           string
	Status              v1.JobConditionType
	StartTime           time.Time
	EndTime             time.Time
	Deleted             *int
	Pagination          *QueryPagination
	AllocatedNamespaces []string
	IsCron              bool
}

Query contains a collection of options needed for querying a list of jobs persisted in database.

type QueryPagination

type QueryPagination struct {
	PageNum  int
	PageSize int
	Count    int
}

Directories

Path Synopsis
clients
events
objects

Jump to

Keyboard shortcuts

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