fs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSEntry

type FSEntry struct {
	ID         int64
	Type       FSEntryType
	Name       string
	Path       string
	Owner      string
	Size       int64
	CreateTime time.Time
	ModifyTime time.Time
	CheckSum   string
	//
	Internal interface{} // IRODSDataObject or IRODSCollection
}

FSEntry ...

func (*FSEntry) ToString

func (entry *FSEntry) ToString() string

ToString stringifies the object

type FSEntryType

type FSEntryType string
const (
	FSFileEntry      FSEntryType = "file"
	FSDirectoryEntry FSEntryType = "directory"
)

type FileHandle

type FileHandle struct {
	FileSystem  *FileSystem
	Connection  *connection.IRODSConnection
	IRODSHandle *types.IRODSFileHandle
	Entry       *FSEntry
	Offset      int64
	OpenMode    types.FileOpenMode
}

FileHandle ...

func (*FileHandle) Close

func (handle *FileHandle) Close() error

Close closes the file

func (*FileHandle) GetOffset

func (handle *FileHandle) GetOffset() int64

GetOffset returns current offset

func (*FileHandle) IsReadMode

func (handle *FileHandle) IsReadMode() bool

IsReadMode returns true if file is opened with read mode

func (*FileHandle) IsWriteMode

func (handle *FileHandle) IsWriteMode() bool

IsWriteMode returns true if file is opened with write mode

func (*FileHandle) Read

func (handle *FileHandle) Read(length int) ([]byte, error)

Read reads the file

func (*FileHandle) Seek

func (handle *FileHandle) Seek(offset int64, whence types.Whence) (int64, error)

Seek moves file pointer

func (*FileHandle) ToString

func (handle *FileHandle) ToString() string

ToString stringifies the object

func (*FileHandle) Write

func (handle *FileHandle) Write(data []byte) error

Write writes the file

type FileSystem

type FileSystem struct {
	Account *types.IRODSAccount
	Config  *FileSystemConfig
	Session *session.IRODSSession
	Cache   *FileSystemCache
}

FileSystem provides a file-system like interface

func NewFileSystem

func NewFileSystem(account *types.IRODSAccount, config *FileSystemConfig) *FileSystem

NewFileSystem creates a new FileSystem

func NewFileSystemWithDefault

func NewFileSystemWithDefault(account *types.IRODSAccount, applicationName string) *FileSystem

NewFileSystemWithDefault ...

func (*FileSystem) ClearCache

func (fs *FileSystem) ClearCache()

ClearCache ...

func (*FileSystem) CopyFile

func (fs *FileSystem) CopyFile(srcPath string, destPath string) error

CopyFile copies a file

func (*FileSystem) CopyFileToFile

func (fs *FileSystem) CopyFileToFile(srcPath string, destPath string) error

CopyFileToFile copies a file

func (*FileSystem) CreateFile

func (fs *FileSystem) CreateFile(path string, resource string) (*FileHandle, error)

CreateFile opens a new file for write

func (*FileSystem) DownloadFile

func (fs *FileSystem) DownloadFile(irodsPath string, localPath string) error

DownloadFile downloads a file to local

func (*FileSystem) Exists

func (fs *FileSystem) Exists(path string) bool

Exists checks file/directory existance

func (*FileSystem) ExistsDir

func (fs *FileSystem) ExistsDir(path string) bool

ExistsDir checks directory existance

func (*FileSystem) ExistsFile

func (fs *FileSystem) ExistsFile(path string) bool

ExistsFile checks file existance

func (*FileSystem) InvalidateCache

func (fs *FileSystem) InvalidateCache(path string)

InvalidateCache invalidates cache with the given path

func (*FileSystem) List

func (fs *FileSystem) List(path string) ([]*FSEntry, error)

List lists all file system entries under the given path

func (*FileSystem) MakeDir

func (fs *FileSystem) MakeDir(path string, recurse bool) error

MakeDir creates a directory

func (*FileSystem) OpenFile

func (fs *FileSystem) OpenFile(path string, resource string, mode string) (*FileHandle, error)

OpenFile opens an existing file for read/write

func (*FileSystem) Release

func (fs *FileSystem) Release()

Release ...

