irods

package
v0.0.0-...-38926f5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: BSD-3-Clause Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultMaxCacheFileSize = 10 * 1024 * 1024 * 1024 // 10GB
View Source
const FileLockEndOfFile uint64 = math.MaxUint64

FileLockEndOfFile marks a lock range that extends to the end of the file. A whole-file lock (flock) is expressed as [0, FileLockEndOfFile].

Variables

View Source
var (
	// ErrFileLockConflict is returned when a lock request conflicts with a lock held by another owner
	ErrFileLockConflict = errors.New("file lock conflict")

	// ErrFileLockManagerUnavailable is returned when a file handle has no lock manager to serve locks
	ErrFileLockManagerUnavailable = errors.New("file lock manager is unavailable")
)
View Source
var (
	ErrNotReadMode  = errors.New("file is not opened in read mode")
	ErrNotWriteMode = errors.New("file is not opened in write mode")
	ErrFileStaging  = errors.New("file is in staging state and not yet synced to iRODS")
)

Functions

This section is empty.

Types

type FileLock

type FileLock struct {
	Type  FileLockType
	Owner FileLockOwner
	Pid   uint32 // pid of the process that requested the lock, reported back by Test
	Start uint64
	End   uint64
}

FileLock is a byte-range lock request or a lock held on a file. Start and End are both inclusive.

type FileLockManager

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

FileLockManager manages byte-range file locks in memory.

Locks are tracked per file path, not per file handle, so that two handles on the same file see each other's locks. See FileLockOwner for how a holder is identified.

flock() locks and fcntl() locks are kept in one table but never conflict with each other, which is how the kernel treats them: a file can be locked through both mechanisms at once.

Known deviations from POSIX:

  • A process that closes one of several file descriptors on a file keeps the locks it took through the others. POSIX drops them all. The locks are released when the handle that took them is closed, as flock() and OFD locks are. (The FUSE library this serves does not report the lock owner of a FLUSH, so owner-wide release on close cannot be implemented here.)
  • Deadlocks between waiters are not detected, so no waiter fails with EDEADLK; a blocking request waits until the conflicting lock is released or the given context is canceled.
  • The locks live in this process only. A client that reaches iRODS without going through this process does not see them.

func NewFileLockManager

func NewFileLockManager() *FileLockManager

NewFileLockManager creates a new FileLockManager

func (*FileLockManager) Lock

func (m *FileLockManager) Lock(path string, lock *FileLock) error

Lock acquires, downgrades, upgrades or releases a lock without waiting. It returns ErrFileLockConflict if another owner holds a conflicting lock.

func (*FileLockManager) LockWait

func (m *FileLockManager) LockWait(ctx context.Context, path string, lock *FileLock) error

LockWait acquires a lock, waiting until it becomes available or the context is canceled. Releasing a lock never waits.

func (*FileLockManager) Move

func (m *FileLockManager) Move(oldPath string, newPath string)

Move makes the locks held on oldPath follow the file to newPath, so that a rename of an open file does not hide the locks it holds.

Locks already held on newPath are kept. A rename that replaces an existing file leaves that file's holders with locks that are no longer reachable by name, which mirrors what the kernel does with the replaced inode.

func (*FileLockManager) Release

func (m *FileLockManager) Release(handleID string)

Release releases every lock taken by the given file handle. It scans all files rather than taking a path, so that a handle whose file was renamed while it was open does not leak its locks.

func (*FileLockManager) Test

func (m *FileLockManager) Test(path string, lock *FileLock) *FileLock

Test returns a lock that conflicts with the given request, or nil if the request can be granted

type FileLockOwner

type FileLockOwner struct {
	Scope  string // client/session the owner belongs to
	Handle string // file handle that requested the lock
	Owner  uint64 // lock owner id given by the caller (FUSE lock_owner)
	Flock  bool   // the request came from flock(), not from fcntl()
}

FileLockOwner identifies who holds a lock.

