Documentation ¶
Overview ¶
Package fs contains functionalities of reader and writer for a file
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFilesystemFilepathIsEmpty = errors.New("package fs - could not create new file system instance - path is empty") ErrFilesystemMemoryRentConflictWithFlushSize = errors.New("package fs - filesystem memory rent size always should be greater than flush size") ErrFilesystemCouldNotWrite = errors.New("package fs - filesystem could not write") ErrFilesystemWriterNil = errors.New("package fs - writer instance of filesystem has been closed or doesn't initialized") ErrFilesystemWriterCouldNotSync = errors.New("package fs - writer instance of filesystem could not sync") ErrFilesystemCouldNotCloseWriter = errors.New("package fs - filesystem could not close writer instance") ErrFilesystemReaderOccupying = errors.New("package fs - filesystem doesn't have any free reader") ErrFilesystemCouldNotReadData = errors.New("package fs - filesystem could not read data") ErrFilesystemCouldNotReadAllData = errors.New("package fs - filesystem could not read all data") ErrFilesystemReaderNil = errors.New("package fs - reader instance of filesystem has been closed or doesn't initialized") ErrFilesystemCouldNotCloseReader = errors.New("package fs - filesystem could not close reader") )
Functions ¶
func CreateDirectory ¶
CreateDirectory will create directory recursively
func IsDirectoryExists ¶
func IsDirectoryExists(path string, statFunc Stat, isNotExistFunc IsNotExist) error
IsDirectoryExists checks directory exist or not
func IsFileExists ¶
IsFileExists checks file exist or not
Types ¶
type Filesystem ¶
type Filesystem interface { // Write will write or update raw data into file Write(rawData []byte, offset int64, seek int) error // Sync will sync data from in-memory to disk Sync() error // GetWriterId return id of writer instance GetWriterId() (uuid.UUID, error) // CloseWriter will close writer of filesystem instance CloseWriter() error // ReadData func provides reading data from file by defining custom pos & seek option ReadData(offset int64, length int, seek int) ([]byte, error) // ReadAllData func provides reading all data from file ReadAllData() ([]byte, error) // GetReaderId return id of reader instance GetReaderId() (uuid.UUID, error) // CloseReader func provides close reader of filesystem instance CloseReader() error // GetReaderState return state of reader instance GetReaderState() (bool, error) }
func NewFilesystem ¶
func NewFilesystem(fPath string, config fsConfig.FSConfiguration, file file.File, statFunc Stat, isNotExistFunc IsNotExist, mkdirAllFunc MkdirAll) (Filesystem, error)
NewFilesystem provide new instance of filesystem with readers and writer based on your configuration
type IsNotExist ¶
Click to show internal directories.
Click to hide internal directories.