Documentation ¶
Index ¶
- Constants
- func FileStatusString(s *FileStatus, summarize bool) string
- func GetStateFlagNames() []string
- func GetStatusMask(flagNames []string) (uint64, error)
- func Import(f string, archive uint, fi os.FileInfo, layout *llapi.DataLayout) (*lustre.Fid, error)
- func IoError(msg string) error
- func RequestArchive(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error
- func RequestCancel(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error
- func RequestRelease(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error
- func RequestRemove(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error
- func RequestRestore(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error
- func SetFileStatus(filePath string, setMask, clearMask uint64, archiveID uint32) error
- type ActionHandle
- type ActionRequest
- type ActionSource
- type CoordinatorClient
- type CurrentFileAction
- func (cfa *CurrentFileAction) Action() string
- func (cfa *CurrentFileAction) Done() bool
- func (cfa *CurrentFileAction) IsArchive() bool
- func (cfa *CurrentFileAction) IsCancel() bool
- func (cfa *CurrentFileAction) IsNone() bool
- func (cfa *CurrentFileAction) IsRelease() bool
- func (cfa *CurrentFileAction) IsRemove() bool
- func (cfa *CurrentFileAction) IsRestore() bool
- func (cfa *CurrentFileAction) Running() bool
- func (cfa *CurrentFileAction) State() string
- func (cfa *CurrentFileAction) String() string
- func (cfa *CurrentFileAction) Waiting() bool
- type ErrIOError
- type FileStatus
- func (f *FileStatus) Archived() bool
- func (f *FileStatus) Dirty() bool
- func (f *FileStatus) Exists() bool
- func (f *FileStatus) Flags() []string
- func (f *FileStatus) Lost() bool
- func (f *FileStatus) NoArchive() bool
- func (f *FileStatus) NoRelease() bool
- func (f *FileStatus) Released() bool
- func (f *FileStatus) String() string
- type SignalChan
- type TestProgressUpdate
- type TestRequest
- func (r *TestRequest) Action() llapi.HsmAction
- func (r *TestRequest) ArchiveID() uint
- func (r *TestRequest) Begin(flags int, isError bool) (ActionHandle, error)
- func (r *TestRequest) Cookie() uint64
- func (r *TestRequest) Data() []byte
- func (r *TestRequest) DataFid() (*lustre.Fid, error)
- func (r *TestRequest) End(offset, length int64, flags int, errval int) error
- func (r *TestRequest) FailImmediately(errval int)
- func (r *TestRequest) Fd() (int, error)
- func (r *TestRequest) Fid() *lustre.Fid
- func (r *TestRequest) Length() int64
- func (r *TestRequest) Offset() int64
- func (r *TestRequest) Progress(offset, length, total int64, flags int) error
- func (r *TestRequest) ProgressUpdates() chan *TestProgressUpdate
- func (r *TestRequest) String() string
- type TestSource
Constants ¶
const ( NONE = llapi.HsmActionNone ARCHIVE = llapi.HsmActionArchive RESTORE = llapi.HsmActionRestore REMOVE = llapi.HsmActionRemove CANCEL = llapi.HsmActionCancel )
Expose the internal constants for external users
Variables ¶
This section is empty.
Functions ¶
func FileStatusString ¶
func FileStatusString(s *FileStatus, summarize bool) string
FileStatusString returns a string describing the given FileStatus
func GetStateFlagNames ¶
func GetStateFlagNames() []string
GetStateFlagNames returns a slice of HSM state flag names
func GetStatusMask ¶
GetStatusMask converts a slice of flag strings to a bitmask
func RequestArchive ¶
RequestArchive submits a request to the coordinator for the specified list of fids to be archived to the specfied archive id.
func RequestCancel ¶
RequestCancel submits a request to the coordinator to cancel any outstanding requests involving the specified list of fids.
func RequestRelease ¶
RequestRelease submits a request to the coordinator for the specified list of fids to be released.
func RequestRemove ¶
RequestRemove submits a request to the coordinator for the specified list of fids to be removed from the HSM backend.
func RequestRestore ¶
RequestRestore submits a request to the coordinator for the specified list of fids to be restored from the specfied archive id.
Types ¶
type ActionHandle ¶
type ActionHandle interface { Progress(offset, length, totalLength int64, flags int) error End(offset, length int64, flags int, errval int) error Action() llapi.HsmAction Fid() *lustre.Fid Cookie() uint64 DataFid() (*lustre.Fid, error) Fd() (int, error) Offset() int64 ArchiveID() uint Length() int64 String() string Data() []byte }
ActionHandle is an HSM action that is currently being processed
type ActionRequest ¶
type ActionRequest interface { Begin(openFlags int, isError bool) (ActionHandle, error) FailImmediately(errval int) ArchiveID() uint String() string Action() llapi.HsmAction }
ActionRequest is an HSM action
type ActionSource ¶
type ActionSource interface { // Actions is a channel for HSM actions. Mutiple listeners can use this // channel. // The channel will be closed when the ActionSource is shutdown. Actions() <-chan ActionRequest // Start signals the action source to begin sending actions Start(context.Context) error }
ActionSource is a source of HSM actions
func NewActionSource ¶
func NewActionSource(root fs.RootDir) ActionSource
NewActionSource initializes an ActionSource for the filesystem in root.
type CoordinatorClient ¶
type CoordinatorClient struct {
// contains filtered or unexported fields
}
CoordinatorClient receives HSM actions to execute.
func NewCoordinatorClient ¶
func NewCoordinatorClient(path fs.RootDir, nonBlocking bool) (*CoordinatorClient, error)
NewCoordinatorClient opens a connection to the coordinator.
func (*CoordinatorClient) Close ¶
func (cdc *CoordinatorClient) Close()
Close terminates connection with coordinator.
func (*CoordinatorClient) GetFd ¶
func (cdc *CoordinatorClient) GetFd() int
GetFd returns copytool file descriptor
type CurrentFileAction ¶
type CurrentFileAction struct { Path string BytesCopied int64 // contains filtered or unexported fields }
CurrentFileAction represents the current HSM action being performed for a file, if any.
func GetFileAction ¶
func GetFileAction(filePath string) (*CurrentFileAction, error)
GetFileAction returns the current HSM action for the given path, if any
func (*CurrentFileAction) Action ¶
func (cfa *CurrentFileAction) Action() string
Action returns a string representation of the current action
func (*CurrentFileAction) Done ¶
func (cfa *CurrentFileAction) Done() bool
Done indicates that the action is done
func (*CurrentFileAction) IsArchive ¶
func (cfa *CurrentFileAction) IsArchive() bool
IsArchive indicates whether or not the action is Archive
func (*CurrentFileAction) IsCancel ¶
func (cfa *CurrentFileAction) IsCancel() bool
IsCancel indicates whether or not the action is Cancel
func (*CurrentFileAction) IsNone ¶
func (cfa *CurrentFileAction) IsNone() bool
IsNone indicates whether or not the action is None
func (*CurrentFileAction) IsRelease ¶
func (cfa *CurrentFileAction) IsRelease() bool
IsRelease indicates whether or not the action is Release
func (*CurrentFileAction) IsRemove ¶
func (cfa *CurrentFileAction) IsRemove() bool
IsRemove indicates whether or not the action is Remove
func (*CurrentFileAction) IsRestore ¶
func (cfa *CurrentFileAction) IsRestore() bool
IsRestore indicates whether or not the action is Restore
func (*CurrentFileAction) Running ¶
func (cfa *CurrentFileAction) Running() bool
Running indicates that the action is running
func (*CurrentFileAction) State ¶
func (cfa *CurrentFileAction) State() string
State returns a string representation of the current action's state
func (*CurrentFileAction) String ¶
func (cfa *CurrentFileAction) String() string
func (*CurrentFileAction) Waiting ¶
func (cfa *CurrentFileAction) Waiting() bool
Waiting indicates that the action is waiting to run
type ErrIOError ¶
type ErrIOError struct {
// contains filtered or unexported fields
}
ErrIOError are errors that returned by the HSM library.
func (ErrIOError) Error ¶
func (e ErrIOError) Error() string
type FileStatus ¶
type FileStatus struct { ArchiveID uint32 // contains filtered or unexported fields }
FileStatus describes a file's current HSM status, including its associated archive ID (if any), and HSM state
func GetFileStatus ¶
func GetFileStatus(filePath string) (*FileStatus, error)
GetFileStatus returns a *FileStatus for the given path
func (*FileStatus) Archived ¶
func (f *FileStatus) Archived() bool
Archived is true if a complete (but possibly stale) copy of the file contents are stored in the archive.
func (*FileStatus) Dirty ¶
func (f *FileStatus) Dirty() bool
Dirty means the file has been modified since the last time it was archived.
func (*FileStatus) Exists ¶
func (f *FileStatus) Exists() bool
Exists is true if an HSM archive action has been initiated for a file. A copy or partial copy of the file may exist in the backend. Or it might not.
func (*FileStatus) Flags ¶
func (f *FileStatus) Flags() []string
Flags returns a slice of HSM state flag strings
func (*FileStatus) Lost ¶
func (f *FileStatus) Lost() bool
Lost means the copy of the file in the archive is not accessible.
func (*FileStatus) NoArchive ¶
func (f *FileStatus) NoArchive() bool
NoArchive inhibits archiving the file. (Useful for temporary files perhaps.)
func (*FileStatus) NoRelease ¶
func (f *FileStatus) NoRelease() bool
NoRelease prevents the file data from being relesed, even if it is Archived.
func (*FileStatus) Released ¶
func (f *FileStatus) Released() bool
Released is true if the contents of the file have been removed from the filesystem. Only possible if the file has been Archived.
func (*FileStatus) String ¶
func (f *FileStatus) String() string
type SignalChan ¶
type SignalChan chan struct{}
SignalChan is a channel that waiters can block on while waiting for certain events to occur.
type TestProgressUpdate ¶
type TestProgressUpdate struct { Cookie uint64 Offset int64 Length int64 Total int64 Flags int Errval int Complete bool }
TestProgressUpdate contains information about progress updates received by the test handle.
func (*TestProgressUpdate) String ¶
func (p *TestProgressUpdate) String() string
type TestRequest ¶
type TestRequest struct {
// contains filtered or unexported fields
}
TestRequest implements hsm.ActionRequest with additional methods for controlling/inpecting request state.
func NewTestRequest ¶
func NewTestRequest(archive uint, action llapi.HsmAction, fid *lustre.Fid, data []byte) *TestRequest
NewTestRequest returns a new *TestRequest
func (*TestRequest) Action ¶
func (r *TestRequest) Action() llapi.HsmAction
Action returns the HSM action type
func (*TestRequest) ArchiveID ¶
func (r *TestRequest) ArchiveID() uint
ArchiveID returns the backend archive number
func (*TestRequest) Begin ¶
func (r *TestRequest) Begin(flags int, isError bool) (ActionHandle, error)
Begin returns a new test handle
func (*TestRequest) Cookie ¶
func (r *TestRequest) Cookie() uint64
Cookie returns intneral request identifier
func (*TestRequest) Data ¶
func (r *TestRequest) Data() []byte
Data is extra data that may have been provided through the HSM_REQUEST API.
func (*TestRequest) DataFid ¶
func (r *TestRequest) DataFid() (*lustre.Fid, error)
DataFid is the FID of the file used to restore data.
func (*TestRequest) End ¶
func (r *TestRequest) End(offset, length int64, flags int, errval int) error
End completes an HSM actions with success or failure status.
func (*TestRequest) FailImmediately ¶
func (r *TestRequest) FailImmediately(errval int)
FailImmediately immediately fails the request
func (*TestRequest) Fd ¶
func (r *TestRequest) Fd() (int, error)
Fd is the file descriptor for restore file.
func (*TestRequest) Fid ¶
func (r *TestRequest) Fid() *lustre.Fid
Fid returns the FID of the test file
func (*TestRequest) Length ¶
func (r *TestRequest) Length() int64
Length is lenght of data transfer that begins at Offset.
func (*TestRequest) Offset ¶
func (r *TestRequest) Offset() int64
Offset is the starting offset for a data transfer.
func (*TestRequest) Progress ¶
func (r *TestRequest) Progress(offset, length, total int64, flags int) error
Progress updates current state of data transfer request.
func (*TestRequest) ProgressUpdates ¶
func (r *TestRequest) ProgressUpdates() chan *TestProgressUpdate
ProgressUpdates returns a channel through which progress updates may be received.
func (*TestRequest) String ¶
func (r *TestRequest) String() string
type TestSource ¶
type TestSource struct {
// contains filtered or unexported fields
}
TestSource implements hsm.ActionSource, but provides a Lustre-independent way of generating hsm requests.
func NewTestSource ¶
func NewTestSource() *TestSource
NewTestSource returns an ActionSource implementation suitable for testing
func (*TestSource) Actions ¶
func (s *TestSource) Actions() <-chan ActionRequest
Actions returns a channel for callers to receive ActionRequests
func (*TestSource) GenerateRandomAction ¶
func (s *TestSource) GenerateRandomAction()
GenerateRandomAction generates a random action request
func (*TestSource) Inject ¶
func (s *TestSource) Inject(ar ActionRequest)
Inject allows test code to inject arbitrary ActionRequests.