Documentation ¶
Index ¶
- func AssertLocalFileExists(t *testing.T, baseDir string, creator frameModel.WorkerID, ...)
- func AssertNoLocalFileExists(t *testing.T, baseDir string, creator frameModel.WorkerID, ...)
- func NewFileResourceController(clientGroup client.ExecutorGroup) *resourceController
- func PreCheckConfig(config resModel.LocalFileConfig) error
- func ResourceNameToFilePathName(resName resModel.ResourceName) string
- type FileManager
- func (m *FileManager) CleanOrRecreatePersistedResource(ctx context.Context, ident internal.ResourceIdent) (internal.ResourceDescriptor, error)
- func (m *FileManager) CreateResource(ctx context.Context, ident internal.ResourceIdent) (internal.ResourceDescriptor, error)
- func (m *FileManager) GetPersistedResource(ctx context.Context, ident internal.ResourceIdent) (internal.ResourceDescriptor, error)
- func (m *FileManager) RemoveResource(ctx context.Context, ident internal.ResourceIdent) error
- func (m *FileManager) RemoveTemporaryFiles(ctx context.Context, scope internal.ResourceScope) error
- func (m *FileManager) SetPersisted(ctx context.Context, ident internal.ResourceIdent) error
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.