util

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidFileHandleErrMsg                   = "invalid file handle"
	InvalidFileDownloadJobErrMsg              = "invalid download job"
	InvalidCacheHandleErrMsg                  = "invalid cache handle"
	InvalidFileInfoCacheErrMsg                = "invalid file info cache"
	ErrInSeekingFileHandleMsg                 = "error while seeking file handle"
	ErrInReadingFileHandleMsg                 = "error while reading file handle"
	FallbackToGCSErrMsg                       = "read via gcs"
	FileNotPresentInCacheErrMsg               = "file is not present in cache"
	CacheHandleNotRequiredForRandomReadErrMsg = "cacheFileForRangeRead is false, read type random read and fileInfo entry is absent"
)
View Source
const (
	MiB             = 1024 * 1024
	KiB             = 1024
	DefaultFilePerm = os.FileMode(0600)
	DefaultDirPerm  = os.FileMode(0700)
	FileCache       = "gcsfuse-file-cache"
)

Variables

This section is empty.

Functions

func CreateCacheDirectoryIfNotPresentAt

func CreateCacheDirectoryIfNotPresentAt(dirPath string, dirPerm os.FileMode) error

CreateCacheDirectoryIfNotPresentAt Creates directory at given path with provided permissions in case not already present, returns error in case unable to create directory or directory is not writable.

func CreateFile

func CreateFile(fileSpec data.FileSpec, flag int) (file *os.File, err error)

CreateFile creates file with given file spec i.e. permissions and returns file handle for that file opened with given flag.

Note: If directories in path are not present, they are created with directory permissions provided in fileSpec permission.

func GetDownloadPath

func GetDownloadPath(cacheDir string, objectPath string) string

GetDownloadPath gives file path to file in cache for given object path.

func GetObjectPath

func GetObjectPath(bucketName string, objectName string) string

GetObjectPath gives object path which is concatenation of bucket and object name separated by "/".

func IsCacheHandleInvalid

func IsCacheHandleInvalid(readErr error) bool

IsCacheHandleInvalid says either the current cacheHandle is invalid or not, based on the error we got while reading with the cacheHandle. If it's invalid then we should close that cacheHandle and create new cacheHandle for next call onwards.

Types

This section is empty.

Jump to

Keyboard shortcuts

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