irodsfs

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SymlinkSuffix marks a data object that holds a symbolic link target.
	// iRODS has no POSIX symbolic link, so a link shown as "X" is stored as a data
	// object named "X"+SymlinkSuffix whose content is the link target. Keeping the
	// marker in the name, rather than in metadata or in the data type column, is
	// what lets the staging layer carry it to iRODS unchanged.
	SymlinkSuffix string = ".irodssymlink"

	// SymlinkTargetMax is the largest link target we store, matching PATH_MAX
	SymlinkTargetMax int64 = 4096
)

Variables

This section is empty.

Functions

func IsSymlinkStoredName added in v0.13.1

func IsSymlinkStoredName(storedName string) bool

IsSymlinkStoredName returns true if the given iRODS name stores a symbolic link

func SymlinkStoredName added in v0.13.1

func SymlinkStoredName(visibleName string) string

SymlinkStoredName returns the iRODS name that stores the symbolic link shown under the given name. It applies equally to a full path, whose last component is the name.

func SymlinkVisibleName added in v0.13.1

func SymlinkVisibleName(storedName string) (string, bool)

SymlinkVisibleName returns the name a symbolic link stored under the given iRODS name is shown under. It returns false if the name does not store a symbolic link.

Types

type Dir

type Dir struct {
	fusefs.Inode
	// contains filtered or unexported fields
}

Dir is a directory node

func NewDir

func NewDir(fs *IRODSFS, inodeID uint64, path string) *Dir

NewDir creates a new Dir

func (*Dir) Create

func (dir *Dir) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*fusefs.Inode, fusefs.FileHandle, uint32, syscall.Errno)

Create creates a file for the path and returns file handle

func (*Dir) Fsync added in v0.8.16

func (dir *Dir) Fsync(ctx context.Context, fh fusefs.FileHandle, flags uint32) syscall.Errno

Fsync flushes content changes

func (*Dir) Getattr added in v0.7.9

func (dir *Dir) Getattr(ctx context.Context, fh fusefs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr returns stat of file entry

func (*Dir) Lookup

func (dir *Dir) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fusefs.Inode, syscall.Errno)

Lookup returns a node for the path

func (*Dir) Mkdir

func (dir *Dir) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fusefs.Inode, syscall.Errno)

Mkdir makes a dir for the path

func (*Dir) NewSubDirInode added in v0.13.0

func (dir *Dir) NewSubDirInode(ctx context.Context, inodeID uint64, path string) (*Dir, *fusefs.Inode)

func (*Dir) NewSubFileInode added in v0.13.0

func (dir *Dir) NewSubFileInode(ctx context.Context, inodeID uint64, path string) (*File, *fusefs.Inode)

func (*Dir) NewSubSymlinkInode added in v0.13.1

func (dir *Dir) NewSubSymlinkInode(ctx context.Context, inodeID uint64, path string, target string) (*Symlink, *fusefs.Inode)

func (*Dir) Opendir added in v0.7.9

func (dir *Dir) Opendir(ctx context.Context) syscall.Errno

Opendir validates the existance of a dir

func (*Dir) Readdir added in v0.7.9

func (dir *Dir) Readdir(ctx context.Context) (fusefs.DirStream, syscall.Errno)

Readdir returns directory entries

func (*Dir) Rename

func (dir *Dir) Rename(ctx context.Context, name string, newParent fusefs.InodeEmbedder, newName string, flags uint32) syscall.Errno

Rename renames a node for the path

func (*Dir) Rmdir added in v0.7.9

func (dir *Dir) Rmdir(ctx context.Context, name string) syscall.Errno

Rmdir removes a dir

func (*Dir) Setattr added in v0.7.1

