internal

package
v0.0.0-...-1ba95a4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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 FileManager

type FileManager interface {
	// CreateResource creates a new resource.
	CreateResource(ctx context.Context, ident ResourceIdent) (ResourceDescriptor, error)

	// GetPersistedResource returns the descriptor of an already persisted resource.
	GetPersistedResource(ctx context.Context, ident ResourceIdent) (ResourceDescriptor, error)

	// CleanOrRecreatePersistedResource cleans or recreates the persisted resource.
	// For local filemanager, it simply removes the resource and recreates it.
	// For s3 filemanager, it either cleans files or recreates resources.
	CleanOrRecreatePersistedResource(ctx context.Context, ident ResourceIdent) (ResourceDescriptor, error)

	// RemoveTemporaryFiles cleans up all un-persisted resource files under the scope.
	RemoveTemporaryFiles(ctx context.Context, scope ResourceScope) error

	// RemoveResource removes a resource's files.
	RemoveResource(ctx context.Context, ident ResourceIdent) error

	// SetPersisted sets a resource as persisted.
	SetPersisted(ctx context.Context, ident ResourceIdent) error
}

FileManager abstracts the operations on the underlying storage.

type ResourceController

type ResourceController interface {
	// GCSingleResource remove a persisted resource.
	GCSingleResource(context.Context, *resModel.ResourceMeta) error
	// GCExecutor removes all temporary resources created by the offlined executors.
	GCExecutor(context.Context, []*resModel.ResourceMeta, model.ExecutorID) error
}

ResourceController is an interface providing relevant operations related to one resource type.

type ResourceDescriptor

type ResourceDescriptor interface {
	URI() string
	ID() resModel.ResourceID
	ResourceIdent() ResourceIdent
	ExternalStorage(ctx context.Context) (brStorage.ExternalStorage, error)
}

ResourceDescriptor is an object used internally by the broker to manage resources.

type ResourceIdent

type ResourceIdent struct {
	ResourceScope

	// Name is the custom part of the resourceID.
	// For example, the resource name of `/local/resource-1` is `resource-1`.
	Name resModel.ResourceName
}

ResourceIdent provides information for the file manager to uniquely determine where and how the resource is stored.

func (ResourceIdent) BuildResPath

func (i ResourceIdent) BuildResPath() string

BuildResPath builds a resource path from the given ident.

func (ResourceIdent) Scope

func (i ResourceIdent) Scope() ResourceScope

Scope returns the Scope of the ResourceIdent.

type ResourceScope

type ResourceScope struct {
	tenant.ProjectInfo

	// Executor denotes the executor on which the resource is created.
	Executor model.ExecutorID

	// WorkerID denotes the worker that is creating or has created the resource.
	// Note that it is NOT necessarily that consumes or depends on the resource.
	WorkerID frameModel.WorkerID
}

ResourceScope represents the environment in which the resource has been or is to be created.

func (ResourceScope) BuildResPath

func (s ResourceScope) BuildResPath() string

BuildResPath builds a resource path from the given scope.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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