package remotefs

import "github.com/Microsoft/opengcs/service/gcsutils/remotefs"

Index

Constants

const (
	StatCmd           = "stat"
	LstatCmd          = "lstat"
	ReadlinkCmd       = "readlink"
	MkdirCmd          = "mkdir"
	MkdirAllCmd       = "mkdirall"
	RemoveCmd         = "remove"
	RemoveAllCmd      = "removeall"
	LinkCmd           = "link"
	SymlinkCmd        = "symlink"
	LchmodCmd         = "lchmod"
	LchownCmd         = "lchown"
	MknodCmd          = "mknod"
	MkfifoCmd         = "mkfifo"
	OpenFileCmd       = "openfile"
	ReadFileCmd       = "readfile"
	WriteFileCmd      = "writefile"
	ReadDirCmd        = "readdir"
	ResolvePathCmd    = "resolvepath"
	ExtractArchiveCmd = "extractarchive"
	ArchivePathCmd    = "archivepath"
)

Name of the commands when called from the cli context (remotefs <CMD> ...)

const (
	// Read request command.
	Read uint32 = iota
	// Write request command.
	Write
	// Seek request command.
	Seek
	// Close request command.
	Close
	// CmdOK is a response meaning request succeeded.
	CmdOK
	// CmdFailed is a response meaning request failed.
	CmdFailed
)
const RemotefsCmd = "remotefs"

RemotefsCmd is the name of the remotefs meta command

Variables

var ErrInvalid = errors.New("invalid arguments")

ErrInvalid is returned if the parameters are invalid

var ErrUnknown = errors.New("unkown command")

ErrUnknown is returned for an unknown remotefs command

Functions

func ExportedToError

func ExportedToError(ee *ExportedError) error

ExportedToError will convert a ExportedError to an error. It will try to match the error to any existing known error like os.ErrNotExist. Otherwise, it will just return an implementation of the error interface.

func ReadTarOptions

func ReadTarOptions(r io.Reader) (*archive.TarOptions, error)

ReadTarOptions reads from the specified reader and deserializes an archive.TarOptions struct.

func WriteError

func WriteError(err error, out io.Writer) error

WriteError is an utility function that serializes the error and writes it to the output writer.

func WriteFileHeader

func WriteFileHeader(w io.Writer, hdr *FileHeader, extraData []byte) error

WriteFileHeader serializes a FileHeader and writes it to w, along with any extra data

func WriteTarOptions

func WriteTarOptions(w io.Writer, opts *archive.TarOptions) error

WriteTarOptions serializes a archive.TarOptions struct and writes it to the writer.

Types

type ExportedError

type ExportedError struct {
	ErrString string
	ErrNum    int `json:",omitempty"`
}

ExportedError is the serialized version of the a Go error. It also provides a trivial implementation of the error interface.

func ReadError

func ReadError(in io.Reader) (*ExportedError, error)

ReadError is an utility function that reads a serialized error from the given reader and deserializes it.

func (*ExportedError) Error

func (ee *ExportedError) Error() string

Error returns an error string

type FileHeader

type FileHeader struct {
	Cmd  uint32
	Size uint64
}

FileHeader is a header for remote *os.File operations for remotefs.OpenFile

func ReadFileHeader

func ReadFileHeader(r io.Reader) (*FileHeader, error)

ReadFileHeader reads from r and returns a deserialized FileHeader

type FileInfo

type FileInfo struct {
	NameVar    string
	SizeVar    int64
	ModeVar    os.FileMode
	ModTimeVar int64 // Serialization of time.Time breaks in travis, so use an int
	IsDirVar   bool
}

FileInfo is the stat struct returned by the remotefs system. It fulfills the os.FileInfo interface.

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

IsDir returns the is-directory indicator from a FileInfo structure

func (*FileInfo) ModTime

func (f *FileInfo) ModTime() time.Time

ModTime returns the modification time from a FileInfo structure

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

Mode returns the mode from a FileInfo structure

func (*FileInfo) Name

func (f *FileInfo) Name() string

Name returns the filename from a FileInfo structure

func (*FileInfo) Size

func (f *FileInfo) Size() int64

Size returns the size from a FileInfo structure

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

Sys provides an interface to a FileInfo structure

type SeekHeader

type SeekHeader struct {
	Offset int64
	Whence int32
}

SeekHeader is header for the Seek operation for remotefs.OpenFile

Source Files

defs.go utils.go

Version
v0.3.7
Published
Apr 11, 2018
Platform
windows/amd64
Imports
10 packages
Last checked
22 minutes ago

Tools for package owners.