The kernel hands FUSE a lock owner that already carries the right identity for each locking mechanism, so the two are keyed differently:

  • flock() and OFD locks are owned by an open file description. Owner is unique per open, and Handle is compared as well so that two opens never look like one owner.
  • fcntl() POSIX locks are owned by the process. The kernel sends the same Owner for every file descriptor the process has on the file, so Handle is not compared - otherwise a process that opens the same file twice would conflict with itself.

Scope separates owners that belong to different clients of one lock manager. It is empty for a lock manager serving a single process, and holds the session id when a pool server serves many mounts from one table.

type FileLockType

type FileLockType uint32

FileLockType is a type of a file lock

const (
	// FileLockTypeRead is a shared lock
	FileLockTypeRead FileLockType = iota
	// FileLockTypeWrite is an exclusive lock
	FileLockTypeWrite
	// FileLockTypeUnlock releases locks in the given range
	FileLockTypeUnlock
)

func (FileLockType) String

func (t FileLockType) String() string

type IRODSFSClient

type IRODSFSClient interface {
	Release() error

	GetAccount() *irodsclient_types.IRODSAccount
	GetApplicationName() string

	GetOpenConnections() int
	GetMetrics() *irodsclient_metrics.IRODSMetrics

	// API
	List(path string) ([]*irodsclient_fs.Entry, error)
	Stat(path string) (*irodsclient_fs.Entry, error)
	ExistsDir(path string) bool
	ExistsFile(path string) bool
	RemoveFile(path string, force bool) error
	RemoveDir(path string, recurse bool, force bool) error
	MakeDir(path string, recurse bool) error
	RenameDirToDir(srcPath string, destPath string) error
	RenameFileToFile(srcPath string, destPath string) error
	CreateFile(path string, mode string) (IRODSFSFileHandle, error)
	OpenFile(path string, mode string) (IRODSFSFileHandle, error)
	CreateFileBulk(path string, mode string) (IRODSFSFileHandle, error)
	OpenFileBulk(path string, mode string) (IRODSFSFileHandle, error)
	TruncateFile(path string, size int64) error

	// Sync
	Sync() error

	// File Transfer
	DownloadFile(irodsPath string, localPath string, transferCallback irodsclient_common.TransferTrackerCallback) error
	DownloadFileParallel(irodsPath string, localPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error
	DownloadFileWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, transferCallback irodsclient_common.TransferTrackerCallback) error
	DownloadFileParallelWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error
	UploadFile(localPath string, irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error
	UploadFileParallel(localPath string, irodsPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

	// Cache
	CacheFile(irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error
}

func NewIRODSFSClientBuffered

func NewIRODSFSClientBuffered(fs *irodsclient_fs.FileSystem, cache *cache.MemoryCacheManager, config *IRODSFSClientBufferedConfig) (IRODSFSClient, error)

NewIRODSFSClientBuffered creates a new IRODSFSClientBuffered with the given config. The cache is provided externally so it can be shared across multiple clients.

func NewIRODSFSClientDirect

func NewIRODSFSClientDirect(fs *irodsclient_fs.FileSystem) (IRODSFSClient, error)

NewIRODSFSClientDirect creates IRODSFSClient using IRODSFSClientDirect

type IRODSFSClientBuffered

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

IRODSFSClientBuffered wraps IRODSFSClient with block-level read-through caching and local staging for write/readwrite modes.

func (*IRODSFSClientBuffered) CacheFile

func (c *IRODSFSClientBuffered) CacheFile(irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

CacheFile downloads a file from iRODS into the block cache without writing to local disk

func (*IRODSFSClientBuffered) CreateFile

func (c *IRODSFSClientBuffered) CreateFile(path string, mode string) (IRODSFSFileHandle, error)

func (*IRODSFSClientBuffered) CreateFileBulk

func (c *IRODSFSClientBuffered) CreateFileBulk(path string, mode string) (IRODSFSFileHandle, error)

func (*IRODSFSClientBuffered) DownloadFile

func (c *IRODSFSClientBuffered) DownloadFile(irodsPath string, localPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

DownloadFile downloads a file to a local path

func (*IRODSFSClientBuffered) DownloadFileParallel

func (c *IRODSFSClientBuffered) DownloadFileParallel(irodsPath string, localPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

DownloadFileParallel downloads a file in parallel to a local path

func (*IRODSFSClientBuffered) DownloadFileParallelWithCallback

func (c *IRODSFSClientBuffered) DownloadFileParallelWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

func (*IRODSFSClientBuffered) DownloadFileWithCallback

func (c *IRODSFSClientBuffered) DownloadFileWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, transferCallback irodsclient_common.TransferTrackerCallback) error

func (*IRODSFSClientBuffered) Drain

func (c *IRODSFSClientBuffered) Drain() error

Drain uploads what the session has staged without holding off the clients using it, so it suits a session that may yet be handed back. Sync is the strict version, which empties the staging area but stops new write handles from opening while it runs.

func (*IRODSFSClientBuffered) ExistsDir

func (c *IRODSFSClientBuffered) ExistsDir(dirPath string) bool

func (*IRODSFSClientBuffered) ExistsFile

func (c *IRODSFSClientBuffered) ExistsFile(filePath string) bool

func (*IRODSFSClientBuffered) GetAccount

func (*IRODSFSClientBuffered) GetApplicationName

func (c *IRODSFSClientBuffered) GetApplicationName() string

func (*IRODSFSClientBuffered) GetCacheHitBytes

func (c *IRODSFSClientBuffered) GetCacheHitBytes() uint64

GetCacheHitBytes returns the number of bytes served from the block cache. File handle reads count only the requested bytes, not the whole block.

func (*IRODSFSClientBuffered) GetCacheMissBytes

func (c *IRODSFSClientBuffered) GetCacheMissBytes() uint64

GetCacheMissBytes returns the number of bytes that missed the block cache. File handle reads count only the requested bytes, not the whole block fetched to fill the cache.

func (*IRODSFSClientBuffered) GetFSClient

GetFSClient returns iRODS fs client

func (*IRODSFSClientBuffered) GetFileLockManager

func (c *IRODSFSClientBuffered) GetFileLockManager() *FileLockManager

GetFileLockManager returns the file lock manager shared by the handles of this client

func (*IRODSFSClientBuffered) GetMetrics

func (*IRODSFSClientBuffered) GetOpenConnections

func (c *IRODSFSClientBuffered) GetOpenConnections() int

func (*IRODSFSClientBuffered) GetPackedFS

func (c *IRODSFSClientBuffered) GetPackedFS() *packedfs.Manager

GetPackedFS returns the packed directory manager, or nil when packed directories are disabled.

func (*IRODSFSClientBuffered) GetPrefetchBytes

func (c *IRODSFSClientBuffered) GetPrefetchBytes() uint64

GetPrefetchBytes returns the number of bytes CacheFile fetched from iRODS into the block cache. Prefetching serves no read, so it counts toward neither cache hits nor misses.

func (*IRODSFSClientBuffered) GetStagingFS

func (c *IRODSFSClientBuffered) GetStagingFS() *stagingfs.StagingFS

func (*IRODSFSClientBuffered) List

func (c *IRODSFSClientBuffered) List(dirPath string) ([]*irodsclient_fs.Entry, error)

func (*IRODSFSClientBuffered) MakeDir

func (c *IRODSFSClientBuffered) MakeDir(irodsPath string, recurse bool) error

func (*IRODSFSClientBuffered) OpenFile

func (c *IRODSFSClientBuffered) OpenFile(path string, mode string) (IRODSFSFileHandle, error)

func (*IRODSFSClientBuffered) OpenFileBulk

func (c *IRODSFSClientBuffered) OpenFileBulk(path string, mode string) (IRODSFSFileHandle, error)

func (*IRODSFSClientBuffered) Release

func (c *IRODSFSClientBuffered) Release() error

func (*IRODSFSClientBuffered) RemoveDir

func (c *IRODSFSClientBuffered) RemoveDir(irodsPath string, recurse bool, force bool) error

func (*IRODSFSClientBuffered) RemoveFile

func (c *IRODSFSClientBuffered) RemoveFile(irodsPath string, force bool) error

func (*IRODSFSClientBuffered) RenameDirToDir

func (c *IRODSFSClientBuffered) RenameDirToDir(srcPath string, destPath string) error

func (*IRODSFSClientBuffered) RenameFileToFile

func (c *IRODSFSClientBuffered) RenameFileToFile(srcPath string, destPath string) error

func (*IRODSFSClientBuffered) Stat

func (c *IRODSFSClientBuffered) Stat(filePath string) (*irodsclient_fs.Entry, error)

func (*IRODSFSClientBuffered) Sync

func (c *IRODSFSClientBuffered) Sync() error

func (*IRODSFSClientBuffered) TruncateFile

func (c *IRODSFSClientBuffered) TruncateFile(path string, size int64) error

func (*IRODSFSClientBuffered) UploadFile

func (c *IRODSFSClientBuffered) UploadFile(localPath string, irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

UploadFile stages a file for bulk upload. The file is copied into the staging area and uploaded to iRODS by the background sync worker. Unlike FUSE-written files (ActionUpload), bulk-uploaded files are deleted from local storage immediately after sync (not cached). Falls back to direct upload if staging is not configured.

func (*IRODSFSClientBuffered) UploadFileParallel

func (c *IRODSFSClientBuffered) UploadFileParallel(localPath string, irodsPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

UploadFileParallel stages a file for bulk upload (parallel). See UploadFile for details.

type IRODSFSClientBufferedConfig

type IRODSFSClientBufferedConfig struct {
	BlockSize int // Block size for read cache in bytes (default: 4MB)

	// Staging settings (leave StagingRootPath empty to disable staging/write support)
	StagingRootPath    string                     // Local path for staging files
	MaxStagingDataSize int64                      // Max disk usage for staged data (0 = use default 10GB)
	MaxCacheFileSize   int64                      // Max size of a single file kept as read cache after sync (0 = use default 1GB)
	SyncInterval       time.Duration              // Background sync interval (default: 5s)
	GracePeriod        time.Duration              // Grace period before sync (default: 10s)
	UsePersistence     bool                       // Use BadgerDB for crash recovery
	OnSyncError        stagingfs.SyncErrorHandler // Optional error callback

	// GlobalQuota enforces a shared staging disk limit across all buffered
	// clients. When set, every StagingFS instance checks this quota in addition
	// to its own per-session limit. Nil disables the cross-session check.
	GlobalQuota stagingfs.GlobalQuota

	// ForceRepair repairs a corrupted staging DAG instead of failing during
	// restore. Use this for force-recovery after a crash. When set, Repaired
	// is filled with the number of edges that were fixed.
	ForceRepair bool
	Repaired    int

	// PackedDirectories configures directories that are stored in iRODS as one
	// archive data object rather than as a collection of many small files. Nil
	// or disabled leaves every directory handled normally.
	PackedDirectories *packedfs.Config

	// Logger receives the buffered client's, staging's, and packed directories'
	// logs. Nil uses the iRODS filesystem's logger.
	Logger *log.Entry
}

IRODSFSClientBufferedConfig holds configuration for IRODSFSClientBuffered

type IRODSFSClientBufferedFileHandle

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

IRODSFSClientBufferedFileHandle wraps IRODSFSFileHandle with block-level caching

func (*IRODSFSClientBufferedFileHandle) Close

func (*IRODSFSClientBufferedFileHandle) Flush

func (*IRODSFSClientBufferedFileHandle) GetAvailable

func (h *IRODSFSClientBufferedFileHandle) GetAvailable(offset int64) int64

func (*IRODSFSClientBufferedFileHandle) GetEntry

func (*IRODSFSClientBufferedFileHandle) GetID

func (*IRODSFSClientBufferedFileHandle) GetOpenMode

func (*IRODSFSClientBufferedFileHandle) Getlk

Getlk returns a lock that conflicts with the given lock, or nil if the lock can be acquired

func (*IRODSFSClientBufferedFileHandle) IsReadMode

func (h *IRODSFSClientBufferedFileHandle) IsReadMode() bool

func (*IRODSFSClientBufferedFileHandle) IsWriteMode

func (h *IRODSFSClientBufferedFileHandle) IsWriteMode() bool

func (*IRODSFSClientBufferedFileHandle) ReadAt

func (h *IRODSFSClientBufferedFileHandle) ReadAt(buffer []byte, offset int64) (int, error)

ReadAt reads from cache if available, otherwise reads full blocks from the underlying handle and caches them. Handles cross-block reads correctly.

func (*IRODSFSClientBufferedFileHandle) Setlk

Setlk acquires or releases a lock without waiting. It returns ErrFileLockConflict if the lock is held by another owner.

func (*IRODSFSClientBufferedFileHandle) Setlkw

Setlkw acquires a lock, waiting until it becomes available or the context is canceled

func (*IRODSFSClientBufferedFileHandle) Truncate

func (h *IRODSFSClientBufferedFileHandle) Truncate(size int64) error

func (*IRODSFSClientBufferedFileHandle) WriteAt

func (h *IRODSFSClientBufferedFileHandle) WriteAt(data []byte, offset int64) (int, error)

WriteAt writes to underlying handle and invalidates affected cache blocks

type IRODSFSClientBufferedStagedHandle

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

IRODSFSClientBufferedStagedHandle implements IRODSFSFileHandle using local staging files. Write operations go to a local file; background sync uploads to iRODS.

func (*IRODSFSClientBufferedStagedHandle) Close

func (*IRODSFSClientBufferedStagedHandle) Flush

func (*IRODSFSClientBufferedStagedHandle) GetAvailable

func (h *IRODSFSClientBufferedStagedHandle) GetAvailable(offset int64) int64

func (*IRODSFSClientBufferedStagedHandle) GetEntry

func (*IRODSFSClientBufferedStagedHandle) GetID

func (*IRODSFSClientBufferedStagedHandle) GetOpenMode

func (*IRODSFSClientBufferedStagedHandle) Getlk

Getlk returns a lock that conflicts with the given lock, or nil if the lock can be acquired

func (*IRODSFSClientBufferedStagedHandle) IsReadMode

func (h *IRODSFSClientBufferedStagedHandle) IsReadMode() bool

func (*IRODSFSClientBufferedStagedHandle) IsWriteMode

func (h *IRODSFSClientBufferedStagedHandle) IsWriteMode() bool

func (*IRODSFSClientBufferedStagedHandle) ReadAt

func (h *IRODSFSClientBufferedStagedHandle) ReadAt(buffer []byte, offset int64) (int, error)

func (*IRODSFSClientBufferedStagedHandle) Setlk

Setlk acquires or releases a lock without waiting. It returns ErrFileLockConflict if the lock is held by another owner.

func (*IRODSFSClientBufferedStagedHandle) Setlkw

Setlkw acquires a lock, waiting until it becomes available or the context is canceled

func (*IRODSFSClientBufferedStagedHandle) Truncate

func (h *IRODSFSClientBufferedStagedHandle) Truncate(size int64) error

func (*IRODSFSClientBufferedStagedHandle) UpdateStagingPath

func (h *IRODSFSClientBufferedStagedHandle) UpdateStagingPath(newPath string)

UpdateStagingPath updates the iRODS path held by this handle. Called by StagingFS.Rename to keep the handle's path in sync after a rename while the handle is open.

func (*IRODSFSClientBufferedStagedHandle) WriteAt

func (h *IRODSFSClientBufferedStagedHandle) WriteAt(data []byte, offset int64) (int, error)

type IRODSFSClientDirect

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

IRODSFSClientDirect implements IRODSClient interface with go-irodsclient direct access to iRODS server implements interfaces defined in interface.go

func (*IRODSFSClientDirect) CacheFile

func (c *IRODSFSClientDirect) CacheFile(irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

CacheFile is a no-op for direct client

func (*IRODSFSClientDirect) CreateFile

func (c *IRODSFSClientDirect) CreateFile(path string, mode string) (IRODSFSFileHandle, error)

CreateFile creates a file

func (*IRODSFSClientDirect) CreateFileBulk

func (c *IRODSFSClientDirect) CreateFileBulk(path string, mode string) (IRODSFSFileHandle, error)

CreateFileBulk delegates to CreateFile (Direct has no staging distinction)

func (*IRODSFSClientDirect) DownloadFile

func (c *IRODSFSClientDirect) DownloadFile(irodsPath string, localPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

DownloadFile downloads a file from iRODS to local filesystem

func (*IRODSFSClientDirect) DownloadFileParallel

func (c *IRODSFSClientDirect) DownloadFileParallel(irodsPath string, localPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

DownloadFileParallel downloads a file from iRODS to local filesystem in parallel

func (*IRODSFSClientDirect) DownloadFileParallelWithCallback

func (c *IRODSFSClientDirect) DownloadFileParallelWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

func (*IRODSFSClientDirect) DownloadFileWithCallback

func (c *IRODSFSClientDirect) DownloadFileWithCallback(irodsPath string, blockSize int, numBlocks int, blockReadyCallback irodsclient_common.DataObjectBlockCallback, transferCallback irodsclient_common.TransferTrackerCallback) error

func (*IRODSFSClientDirect) ExistsDir

func (c *IRODSFSClientDirect) ExistsDir(path string) bool

ExistsDir checks existance of a dir

func (*IRODSFSClientDirect) ExistsFile

func (c *IRODSFSClientDirect) ExistsFile(path string) bool

ExistsFile checks existance of a file

func (*IRODSFSClientDirect) GetAccount

GetAccount returns iRODS Account info

func (*IRODSFSClientDirect) GetApplicationName

func (c *IRODSFSClientDirect) GetApplicationName() string

GetApplicationName returns application name

func (*IRODSFSClientDirect) GetFSClient

func (c *IRODSFSClientDirect) GetFSClient() *irodsclient_fs.FileSystem

GetFSClient returns iRODS fs client

func (*IRODSFSClientDirect) GetFileLockManager

func (c *IRODSFSClientDirect) GetFileLockManager() *FileLockManager

GetFileLockManager returns the file lock manager that serves locks of this client

func (*IRODSFSClientDirect) GetMetrics

GetTransferMetrics() returns transfer metrics

func (*IRODSFSClientDirect) GetOpenConnections

func (c *IRODSFSClientDirect) GetOpenConnections() int

GetOpenConnections() returns total number of open connections

func (*IRODSFSClientDirect) List

func (c *IRODSFSClientDirect) List(path string) ([]*irodsclient_fs.Entry, error)

List lists directory entries

func (*IRODSFSClientDirect) MakeDir

func (c *IRODSFSClientDirect) MakeDir(path string, recurse bool) error

MakeDir makes a new directory

func (*IRODSFSClientDirect) OpenFile

func (c *IRODSFSClientDirect) OpenFile(path string, mode string) (IRODSFSFileHandle, error)

OpenFile opens a file

func (*IRODSFSClientDirect) OpenFileBulk

func (c *IRODSFSClientDirect) OpenFileBulk(path string, mode string) (IRODSFSFileHandle, error)

OpenFileBulk delegates to OpenFile (Direct has no staging distinction)

func (*IRODSFSClientDirect) Release

func (c *IRODSFSClientDirect) Release() error

Release releases resources

func (*IRODSFSClientDirect) RemoveDir

func (c *IRODSFSClientDirect) RemoveDir(path string, recurse bool, force bool) error

RemoveDir removes a directory

func (*IRODSFSClientDirect) RemoveFile

func (c *IRODSFSClientDirect) RemoveFile(path string, force bool) error

RemoveFile removes a file

func (*IRODSFSClientDirect) RenameDirToDir

func (c *IRODSFSClientDirect) RenameDirToDir(srcPath string, destPath string) error

RenameDirToDir renames a directory, dest path is also a non-existing path for dir

func (*IRODSFSClientDirect) RenameFileToFile

func (c *IRODSFSClientDirect) RenameFileToFile(srcPath string, destPath string) error

RenameFileToFile renames a file, dest path is also a non-existing path for file

func (*IRODSFSClientDirect) Stat

Stat stats fs entry

func (*IRODSFSClientDirect) Sync

func (c *IRODSFSClientDirect) Sync() error

Sync is a no-op for direct client (no staging layer)

func (*IRODSFSClientDirect) TruncateFile

func (c *IRODSFSClientDirect) TruncateFile(path string, size int64) error

TruncateFile truncates a file

func (*IRODSFSClientDirect) UploadFile

func (c *IRODSFSClientDirect) UploadFile(localPath string, irodsPath string, transferCallback irodsclient_common.TransferTrackerCallback) error

UploadFile uploads a file from local filesystem to iRODS

func (*IRODSFSClientDirect) UploadFileParallel

func (c *IRODSFSClientDirect) UploadFileParallel(localPath string, irodsPath string, taskNum int, transferCallback irodsclient_common.TransferTrackerCallback) error

UploadFileParallel uploads a file from local filesystem to iRODS in parallel

type IRODSFSClientDirectFileHandle

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

IRODSFSClientDirectFileHandle implements IRODSFSFileHandle

func (*IRODSFSClientDirectFileHandle) Close

func (*IRODSFSClientDirectFileHandle) Flush

func (*IRODSFSClientDirectFileHandle) GetAvailable

func (h *IRODSFSClientDirectFileHandle) GetAvailable(offset int64) int64

func (*IRODSFSClientDirectFileHandle) GetEntry

func (*IRODSFSClientDirectFileHandle) GetID

GetID returns the id of this file handle.

It is the id of the handle itself, not of the iRODS handle underneath, which several file handles can share. Callers key their open handles by it.

func (*IRODSFSClientDirectFileHandle) GetOpenMode

func (*IRODSFSClientDirectFileHandle) Getlk

Getlk returns a lock that conflicts with the given lock, or nil if the lock can be acquired

func (*IRODSFSClientDirectFileHandle) IsReadMode

func (h *IRODSFSClientDirectFileHandle) IsReadMode() bool

func (*IRODSFSClientDirectFileHandle) IsWriteMode

func (h *IRODSFSClientDirectFileHandle) IsWriteMode() bool

func (*IRODSFSClientDirectFileHandle) ReadAt

func (h *IRODSFSClientDirectFileHandle) ReadAt(buffer []byte, offset int64) (int, error)

func (*IRODSFSClientDirectFileHandle) Setlk

Setlk acquires or releases a lock without waiting. It returns ErrFileLockConflict if the lock is held by another owner.

func (*IRODSFSClientDirectFileHandle) Setlkw

Setlkw acquires a lock, waiting until it becomes available or the context is canceled

func (*IRODSFSClientDirectFileHandle) Truncate

func (h *IRODSFSClientDirectFileHandle) Truncate(size int64) error

func (*IRODSFSClientDirectFileHandle) WriteAt

func (h *IRODSFSClientDirectFileHandle) WriteAt(data []byte, offset int64) (int, error)

type IRODSFSFileHandle

type IRODSFSFileHandle interface {
	GetID() string
	GetEntry() *irodsclient_fs.Entry
	GetOpenMode() irodsclient_types.FileOpenMode
	IsReadMode() bool
	IsWriteMode() bool
	ReadAt(buffer []byte, offset int64) (int, error)
	GetAvailable(offset int64) int64
	WriteAt(data []byte, offset int64) (int, error)
	Truncate(size int64) error
	Flush() error
	Close() error

	// Locks
	// Getlk returns a lock that conflicts with the given lock, or nil if the
	// lock can be acquired
	Getlk(lock *FileLock) (*FileLock, error)
	// Setlk acquires or releases a lock without waiting. It returns
	// ErrFileLockConflict if another owner holds a conflicting lock.
	Setlk(lock *FileLock) error
	// Setlkw acquires a lock, waiting until it becomes available or the
	// context is canceled
	Setlkw(ctx context.Context, lock *FileLock) error
}

Directories

Path Synopsis
Package packedfs stores directories that hold very many small files as a single tar data object in iRODS instead of as a collection.
Package packedfs stores directories that hold very many small files as a single tar data object in iRODS instead of as a collection.

Jump to

Keyboard shortcuts

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