Documentation
¶
Index ¶
- Constants
- Variables
- type LtoNoRewindTapeDrive
- func (device *LtoNoRewindTapeDrive) BSF(count uint32, timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) BSFCtx(ctx context.Context, count uint32) error
- func (device *LtoNoRewindTapeDrive) BSFM(count uint32, timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) BSFMCtx(ctx context.Context, count uint32) error
- func (device *LtoNoRewindTapeDrive) ChkDevice() error
- func (device *LtoNoRewindTapeDrive) CountFiles(timeout time.Duration) (uint64, error)
- func (device *LtoNoRewindTapeDrive) Eject(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) EjectCtx(ctx context.Context) error
- func (device *LtoNoRewindTapeDrive) Erase(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) EraseCtx(ctx context.Context) error
- func (device *LtoNoRewindTapeDrive) ExecMtCmd(timeout time.Duration, cmd string, args ...uint32) ([]byte, error)
- func (device *LtoNoRewindTapeDrive) ExecMtCmdCtx(ctx context.Context, cmd string, args ...uint32) ([]byte, error)
- func (device *LtoNoRewindTapeDrive) ExecSgReadAttr(id string) (string, error)
- func (device *LtoNoRewindTapeDrive) FSF(count uint32, timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) FSFCtx(ctx context.Context, count uint32) error
- func (device *LtoNoRewindTapeDrive) GetCapacityLog() (LtoTapeCapacityLog, error)
- func (device *LtoNoRewindTapeDrive) GetCurFileNumber() (uint64, error)
- func (device *LtoNoRewindTapeDrive) GetMediumSN() (string, error)
- func (device *LtoNoRewindTapeDrive) HasDataCartridge() (bool, error)
- func (device *LtoNoRewindTapeDrive) NextFile(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) NextFileCtx(ctx context.Context) error
- func (device *LtoNoRewindTapeDrive) PrevFile(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) PrevFileCtx(ctx context.Context) error
- func (device *LtoNoRewindTapeDrive) Rewind(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) RewindCtx(ctx context.Context) error
- func (device *LtoNoRewindTapeDrive) TryReadAttr() error
- func (device *LtoNoRewindTapeDrive) WEOF(timeout time.Duration) error
- func (device *LtoNoRewindTapeDrive) WEOFCtx(ctx context.Context) error
- type LtoTapeCapacityLog
Constants ¶
View Source
const ReadAttrMediumTypeDataCartridge uint8 = 0
In MAM attribute data, 0 means data cartridge, 1 means cleaning cartridge.
View Source
const UnknownCapacity int64 = -1
A magic number as "Capacity Unknown".
View Source
const UtilsDiscoverTimeout time.Duration = 1 * time.Second
Variables ¶
View Source
var EnableLtoUtilsWrapperDebugMode bool = false
Debug Mode will show output of tape utils.
View Source
var ErrAttrParseFailed error = errors.New("failed to parse output of sg_read_attr")
View Source
var ErrCanNotGetMediumSN error = errors.New("can not get medium serial number")
View Source
var ErrCanNotGoToPrevFile error = errors.New("can not go to previous file")
View Source
var ErrCanNotParseAlternatePartitionMax error = errors.New("can not parse alternate partition maximum capacity")
View Source
var ErrCanNotParseAlternatePartitionRemaining error = errors.New("can not parse alternate partition remaining capacity")
View Source
var ErrCanNotParseMainPartitionMax error = errors.New("can not parse main partition maximum capacity")
View Source
var ErrCanNotParseMainPartitionRemaining error = errors.New("can not parse main partition remaining capacity")
View Source
var ErrCanNotParseSgReadAttrOutput error = errors.New("can not parse output of sg_read_attr")
View Source
var ErrCanNotRewind error = errors.New("can not rewind the tape")
View Source
var ErrCanNotStatTheDevice error = errors.New("can not stat specified device file")
View Source
var ErrDeviceCheckFailed error = errors.New("device check failed")
View Source
var ErrMtExecFailed error = errors.New("failed to get mt cmd output")
View Source
var ErrMtOutputParseFailed error = errors.New("can not parse output of mt")
View Source
var ErrNoDataCartridgeOrNotReady error = errors.New("no data cartridge or not ready yet")
View Source
var ErrNoMtDiscovered error = errors.New("can not find mt")
View Source
var ErrNoRewindRequired error = errors.New("a no rewind tape device is required")
View Source
var ErrNoSgLogsDiscovered error = errors.New("can not find sg_logs")
View Source
var ErrNoSgReadAttrDiscovered error = errors.New("can not find sg_read_attr")
View Source
var ErrSgLogsExecFailed error = errors.New("failed to get sg_logs cmd output")
View Source
var ErrSgReadAttrExecFailed error = errors.New("failed to get sg_read_attr cmd output")
View Source
var ErrSomeCapacityLogFieldsMissing error = errors.New("some capacity log fields missing")
View Source
var ErrSomeMtRelatedFieldsMissing error = errors.New("some mt related fields missing")
View Source
var ErrSomeSgRelatedFieldsMissing error = errors.New("some sg_* related fields missing")
View Source
var ErrUnsupportedPlatform error = errors.New("this os is not supported")
Functions ¶
This section is empty.
Types ¶
type LtoNoRewindTapeDrive ¶
func NewLtoNoRewindTapeDrive ¶
func NewLtoNoRewindTapeDrive(device string) (LtoNoRewindTapeDrive, error)
It will detect related utils automatically, if some detection failed, you might need to set the utils binary manually.
func (*LtoNoRewindTapeDrive) BSF ¶
func (device *LtoNoRewindTapeDrive) BSF(count uint32, timeout time.Duration) error
func (*LtoNoRewindTapeDrive) BSFCtx ¶
func (device *LtoNoRewindTapeDrive) BSFCtx(ctx context.Context, count uint32) error
func (*LtoNoRewindTapeDrive) BSFM ¶
func (device *LtoNoRewindTapeDrive) BSFM(count uint32, timeout time.Duration) error
func (*LtoNoRewindTapeDrive) BSFMCtx ¶
func (device *LtoNoRewindTapeDrive) BSFMCtx(ctx context.Context, count uint32) error
func (*LtoNoRewindTapeDrive) ChkDevice ¶
func (device *LtoNoRewindTapeDrive) ChkDevice() error
func (*LtoNoRewindTapeDrive) CountFiles ¶
func (device *LtoNoRewindTapeDrive) CountFiles(timeout time.Duration) (uint64, error)
This will cost a lot of time! Returned error will never be nil, it's the latest error.
After get the count, it'll rewind the tape for you.
func (*LtoNoRewindTapeDrive) Eject ¶
func (device *LtoNoRewindTapeDrive) Eject(timeout time.Duration) error
func (*LtoNoRewindTapeDrive) EjectCtx ¶
func (device *LtoNoRewindTapeDrive) EjectCtx(ctx context.Context) error
func (*LtoNoRewindTapeDrive) Erase ¶
func (device *LtoNoRewindTapeDrive) Erase(timeout time.Duration) error
func (*LtoNoRewindTapeDrive) EraseCtx ¶
func (device *LtoNoRewindTapeDrive) EraseCtx(ctx context.Context) error
func (*LtoNoRewindTapeDrive) ExecMtCmdCtx ¶
func (*LtoNoRewindTapeDrive) ExecSgReadAttr ¶
func (device *LtoNoRewindTapeDrive) ExecSgReadAttr(id string) (string, error)
Use IDs like 0x0408 or 0408h.
func (*LtoNoRewindTapeDrive) FSF ¶
func (device *LtoNoRewindTapeDrive) FSF(count uint32, timeout time.Duration) error
func (*LtoNoRewindTapeDrive) FSFCtx ¶
func (device *LtoNoRewindTapeDrive) FSFCtx(ctx context.Context, count uint32) error
func (*LtoNoRewindTapeDrive) GetCapacityLog ¶
func (device *LtoNoRewindTapeDrive) GetCapacityLog() (LtoTapeCapacityLog, error)
From the Tape Capacity log page (code is 31h).
func (*LtoNoRewindTapeDrive) GetCurFileNumber ¶
func (device *LtoNoRewindTapeDrive) GetCurFileNumber() (uint64, error)
This let you know which file you are using, NOT total files count!
func (*LtoNoRewindTapeDrive) GetMediumSN ¶
func (device *LtoNoRewindTapeDrive) GetMediumSN() (string, error)
From attribute ID 0401h.
func (*LtoNoRewindTapeDrive) HasDataCartridge ¶
func (device *LtoNoRewindTapeDrive) HasDataCartridge() (bool, error)
Related attribute ID is 0408h.
func (*LtoNoRewindTapeDrive) NextFile ¶
func (device *LtoNoRewindTapeDrive) NextFile(timeout time.Duration) error
func (*LtoNoRewindTapeDrive) NextFileCtx ¶
func (device *LtoNoRewindTapeDrive) NextFileCtx(ctx context.Context) error
func (*LtoNoRewindTapeDrive) PrevFile ¶
func (device *LtoNoRewindTapeDrive) PrevFile(timeout time.Duration) error
func (*LtoNoRewindTapeDrive) PrevFileCtx ¶
func (device *LtoNoRewindTapeDrive) PrevFileCtx(ctx context.Context) error
func (*LtoNoRewindTapeDrive) Rewind ¶
func (device *LtoNoRewindTapeDrive) Rewind(timeout time.Duration) error
func (*LtoNoRewindTapeDrive) RewindCtx ¶
func (device *LtoNoRewindTapeDrive) RewindCtx(ctx context.Context) error
func (*LtoNoRewindTapeDrive) TryReadAttr ¶
func (device *LtoNoRewindTapeDrive) TryReadAttr() error
type LtoTapeCapacityLog ¶
Click to show internal directories.
Click to hide internal directories.