fs

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: BSD-3-Clause Imports: 14 Imported by: 28

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	// FileSystemConnectionMaxMin is a minimum number of connection max value
	FileSystemConnectionMaxMin = 5
	// FileSystemConnectionMaxDefault is a default number of connection max value
	FileSystemConnectionMaxDefault = 10
	// ConnectionLifespanDefault is a default lifespan of a connection
	ConnectionLifespanDefault = 1 * time.Hour
	// FileSystemTimeoutDefault is a default timeout value
	FileSystemTimeoutDefault = 5 * time.Minute
)

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type Entry ¶ added in v0.5.2

type Entry struct {
	ID         int64
	Type       EntryType
	Name       string
	Path       string
	Owner      string
	Size       int64
	DataType   string
	CreateTime time.Time
	ModifyTime time.Time
	CheckSum   string
}

Entry is a struct for filesystem entry

func (*Entry) ToString ¶ added in v0.5.2

func (entry *Entry) ToString() string

ToString stringifies the object

type EntryType ¶ added in v0.5.2

type EntryType string

EntryType defines types of Entry

const (
	// FileEntry is a Entry type for a file
	FileEntry EntryType = "file"
	// DirectoryEntry is a Entry type for a directory
	DirectoryEntry EntryType = "directory"
)

type FileHandle ¶

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

FileHandle is a handle for a file opened

func (*FileHandle) Close ¶

func (handle *FileHandle) Close() error

Close closes the file

func (*FileHandle) GetEntry ¶ added in v0.7.5

func (handle *FileHandle) GetEntry() *Entry

GetEntry returns Entry info

func (*FileHandle) GetID ¶ added in v0.7.5

func (handle *FileHandle) GetID() string

GetID returns ID

func (*FileHandle) GetIRODSFileHandle ¶ added in v0.7.5

func (handle *FileHandle) GetIRODSFileHandle() *types.IRODSFileHandle

GetIRODSFileHandle returns iRODS File Handle file

func (*FileHandle) GetOffset ¶

func (handle *FileHandle) GetOffset() int64

GetOffset returns current offset

func (*FileHandle) GetOpenMode ¶ added in v0.7.5

func (handle *FileHandle) GetOpenMode() types.FileOpenMode

GetOpenMode returns file open mode

func (*FileHandle) IsReadMode ¶

func (handle *FileHandle) IsReadMode() bool

IsReadMode returns true if file is opened with read mode

func (*FileHandle) IsReadOnlyMode ¶ added in v0.7.6

func (handle *FileHandle) IsReadOnlyMode() bool

IsReadOnlyMode returns true if file is opened with read only mode

func (*FileHandle) IsWriteMode ¶

func (handle *FileHandle) IsWriteMode() bool

IsWriteMode returns true if file is opened with write mode

func (*FileHandle) IsWriteOnlyMode ¶ added in v0.7.6

func (handle *FileHandle) IsWriteOnlyMode() bool

IsWriteOnlyMode returns true if file is opened with write only mode

func (*FileHandle) Lock ¶ added in v0.7.5

func (handle *FileHandle) Lock()

Lock locks the handle

func (*FileHandle) Read ¶

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

Read reads the file, implements io.Reader.Read

func (*FileHandle) ReadAt ¶ added in v0.5.5

func (handle *FileHandle) ReadAt(buffer []byte, offset int64) (int, error)

ReadAt reads data from given offset

func (*FileHandle) Seek ¶

func (handle *FileHandle) Seek(offset int64, whence int) (int64, error)

Seek moves file pointer

func (*FileHandle) ToString ¶

func (handle *FileHandle) ToString() string

ToString stringifies the object

func (*FileHandle) Truncate ¶ added in v0.7.0

func (handle *FileHandle) Truncate(size int64) error

Truncate truncates the file

func (*FileHandle) Unlock ¶ added in v0.7.5

func (handle *FileHandle) Unlock()

Unlock unlocks the handle

func (*FileHandle) Write ¶

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

Write writes the file

func (*FileHandle) WriteAt ¶ added in v0.5.5

