local

package
v0.0.0-...-be15534 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertLocalFileExists

func AssertLocalFileExists(
	t *testing.T,
	baseDir string,
	creator frameModel.WorkerID,
	resName resModel.ResourceName,
	suffixes ...string,
)

AssertLocalFileExists is a test helper.

func AssertNoLocalFileExists

func AssertNoLocalFileExists(
	t *testing.T,
	baseDir string,
	creator frameModel.WorkerID,
	resName resModel.ResourceName,
	suffixes ...string,
)

AssertNoLocalFileExists is a test helper.

func NewFileResourceController

func NewFileResourceController(clientGroup client.ExecutorGroup) *resourceController

NewFileResourceController creates a new LocalFileResourceController.

func PreCheckConfig

func PreCheckConfig(config resModel.LocalFileConfig) error

PreCheckConfig does a preflight check on the executor's storage configurations.

func ResourceNameToFilePathName

func ResourceNameToFilePathName(resName resModel.ResourceName) string

ResourceNameToFilePathName converts a resource name to a file path name.

Types

type FileManager

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

FileManager manages the local files resources stored in the local file system.

func NewLocalFileManager

func NewLocalFileManager(executorID model.ExecutorID, config resModel.LocalFileConfig) *FileManager

NewLocalFileManager returns a new NewLocalFileManager. Note that the lifetime of the returned object should span the whole lifetime of the executor.

func (*FileManager) CleanOrRecreatePersistedResource

func (m *FileManager) CleanOrRecreatePersistedResource(
	ctx context.Context, ident internal.ResourceIdent,
) (internal.ResourceDescriptor, error)

CleanOrRecreatePersistedResource cleans the local directory of the given resource.

func (*FileManager) CreateResource

func (m *FileManager) CreateResource(
	ctx context.Context, ident internal.ResourceIdent,
) (internal.ResourceDescriptor, error)

CreateResource makes a local directory for the given resource name, and returns a LocalFileResourceDescriptor. The resource is NOT marked as persisted by this method. Only use it when we are sure it is a NEW resource.

func (*FileManager) GetPersistedResource

func (m *FileManager) GetPersistedResource(
	ctx context.Context, ident internal.ResourceIdent,
) (internal.ResourceDescriptor, error)

GetPersistedResource checks the given resource exists in the local file system and returns a LocalFileResourceDescriptor.

func (*FileManager) RemoveResource

func (m *FileManager) RemoveResource(
	ctx context.Context, ident internal.ResourceIdent,
) error

RemoveResource removes a single resource from the local file system. NOTE the caller should handle ErrResourceDoesNotExist appropriately.

func (*FileManager) RemoveTemporaryFiles

func (m *FileManager) RemoveTemporaryFiles(
	ctx context.Context, scope internal.ResourceScope,
) error

RemoveTemporaryFiles cleans up all temporary files (i.e., unpersisted file resources), created by `creator`.

func (*FileManager) SetPersisted

func (m *FileManager) SetPersisted(
	ctx context.Context, ident internal.ResourceIdent,
) error

SetPersisted marks a file resource as persisted. NOTE it is only marked as persisted in memory, because we assume that if the executor process crashes, the file resources are lost.

Jump to

Keyboard shortcuts

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