hsm

package
v0.0.0-...-7bde1eb Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

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

func GetStatusMask(flagNames []string) (uint64, error)

GetStatusMask converts a slice of flag strings to a bitmask

func Import

func Import(f string, archive uint, fi os.FileInfo, layout *llapi.DataLayout) (*lustre.Fid, error)

Import file as a released file.

func IoError

func IoError(msg string) error

IoError returns a new error.

func RequestArchive

func RequestArchive(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error

RequestArchive submits a request to the coordinator for the specified list of fids to be archived to the specfied archive id.

func RequestCancel

func RequestCancel(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error

RequestCancel submits a request to the coordinator to cancel any outstanding requests involving the specified list of fids.

func RequestRelease

func RequestRelease(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error

RequestRelease submits a request to the coordinator for the specified list of fids to be released.

func RequestRemove

func RequestRemove(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error

RequestRemove submits a request to the coordinator for the specified list of fids to be removed from the HSM backend.

func RequestRestore

func RequestRestore(root fs.RootDir, archiveID uint, fids []*lustre.Fid) error

RequestRestore submits a request to the coordinator for the specified list of fids to be restored from the specfied archive id.

func SetFileStatus

func SetFileStatus(filePath string, setMask, clearMask uint64, archiveID uint32) error

SetFileStatus updates the file's HSM flags and/or 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.

func (*TestSource) Start

func (s *TestSource) Start(ctx context.Context) error

Start starts the action generator

Jump to

Keyboard shortcuts

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