func (handle *FileHandle) WriteAt(data []byte, offset int64) (int, error)

WriteAt writes the file to given offset

type FileHandleMap ¶ added in v0.7.5

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

FileHandleMap manages File Handles opened

func NewFileHandleMap ¶ added in v0.7.5

func NewFileHandleMap() *FileHandleMap

NewFileHandleMap creates a new FileHandleMap

func (*FileHandleMap) Add ¶ added in v0.7.5

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

Add registers a file handle

func (*FileHandleMap) AddCloseEventHandler ¶ added in v0.9.3

func (fileHandleMap *FileHandleMap) AddCloseEventHandler(path string, handler FileHandleMapEventHandler) string

AddCloseEventHandler registers an event handler for file close

func (*FileHandleMap) Clear ¶ added in v0.7.5

func (fileHandleMap *FileHandleMap) Clear()

Clear clears all file handles registered

func (*FileHandleMap) Get ¶ added in v0.7.5

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

Get returns a file handle registered using ID

func (*FileHandleMap) List ¶ added in v0.7.5

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

List lists all file handles registered

func (*FileHandleMap) ListByPath ¶ added in v0.7.5

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

ListByPath returns file handles registered using path

func (*FileHandleMap) ListPathsInDir ¶ added in v0.7.5

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

ListPathsUnderDir returns paths of file handles under given parent path

func (*FileHandleMap) Pop ¶ added in v0.7.5

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

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

func (*FileHandleMap) PopAll ¶ added in v0.7.5

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

PopAll pops all file handles registered (clear) and returns

func (*FileHandleMap) PopByPath ¶ added in v0.7.5

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

PopByPath pops file handles registered using path and returns the handles

func (*FileHandleMap) Remove ¶ added in v0.7.5

func (fileHandleMap *FileHandleMap) Remove(id string)

Remove deletes a file handle registered using ID

func (*FileHandleMap) RemoveCloseEventHandler ¶ added in v0.9.3

func (fileHandleMap *FileHandleMap) RemoveCloseEventHandler(handlerID string)

RemoveCloseEventHandler deregisters an event handler for file close

type FileHandleMapEventHandler ¶ added in v0.9.3

type FileHandleMapEventHandler func(path string, id string, empty bool)

FileHandleMapEventHandler is a event handler for FileHandleMap

type FileHandleMapEventHandlerWrap ¶ added in v0.9.3

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

type FileLock ¶ added in v0.7.0

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

FileLock is a lock for a file

type FileLocks ¶ added in v0.7.0

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

FileLocks manages file locks

func NewFileLocks ¶ added in v0.7.0

func NewFileLocks() *FileLocks

NewFileLocks creates a new FileLocks

func (*FileLocks) Lock ¶ added in v0.7.0

func (mgr *FileLocks) Lock(path string)

Lock locks a file

func (*FileLocks) LockFilesForPrefix ¶ added in v0.7.0

func (mgr *FileLocks) LockFilesForPrefix(pathPrefix string) []string

LockFilesForPrefix locks all files starting with the given prefix, does not create a new lock, but increases reference

func (*FileLocks) RLock ¶ added in v0.7.0

func (mgr *FileLocks) RLock(path string)

RLock locks a file with read mode

func (*FileLocks) RUnlock ¶ added in v0.7.0

func (mgr *FileLocks) RUnlock(path string) error

RUnlock unlocks a file with read mode

func (*FileLocks) Unlock ¶ added in v0.7.0

func (mgr *FileLocks) Unlock(path string) error

Unlock unlocks a file

func (*FileLocks) UnlockFiles ¶ added in v0.7.0

func (mgr *FileLocks) UnlockFiles(paths []string) error

UnlockFiles unlocks multiple files

type FileSystem ¶

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

FileSystem provides a file-system like interface

func NewFileSystem ¶

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

NewFileSystem creates a new FileSystem

func NewFileSystemWithDefault ¶

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

NewFileSystemWithDefault creates a new FileSystem with default configurations

func NewFileSystemWithSessionConfig ¶ added in v0.5.5