func (dir *Dir) Setattr(ctx context.Context, fh fusefs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr sets dir attributes

func (*Dir) Statfs added in v0.13.0

func (dir *Dir) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno

Statfs returns filesystem statistics. iRODS does not expose total/free disk usage, so large placeholder values are returned to prevent clients from treating the filesystem as full.

func (dir *Dir) Symlink(ctx context.Context, target string, name string, out *fuse.EntryOut) (*fusefs.Inode, syscall.Errno)

Symlink creates a symbolic link

func (dir *Dir) Unlink(ctx context.Context, name string) syscall.Errno

Unlink removes a file for the path

type File

type File struct {
	fusefs.Inode
	// contains filtered or unexported fields
}

File is a file node

func NewFile

func NewFile(fs *IRODSFS, inodeID uint64, path string) *File

NewFile creates a new File

func (*File) Getattr added in v0.7.9

func (file *File) Getattr(ctx context.Context, fh fusefs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr returns stat of file entry

func (*File) Getlk added in v0.8.16

func (file *File) Getlk(ctx context.Context, fh fusefs.FileHandle, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) syscall.Errno

Getlk returns locks

func (*File) Open

func (file *File) Open(ctx context.Context, flags uint32) (fusefs.FileHandle, uint32, syscall.Errno)

Open opens file for the path and returns file handle

func (*File) Setattr

func (file *File) Setattr(ctx context.Context, fh fusefs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr sets file attributes

func (*File) Setlk added in v0.8.16

func (file *File) Setlk(ctx context.Context, fh fusefs.FileHandle, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno

Setlk obtains a lock on a file, or fail if the lock could not obtained

func (*File) Setlkw added in v0.8.16

func (file *File) Setlkw(ctx context.Context, fh fusefs.FileHandle, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno

Setlkw obtains a lock on a file, waiting if necessary

func (*File) Truncate

func (file *File) Truncate(ctx context.Context, size uint64) syscall.Errno

Truncate truncates file entry

type FileHandle

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

FileHandle is a file handle

func NewFileHandle

func NewFileHandle(fs *IRODSFS, fileHandle irodsfscommon_irods.IRODSFSFileHandle) (*FileHandle, error)

func (*FileHandle) Flush

func (handle *FileHandle) Flush(ctx context.Context) syscall.Errno

Flush flushes content changes

func (*FileHandle) Fsync added in v0.7.9

func (handle *FileHandle) Fsync(ctx context.Context, flags uint32) syscall.Errno

Fsync flushes content changes

func (*FileHandle) GetID added in v0.9.4

func (handle *FileHandle) GetID() string

GetID returns ID

func (*FileHandle) GetPath added in v0.9.4

func (handle *FileHandle) GetPath() string

GetPath returns path

func (*FileHandle) Getattr added in v0.7.9

func (handle *FileHandle) Getattr(ctx context.Context, out *fuse.AttrOut) syscall.Errno

Getattr returns stat of file entry

func (*FileHandle) Getlk added in v0.8.16

func (handle *FileHandle) Getlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) syscall.Errno

Getlk returns a lock that conflicts with the given lock

func (*FileHandle) Read

func (handle *FileHandle) Read(ctx context.Context, dest []byte, offset int64) (fuse.ReadResult, syscall.Errno)

Read reads file content

func (*FileHandle) Release

func (handle *FileHandle) Release(ctx context.Context) syscall.Errno

Release closes file handle

func (*FileHandle) SetFile added in v0.9.0

func (handle *FileHandle) SetFile(file *File)

SetFile sets File

func (*FileHandle) Setattr added in v0.7.9

func (handle *FileHandle) Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr sets file attributes

func (*FileHandle) Setlk added in v0.8.16

func (handle *FileHandle) Setlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno

Setlk locks the file handle, or fails if the lock is held by someone else

func (*FileHandle) Setlkw added in v0.8.16

func (handle *FileHandle) Setlkw(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno

Setlkw locks the file handle and waits until it acquires the lock

func (*FileHandle) Truncate

func (handle *FileHandle) Truncate(ctx context.Context, size uint64) syscall.Errno

Truncate truncates file content

func (*FileHandle) Write

func (handle *FileHandle) Write(ctx context.Context, data []byte, offset int64) (uint32, syscall.Errno)

Write writes file content

type FileHandleMap

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

func NewFileHandleMap

func NewFileHandleMap() *FileHandleMap

NewFileHandleMap creates a new FileHandleMap

func (*FileHandleMap) Add

func (fileHandleMap *FileHandleMap) Add(handle *FileHandle)

Add registers a file handle

func (*FileHandleMap) Clear

func (fileHandleMap *FileHandleMap) Clear()

Clear clears all file handles registered

func (*FileHandleMap) Get

func (fileHandleMap *FileHandleMap) Get(id string) *FileHandle

Get returns a file handle registered using ID

func (*FileHandleMap) List

func (fileHandleMap *FileHandleMap) List() []*FileHandle

List lists all file handles registered

func (*FileHandleMap) ListByPath

func (fileHandleMap *FileHandleMap) ListByPath(path string) []*FileHandle

ListByPath returns file handles registered using path

func (*FileHandleMap) ListPathsInDir

func (fileHandleMap *FileHandleMap) ListPathsInDir(parentPath string) []string

ListPathsUnderDir returns paths of file handles under given parent path

func (*FileHandleMap) Pop

func (fileHandleMap *FileHandleMap) Pop(id string) *FileHandle

Pop pops a file handle registered using ID and returns the handle

func (*FileHandleMap) PopAll

func (fileHandleMap *FileHandleMap) PopAll() []*FileHandle

PopAll pops all file handles registered (clear) and returns

func (*FileHandleMap) PopByPath

func (fileHandleMap *FileHandleMap) PopByPath(path string) []*FileHandle

PopByPath pops file handles registered using path and returns the handles

func (*FileHandleMap) Remove

func (fileHandleMap *FileHandleMap) Remove(id string)

Remove deletes a file handle registered using ID

func (*FileHandleMap) Rename

func (fileHandleMap *FileHandleMap) Rename(srcPath string, destPath string)

Rename renames files or dirs

func (*FileHandleMap) RenameDir

func (fileHandleMap *FileHandleMap) RenameDir(srcParentPath string, destParentPath string)

RenameDir renames files under parentPath

func (*FileHandleMap) RenameFile added in v0.9.0

func (fileHandleMap *FileHandleMap) RenameFile(srcPath string, destPath string)

RenameFile renames files

type IRODSFS

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

IRODSFS is a file system object

func NewFileSystem

func NewFileSystem(config *commons.Config) (*IRODSFS, error)

NewFileSystem creates a new file system

func (*IRODSFS) GetFuseOptions added in v0.13.0

func (fs *IRODSFS) GetFuseOptions() *fusefs.Options

GetFuseOptions returns fuse options

func (*IRODSFS) GetNextOperationID

func (fs *IRODSFS) GetNextOperationID() uint64

GetNextOperationID returns next operation ID

func (*IRODSFS) GetRoot added in v0.13.0

func (fs *IRODSFS) GetRoot() (*Dir, error)

GetRoot returns root directory node

func (*IRODSFS) IRODSCreate added in v0.13.0

func (fs *IRODSFS) IRODSCreate(ctx context.Context, dir *Dir, path string, flags uint32, out *fuse.EntryOut) (int64, *FileHandle, syscall.Errno)

IRODSCreate creates file for the given irods path

func (*IRODSFS) IRODSExists added in v0.13.1

func (fs *IRODSFS) IRODSExists(ctx context.Context, path string) (bool, syscall.Errno)

IRODSExists returns true if an entry exists at the given irods path

func (*IRODSFS) IRODSFsync added in v0.13.0

func (fs *IRODSFS) IRODSFsync(ctx context.Context) syscall.Errno

IRODSFsync syncs filesytem

func (*IRODSFS) IRODSGetACL added in v0.13.0

func (fs *IRODSFS) IRODSGetACL(ctx context.Context, entry *irodsclient_fs.Entry, readonly bool) os.FileMode

IRODSGetACL returns ACL flag from iRODS entry

func (*IRODSFS) IRODSGetOpenFlags added in v0.13.0

func (fs *IRODSFS) IRODSGetOpenFlags(flags uint32) irodsclient_types.FileOpenMode

IRODSGetOpenFlags converts file open flags to iRODS file open mode

func (*IRODSFS) IRODSGetPermission added in v0.13.0

func (fs *IRODSFS) IRODSGetPermission(level irodsclient_types.IRODSAccessLevelType) os.FileMode

IRODSGetACL returns permission flag from iRODS access level type

func (*IRODSFS) IRODSGetattr added in v0.13.0

func (fs *IRODSFS) IRODSGetattr(ctx context.Context, path string, vpathReadonly bool, out *fuse.AttrOut) syscall.Errno

IRODSGetattr returns an attr for the given irods path

func (fs *IRODSFS) IRODSGetattrSymlink(ctx context.Context, path string, out *fuse.AttrOut) syscall.Errno

IRODSGetattrSymlink returns an attr for the symbolic link stored at the given irods path

func (*IRODSFS) IRODSLookup added in v0.13.0

func (fs *IRODSFS) IRODSLookup(ctx context.Context, dir *Dir, path string, vpathReadonly bool, out *fuse.EntryOut) (int64, bool, syscall.Errno)

IRODSLookup returns entry for the given irods path

func (fs *IRODSFS) IRODSLookupSymlink(ctx context.Context, path string, out *fuse.EntryOut) (int64, syscall.Errno)

IRODSLookupSymlink returns entry for the symbolic link stored at the given irods path

func (*IRODSFS) IRODSMkdir added in v0.13.0

func (fs *IRODSFS) IRODSMkdir(ctx context.Context, dir *Dir, path string, out *fuse.EntryOut) (int64, syscall.Errno)

IRODSMkdir removes dir for the given irods path

func (*IRODSFS) IRODSOpen added in v0.13.0

func (fs *IRODSFS) IRODSOpen(ctx context.Context, file *File, path string, flags uint32) (*FileHandle, syscall.Errno)

IRODSOpen opens file for the given irods path

func (*IRODSFS) IRODSOpendir added in v0.13.0

func (fs *IRODSFS) IRODSOpendir(ctx context.Context, path string) syscall.Errno

IRODSOpendir opens dir for the given irods path

func (*IRODSFS) IRODSReaddir added in v0.13.0

func (fs *IRODSFS) IRODSReaddir(ctx context.Context, path string) ([]fuse.DirEntry, syscall.Errno)

IRODSReaddir reads dir entries for the given irods path

func (fs *IRODSFS) IRODSReadlink(ctx context.Context, path string) (string, syscall.Errno)

IRODSReadlink returns the target of the symbolic link stored at the given irods path

func (*IRODSFS) IRODSRename added in v0.13.0

func (fs *IRODSFS) IRODSRename(ctx context.Context, dir *Dir, srcPath string, destPath string) syscall.Errno

IRODSRename renames file or dir for the given irods path

func (*IRODSFS) IRODSRmdir added in v0.13.0

func (fs *IRODSFS) IRODSRmdir(ctx context.Context, path string) syscall.Errno

IRODSRmdir removes dir for the given irods path

func (*IRODSFS) IRODSStat added in v0.13.0

func (fs *IRODSFS) IRODSStat(ctx context.Context, path string) (*irodsclient_fs.Entry, error)

IRODSStat returns a stat for the given irods path

func (fs *IRODSFS) IRODSSymlink(ctx context.Context, path string, target string, out *fuse.EntryOut) (int64, syscall.Errno)

IRODSSymlink creates a symbolic link holding the given target at the given irods path

func (fs *IRODSFS) IRODSUnlink(ctx context.Context, path string) syscall.Errno

IRODSUnlink removes file for the given irods path

func (*IRODSFS) Mount added in v0.13.0

func (fs *IRODSFS) Mount() error

Mount mounts FUSE

func (*IRODSFS) Release added in v0.8.0

func (fs *IRODSFS) Release()

Release releases the file system

func (*IRODSFS) Unmount added in v0.13.0

func (fs *IRODSFS) Unmount()

func (*IRODSFS) Wait added in v0.8.0

func (fs *IRODSFS) Wait()

Wait blocks until the FUSE request-serving loop exits. This happens when the filesystem is unmounted, including when it is unmounted externally.

type ResolvedDirEntry added in v0.13.1

type ResolvedDirEntry struct {
	Entry       *irodsclient_fs.Entry
	VisibleName string
	IsSymlink   bool
}

ResolvedDirEntry is an iRODS entry paired with the name it is shown under

func ResolveDirEntries added in v0.13.1

func ResolveDirEntries(entries []*irodsclient_fs.Entry) ([]*ResolvedDirEntry, []string)

ResolveDirEntries maps iRODS entries to the names they are shown under.

A real entry always wins over a symbolic link claiming the same visible name: given both "X" and "X"+SymlinkSuffix, "X" is shown and the link is returned as shadowed so that the caller can warn about it. Lookup probes the plain name first, so this keeps Readdir and Lookup in agreement by construction.

A symbolic link is always a data object, so a collection keeps its own name even when that name ends with the suffix.

type Symlink struct {
	fusefs.Inode
	// contains filtered or unexported fields
}

Symlink is a symbolic link node

func NewSymlink(fs *IRODSFS, inodeID uint64, path string, target string) *Symlink

NewSymlink creates a new Symlink. The target may be empty, in which case it is read from iRODS on the first Readlink.

func (*Symlink) Getattr added in v0.13.1

func (symlink *Symlink) Getattr(ctx context.Context, fh fusefs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr returns stat of the symbolic link

func (symlink *Symlink) Readlink(ctx context.Context) ([]byte, syscall.Errno)

Readlink returns the target of the symbolic link

Jump to

Keyboard shortcuts

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