func (*FileSystem) RemoveDir

func (fs *FileSystem) RemoveDir(path string, recurse bool, force bool) error

RemoveDir deletes a directory

func (*FileSystem) RemoveFile

func (fs *FileSystem) RemoveFile(path string, force bool) error

RemoveFile deletes a file

func (*FileSystem) RenameDir

func (fs *FileSystem) RenameDir(srcPath string, destPath string) error

RenameDir renames a dir

func (*FileSystem) RenameDirToDir

func (fs *FileSystem) RenameDirToDir(srcPath string, destPath string) error

RenameDirToDir renames a dir

func (*FileSystem) RenameFile

func (fs *FileSystem) RenameFile(srcPath string, destPath string) error

RenameFile renames a file

func (*FileSystem) RenameFileToFile

func (fs *FileSystem) RenameFileToFile(srcPath string, destPath string) error

RenameFileToFile renames a file

func (*FileSystem) ReplicateFile

func (fs *FileSystem) ReplicateFile(path string, resource string, update bool) error

ReplicateFile replicates a file

func (*FileSystem) Stat

func (fs *FileSystem) Stat(path string) (*FSEntry, error)

Stat returns file status

func (*FileSystem) StatDir

func (fs *FileSystem) StatDir(path string) (*FSEntry, error)

StatDir returns status of a directory

func (*FileSystem) StatFile

func (fs *FileSystem) StatFile(path string) (*FSEntry, error)

StatFile returns status of a file

func (*FileSystem) TruncateFile

func (fs *FileSystem) TruncateFile(path string, size int64) error

TruncateFile truncates a file

func (*FileSystem) UploadFile

func (fs *FileSystem) UploadFile(localPath string, irodsPath string, resource string, replicate bool) error

UploadFile uploads a local file to irods

type FileSystemCache

type FileSystemCache struct {
	CacheTimeout   time.Duration
	CleanupTimeout time.Duration
	EntryCache     *gocache.Cache
	DirCache       *gocache.Cache
}

FileSystemCache ...

func NewFileSystemCache

func NewFileSystemCache(cacheTimeout time.Duration, cleanup time.Duration) *FileSystemCache

NewFileSystemCache creates a new FileSystemCache

func (*FileSystemCache) AddDirCache

func (cache *FileSystemCache) AddDirCache(path string, entries []string)

AddDirCache ...

func (*FileSystemCache) AddEntryCache

func (cache *FileSystemCache) AddEntryCache(entry *FSEntry)

AddEntryCache ...

func (*FileSystemCache) ClearDirCache

func (cache *FileSystemCache) ClearDirCache()

ClearDirCache ...

func (*FileSystemCache) ClearEntryCache

func (cache *FileSystemCache) ClearEntryCache()

ClearEntryCache ...

func (*FileSystemCache) GetDirCache

func (cache *FileSystemCache) GetDirCache(path string) []string

GetDirCache ...

func (*FileSystemCache) GetEntryCache

func (cache *FileSystemCache) GetEntryCache(path string) *FSEntry

GetEntryCache ...

func (*FileSystemCache) RemoveDirCache

func (cache *FileSystemCache) RemoveDirCache(path string)

RemoveDirCache ...

func (*FileSystemCache) RemoveEntryCache

func (cache *FileSystemCache) RemoveEntryCache(path string)

RemoveEntryCache ...

type FileSystemConfig

type FileSystemConfig struct {
	ApplicationName       string
	OperationTimeout      time.Duration
	ConnectionIdleTimeout time.Duration
	ConnectionMax         int
	CacheTimeout          time.Duration
	CacheCleanupTime      time.Duration
}

FileSystemConfig ...

func NewFileSystemConfig

func NewFileSystemConfig(applicationName string, operationTimeout time.Duration, connectionIdleTimeout time.Duration, connectionMax int, cacheTimeout time.Duration, cacheCleanupTime time.Duration) *FileSystemConfig

NewFileSystemConfig create a FileSystemConfig

func NewFileSystemConfigWithDefault

func NewFileSystemConfigWithDefault(applicationName string) *FileSystemConfig

NewFileSystemConfigWithDefault create a FileSystemConfig with a default settings

Jump to

Keyboard shortcuts

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