func NewFileSystemWithSessionConfig(account *types.IRODSAccount, sessConfig *session.IRODSSessionConfig) (*FileSystem, error)

NewFileSystemWithSessionConfig creates a new FileSystem with custom session configurations

func (*FileSystem) AddMetadata ¶ added in v0.4.0

func (fs *FileSystem) AddMetadata(irodsPath string, attName string, attValue string, attUnits string) error

AddMetadata adds a metadata for the path

func (*FileSystem) AddUserMetadata ¶ added in v0.4.5

func (fs *FileSystem) AddUserMetadata(user string, avuid int64, attName, attValue, attUnits string) error

AddUserMetadata adds a user metadata

func (*FileSystem) ClearCache ¶

func (fs *FileSystem) ClearCache()

ClearCache clears all file system caches

func (*FileSystem) ConnectionTotal ¶ added in v0.9.7

func (fs *FileSystem) ConnectionTotal() int

ConnectionTotal counts current established connections

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, mode string) (*FileHandle, error)

CreateFile opens a new file for write

func (*FileSystem) DeleteMetadata ¶ added in v0.4.0

func (fs *FileSystem) DeleteMetadata(irodsPath string, attName string, attValue string, attUnits string) error

DeleteMetadata deletes a metadata for the path

func (*FileSystem) DeleteUserMetadata ¶ added in v0.4.5

func (fs *FileSystem) DeleteUserMetadata(user string, avuid int64, attName, attValue, attUnits string) error

DeleteUserMetadata deletes a user metadata

func (*FileSystem) DownloadFile ¶

func (fs *FileSystem) DownloadFile(irodsPath string, resource string, localPath string, callback irods_fs.TrackerCallBack) error

DownloadFile downloads a file to local

func (*FileSystem) DownloadFileParallel ¶ added in v0.5.2

func (fs *FileSystem) DownloadFileParallel(irodsPath string, resource string, localPath string, taskNum int, callback irods_fs.TrackerCallBack) error

DownloadFileParallel downloads a file to local in parallel

func (*FileSystem) DownloadFileParallelInBlocksAsync ¶ added in v0.5.2

func (fs *FileSystem) DownloadFileParallelInBlocksAsync(irodsPath string, resource string, localPath string, blockLength int64, taskNum int) (chan int64, chan error)

DownloadFileParallelInBlocksAsync downloads a file to local in parallel

func (*FileSystem) Exists ¶

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

Exists checks file/directory existence

func (*FileSystem) ExistsDir ¶

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

ExistsDir checks directory existence

func (*FileSystem) ExistsFile ¶

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

ExistsFile checks file existence

func (*FileSystem) ExtractStructFile ¶ added in v0.9.4

func (fs *FileSystem) ExtractStructFile(path string, targetCollection string, resource string, dataType types.DataType, force bool) error

ExtractStructFile extracts a struct file

func (*FileSystem) GetID ¶ added in v0.9.0

func (fs *FileSystem) GetID() string

GetID returns file system instance ID

func (*FileSystem) GetMetrics ¶ added in v0.9.7

func (fs *FileSystem) GetMetrics() *metrics.IRODSMetrics

GetMetrics returns metrics

func (*FileSystem) GetTicketForAnonymousAccess ¶ added in v0.7.0

func (fs *FileSystem) GetTicketForAnonymousAccess(ticket string) (*types.IRODSTicketForAnonymousAccess, error)

GetTicketForAnonymousAccess gets ticket information for anonymous access

func (*FileSystem) List ¶

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

List lists all file system entries under the given path

func (*FileSystem) ListACLs ¶ added in v0.3.0

func (fs *FileSystem) ListACLs(path string) ([]*types.IRODSAccess, error)

ListACLs returns ACLs

func (*FileSystem) ListACLsForEntries ¶ added in v0.9.4

func (fs *FileSystem) ListACLsForEntries(path string) ([]*types.IRODSAccess, error)

ListACLsForEntries returns ACLs for entries in a collection

func (*FileSystem) ListACLsWithGroupUsers ¶ added in v0.3.0

