file

package
v0.0.0-...-fd2add7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package file provides ways to pass open files to across circuit runtimes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileClient

type FileClient struct {
	circuit.X
}

FileClient is a convenience wrapper for using a cross-interface, refering to a FileServer remote object.

func NewFileClient

func NewFileClient(x circuit.X) *FileClient

NewFileClient consumes a cross-interface, backed by a FileServer on a remote worker, and returns a local proxy object with convinient access methods

func (*FileClient) Close

func (fcli *FileClient) Close() (err error)

Close closes this file.

func (*FileClient) Read

func (fcli *FileClient) Read(p []byte) (_ int, err error)

Read reads a slice of bytes from this file.

func (*FileClient) Readdir

func (fcli *FileClient) Readdir(count int) (_ []os.FileInfo, err error)

Readdir returns a directory listing of this file, if it is a directory.

func (*FileClient) Seek

func (fcli *FileClient) Seek(offset int64, whence int) (_ int64, err error)

Seek seeks the cursor of this file.

func (*FileClient) Stat

func (fcli *FileClient) Stat() (_ os.FileInfo, err error)

Stat returns meta-information about this file.

func (*FileClient) Sync

func (fcli *FileClient) Sync() (err error)

Sync flushes any unflushed write buffers.

func (*FileClient) Truncate

func (fcli *FileClient) Truncate(size int64) (err error)

Truncate truncates this file.

func (*FileClient) Write

func (fcli *FileClient) Write(p []byte) (_ int, err error)

Write writes a slice of bytes to this file.

type FileInfo

type FileInfo struct {
	SaveName    string
	SaveSize    int64
	SaveMode    os.FileMode
	SaveModTime time.Time
	SaveIsDir   bool
	SaveSys     interface{}
}

FileInfo holds meta-information about a file.

func NewFileInfoOS

func NewFileInfoOS(fi os.FileInfo) *FileInfo

NewFileInfoOS creates a new FileInfo structure from an os.FileInfo one.

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

IsDir returns true if the file is a directory.

func (*FileInfo) ModTime

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

ModTime returns the time the file was last modified.

func (*FileInfo) Mode

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

Mode retusn the mode of the file.

func (*FileInfo) Name

func (fi *FileInfo) Name() string

Name returns the name of the file.

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

Size returns the size of the file.

func (*FileInfo) Sys

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

Sys returns any auxiliary file-related data.

type FileServer

type FileServer struct {
	// contains filtered or unexported fields
}

FileServer is an cross-worker exportable interface to a locally-open file.

func NewFileServer

func NewFileServer(f *os.File) *FileServer

NewFileServer returns a file object which can be passed across runtimes. It makes sure to close the file if the no more references to the object remain in the circtui.

func (*FileServer) Close

func (fsrv *FileServer) Close() error

Close closes this file.

func (*FileServer) Read

func (fsrv *FileServer) Read(n int) ([]byte, error)

Read reads a slice of bytes from this file.

func (*FileServer) Readdir

func (fsrv *FileServer) Readdir(count int) ([]os.FileInfo, error)

Readdir lists the contents of this file, if it is a directory.

func (*FileServer) Seek

func (fsrv *FileServer) Seek(offset int64, whence int) (int64, error)

Seek changes the position of the cursor in this file.

func (*FileServer) Stat

func (fsrv *FileServer) Stat() (os.FileInfo, error)

Stat returns meta-information about this file.

func (*FileServer) Sync

func (fsrv *FileServer) Sync() error

Sync flushes any unflushed write buffers.

func (*FileServer) Truncate

func (fsrv *FileServer) Truncate(size int64) error

Truncate truncates this file.

func (*FileServer) Write

func (fsrv *FileServer) Write(p []byte) (int, error)

Write writes a slice of bytes to this file.

Jump to

Keyboard shortcuts

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