func (fs *FileSystem) ListACLsWithGroupUsers(path string) ([]*types.IRODSAccess, error)

ListACLsWithGroupUsers returns ACLs

func (*FileSystem) ListAllProcesses ¶ added in v0.9.7

func (fs *FileSystem) ListAllProcesses() ([]*types.IRODSProcess, error)

ListGroups lists all groups

func (*FileSystem) ListDirACLs ¶ added in v0.3.0

func (fs *FileSystem) ListDirACLs(path string) ([]*types.IRODSAccess, error)

ListDirACLs returns ACLs of a directory

func (*FileSystem) ListDirACLsWithGroupUsers ¶ added in v0.3.0

func (fs *FileSystem) ListDirACLsWithGroupUsers(path string) ([]*types.IRODSAccess, error)

ListDirACLsWithGroupUsers returns ACLs of a directory CAUTION: this can fail if a group contains a lot of users

func (*FileSystem) ListFileACLs ¶ added in v0.3.0

func (fs *FileSystem) ListFileACLs(path string) ([]*types.IRODSAccess, error)

ListFileACLs returns ACLs of a file

func (*FileSystem) ListFileACLsWithGroupUsers ¶ added in v0.3.0

func (fs *FileSystem) ListFileACLsWithGroupUsers(path string) ([]*types.IRODSAccess, error)

ListFileACLsWithGroupUsers returns ACLs of a file

func (*FileSystem) ListGroupUsers ¶ added in v0.3.0

func (fs *FileSystem) ListGroupUsers(group string) ([]*types.IRODSUser, error)

ListGroupUsers lists all users in a group

func (*FileSystem) ListGroups ¶ added in v0.4.5

func (fs *FileSystem) ListGroups() ([]*types.IRODSUser, error)

ListGroups lists all groups

func (*FileSystem) ListMetadata ¶ added in v0.4.0

func (fs *FileSystem) ListMetadata(path string) ([]*types.IRODSMeta, error)

ListMetadata lists metadata for the given path

func (*FileSystem) ListProcesses ¶ added in v0.9.7

func (fs *FileSystem) ListProcesses(address string, zone string) ([]*types.IRODSProcess, error)

ListProcesses lists all processes

func (*FileSystem) ListUserGroups ¶ added in v0.5.9

func (fs *FileSystem) ListUserGroups(user string) ([]*types.IRODSUser, error)

ListUserGroups lists all groups that a user belongs to

func (*FileSystem) ListUserMetadata ¶ added in v0.4.5

func (fs *FileSystem) ListUserMetadata(user string) ([]*types.IRODSMeta, error)

ListUserMetadata lists all user metadata

func (*FileSystem) ListUsers ¶ added in v0.4.5

func (fs *FileSystem) ListUsers() ([]*types.IRODSUser, error)

ListUsers lists all users

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 releases all resources

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) SearchByMeta ¶ added in v0.4.3

func (fs *FileSystem) SearchByMeta(metaname string, metavalue string) ([]*Entry, error)

SearchByMeta searches all file system entries with given metadata

func (*FileSystem) Stat ¶

func (fs *FileSystem) Stat(p string) (*Entry, error)

Stat returns file status

func (*FileSystem) StatDir ¶

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

StatDir returns status of a directory

func (*FileSystem) StatFile ¶

func (fs *FileSystem) StatFile(path string) (*Entry, 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, callback irods_fs.TrackerCallBack) error

UploadFile uploads a local file to irods

func (*FileSystem) UploadFileParallel ¶ added in v0.5.2

func (fs *FileSystem) UploadFileParallel(localPath string, irodsPath string, resource string, taskNum int, replicate bool, callback irods_fs.TrackerCallBack) error

UploadFileParallel uploads a local file to irods in parallel

func (*FileSystem) UploadFileParallelInBlocksAsync ¶ added in v0.5.2

func (fs *FileSystem) UploadFileParallelInBlocksAsync(localPath string, irodsPath string, resource string, blockLength int64, taskNum int, replicate bool) (chan int64, chan error)

UploadFileParallelInBlocksAsync uploads a local file to irods in parallel

type FileSystemCache ¶

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

FileSystemCache manages filesystem caches

func NewFileSystemCache ¶

func NewFileSystemCache(cacheTimeout time.Duration, cleanup time.Duration, cacheTimeoutSettings []MetadataCacheTimeoutSetting, invalidateParentEntryCacheImmediately bool) *FileSystemCache

NewFileSystemCache creates a new FileSystemCache

func (*FileSystemCache) AddACLsCache ¶ added in v0.9.4

func (cache *FileSystemCache) AddACLsCache(path string, accesses []*types.IRODSAccess)

AddACLsCache adds a ACLs cache

func (*FileSystemCache) AddACLsCacheMulti ¶ added in v0.9.4

func (cache *FileSystemCache) AddACLsCacheMulti(accesses []*types.IRODSAccess)

AddACLsCache adds multiple ACLs caches

func (*FileSystemCache) AddDirCache ¶

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

AddDirCache adds a dir cache

func (*FileSystemCache) AddEntryCache ¶

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

AddEntryCache adds an entry cache

func (*FileSystemCache) AddGroupUsersCache ¶ added in v0.3.0

func (cache *FileSystemCache) AddGroupUsersCache(group string, users []*types.IRODSUser)

AddGroupUsersCache adds a group user (users in a group) cache

func (*FileSystemCache) AddGroupsCache ¶ added in v0.4.5

func (cache *FileSystemCache) AddGroupsCache(groups []*types.IRODSUser)

AddGroupsCache adds a groups cache (cache of a list of all groups)

func (*FileSystemCache) AddMetadataCache ¶ added in v0.4.0

func (cache *FileSystemCache) AddMetadataCache(path string, metas []*types.IRODSMeta)

AddMetadataCache adds a metadata cache

func (*FileSystemCache) AddNegativeEntryCache ¶ added in v0.7.0

func (cache *FileSystemCache) AddNegativeEntryCache(path string)

AddNegativeEntryCache adds a negative entry cache

func (*FileSystemCache) AddUserGroupsCache ¶ added in v0.5.9

func (cache *FileSystemCache) AddUserGroupsCache(user string, groups []*types.IRODSUser)

AddUserGroupsCache adds a user's groups (groups that a user belongs to) cache

func (*FileSystemCache) AddUsersCache ¶ added in v0.4.5

func (cache *FileSystemCache) AddUsersCache(users []*types.IRODSUser)

AddUsersCache adds a users cache (cache of a list of all users)

func (*FileSystemCache) ClearACLsCache ¶ added in v0.9.4

func (cache *FileSystemCache) ClearACLsCache()

ClearACLsCache clears all ACLs caches

func (*FileSystemCache) ClearDirCache ¶

func (cache *FileSystemCache) ClearDirCache()

ClearDirCache clears all dir caches

func (*FileSystemCache) ClearEntryCache ¶

func (cache *FileSystemCache) ClearEntryCache()

ClearEntryCache clears all entry caches

func (*FileSystemCache) ClearMetadataCache ¶ added in v0.4.0

func (cache *FileSystemCache) ClearMetadataCache()

ClearMetadataCache clears all metadata caches

func (*FileSystemCache) ClearNegativeEntryCache ¶ added in v0.7.0

func (cache *FileSystemCache) ClearNegativeEntryCache()

ClearNegativeEntryCache clears all negative entry caches

func (*FileSystemCache) GetACLsCache ¶ added in v0.9.4

func (cache *FileSystemCache) GetACLsCache(path string) []*types.IRODSAccess

GetACLsCache retrives a ACLs cache

func (*FileSystemCache) GetDirCache ¶

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

GetDirCache retrives a dir cache

func (*FileSystemCache) GetEntryCache ¶

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

GetEntryCache retrieves an entry cache

func (*FileSystemCache) GetGroupUsersCache ¶ added in v0.3.0

func (cache *FileSystemCache) GetGroupUsersCache(group string) []*types.IRODSUser

GetGroupUsersCache retrives a group user (users in a group) cache

func (*FileSystemCache) GetGroupsCache ¶ added in v0.4.5

func (cache *FileSystemCache) GetGroupsCache() []*types.IRODSUser

GetGroupsCache retrives a groups cache (cache of a list of all groups)

func (*FileSystemCache) GetMetadataCache ¶ added in v0.4.0

func (cache *FileSystemCache) GetMetadataCache(path string) []*types.IRODSMeta

GetMetadataCache retrieves a metadata cache

func (*FileSystemCache) GetUserGroupsCache ¶ added in v0.5.9

func (cache *FileSystemCache) GetUserGroupsCache(user string) []*types.IRODSUser

GetUserGroupsCache retrives a user's groups (groups that a user belongs to) cache

func (*FileSystemCache) GetUsersCache ¶ added in v0.4.5

func (cache *FileSystemCache) GetUsersCache() []*types.IRODSUser

GetUsersCache retrives a users cache (cache of a list of all users)

func (*FileSystemCache) HasNegativeEntryCache ¶ added in v0.7.0

func (cache *FileSystemCache) HasNegativeEntryCache(path string) bool

HasNegativeEntryCache checks the existence of a negative entry cache

func (*FileSystemCache) RemoveACLsCache ¶ added in v0.9.4

func (cache *FileSystemCache) RemoveACLsCache(path string)

RemoveACLsCache removes a ACLs cache

func (*FileSystemCache) RemoveAllNegativeEntryCacheForPath ¶ added in v0.7.0

func (cache *FileSystemCache) RemoveAllNegativeEntryCacheForPath(path string)

RemoveAllNegativeEntryCacheForPath removes all negative entry caches

func (*FileSystemCache) RemoveDirCache ¶

func (cache *FileSystemCache) RemoveDirCache(path string)

RemoveDirCache removes a dir cache

func (*FileSystemCache) RemoveEntryCache ¶

func (cache *FileSystemCache) RemoveEntryCache(path string)

RemoveEntryCache removes an entry cache

func (*FileSystemCache) RemoveGroupUsersCache ¶ added in v0.3.0

func (cache *FileSystemCache) RemoveGroupUsersCache(group string)

RemoveGroupUsersCache removes a group user (users in a group) cache

func (*FileSystemCache) RemoveGroupsCache ¶ added in v0.4.5

func (cache *FileSystemCache) RemoveGroupsCache()

RemoveGroupsCache removes a groups cache (cache of a list of all groups)

func (*FileSystemCache) RemoveMetadataCache ¶ added in v0.4.0

func (cache *FileSystemCache) RemoveMetadataCache(path string)

RemoveMetadataCache removes a metadata cache

func (*FileSystemCache) RemoveNegativeEntryCache ¶ added in v0.7.0

func (cache *FileSystemCache) RemoveNegativeEntryCache(path string)

RemoveNegativeEntryCache removes a negative entry cache

func (*FileSystemCache) RemoveParentDirCache ¶ added in v0.7.0

func (cache *FileSystemCache) RemoveParentDirCache(path string)

RemoveParentDirCache removes an entry cache for the parent path of the given path

func (*FileSystemCache) RemoveUserGroupsCache ¶ added in v0.5.9

func (cache *FileSystemCache) RemoveUserGroupsCache(user string)

RemoveUserGroupsCache removes a user's groups (groups that a user belongs to) cache

func (*FileSystemCache) RemoveUsersCache ¶ added in v0.4.5

func (cache *FileSystemCache) RemoveUsersCache()

RemoveUsersCache removes a users cache (cache of a list of all users)

type FileSystemCachePropagation ¶ added in v0.9.0

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

FileSystemCachePropagation manages filesystem cache propagation

func NewFileSystemCachePropagation ¶ added in v0.9.0

func NewFileSystemCachePropagation(fs *FileSystem) *FileSystemCachePropagation

NewFileSystemCachePropagation creates a new FileSystemCachePropagation

func (*FileSystemCachePropagation) Propagate ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) Propagate(path string, eventType FilesystemCacheUpdateEventType)

Propagate propagates fs cache update event

func (*FileSystemCachePropagation) PropagateDirCreate ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) PropagateDirCreate(path string)

PropagateDirCreate propagates fs cache update event for dir create

func (*FileSystemCachePropagation) PropagateDirRemove ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) PropagateDirRemove(path string)

PropagateDirRemove propagates fs cache update event for dir remove

func (*FileSystemCachePropagation) PropagateFileCreate ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) PropagateFileCreate(path string)

PropagateFileCreate propagates fs cache update event for file create

func (*FileSystemCachePropagation) PropagateFileRemove ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) PropagateFileRemove(path string)

PropagateFileRemove propagates fs cache update event for file remove

func (*FileSystemCachePropagation) PropagateFileUpdate ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) PropagateFileUpdate(path string)

PropagateFileUpdate propagates fs cache update event for file update

func (*FileSystemCachePropagation) Release ¶ added in v0.9.0

func (propagation *FileSystemCachePropagation) Release()

type FileSystemConfig ¶

type FileSystemConfig struct {
	ApplicationName       string
	ConnectionLifespan    time.Duration
	OperationTimeout      time.Duration
	ConnectionIdleTimeout time.Duration
	ConnectionMax         int
	CacheTimeout          time.Duration
	CacheCleanupTime      time.Duration
	CacheTimeoutSettings  []MetadataCacheTimeoutSetting
	// for mysql iCAT backend, this should be true.
	// for postgresql iCAT backend, this can be false.
	StartNewTransaction bool
	// determine if we will invalidate parent dir's entry cache
	// at subdir/file creation/deletion
	// turn to false to allow short cache inconsistency
	InvalidateParentEntryCacheImmediately bool
}

FileSystemConfig is a struct for file system configuration

func NewFileSystemConfig ¶

func NewFileSystemConfig(applicationName string, connectionLifespan time.Duration, operationTimeout time.Duration, connectionIdleTimeout time.Duration, connectionMax int, cacheTimeout time.Duration, cacheCleanupTime time.Duration, cacheTimeoutSettings []MetadataCacheTimeoutSetting, startNewTransaction bool, invalidateParentEntryCacheImmediately bool) *FileSystemConfig

NewFileSystemConfig create a FileSystemConfig

func NewFileSystemConfigWithDefault ¶

func NewFileSystemConfigWithDefault(applicationName string) *FileSystemConfig

NewFileSystemConfigWithDefault create a FileSystemConfig with a default settings

type FilesystemCacheUpdateEventType ¶ added in v0.9.0

type FilesystemCacheUpdateEventType string

FilesystemCacheUpdateEventType defines cache

const (
	// FilesystemCacheFileCreateEvent is an event type for file creation
	FilesystemCacheFileCreateEvent FilesystemCacheUpdateEventType = "file create"
	// FilesystemCacheFileRemoveEvent is an event type for file removal
	FilesystemCacheFileRemoveEvent FilesystemCacheUpdateEventType = "file remove"
	// FilesystemCacheFileUpdateEvent is an event type for file update
	FilesystemCacheFileUpdateEvent FilesystemCacheUpdateEventType = "file update"
	// FilesystemCacheDirCreateEvent is an event type for dir creation
	FilesystemCacheDirCreateEvent FilesystemCacheUpdateEventType = "dir create"
	// FilesystemCacheDirRemoveEvent is an event type for dir removal
	FilesystemCacheDirRemoveEvent FilesystemCacheUpdateEventType = "dir remove"
)

type FilesystemCacheUpdatedFunc ¶ added in v0.9.0

type FilesystemCacheUpdatedFunc func(path string, eventType FilesystemCacheUpdateEventType)

these are used to sync caches between different fs instances

type MetadataCacheTimeoutSetting ¶ added in v0.6.1

type MetadataCacheTimeoutSetting struct {
	Path    string
	Timeout time.Duration
	Inherit bool
}

MetadataCacheTimeoutSetting defines cache timeout for path

Jump to

Keyboard shortcuts

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