Documentation ¶
Index ¶
Constants ¶
View Source
const FilePerm = 0644
FilePerm default permission of the newly created log file.
Variables ¶
View Source
var ErrInvalidFsize = errors.New("fsize can`t be zero or negative")
ErrInvalidFsize invalid file size.
Functions ¶
This section is empty.
Types ¶
type FileIOController ¶
type FileIOController struct {
// contains filtered or unexported fields
}
FileIOController represents using standard file I/O.
func (*FileIOController) Close ¶
func (f *FileIOController) Close() error
func (*FileIOController) Delete ¶
func (f *FileIOController) Delete() error
func (*FileIOController) Read ¶
func (f *FileIOController) Read(b []byte, offset int64) (int, error)
func (*FileIOController) Sync ¶
func (f *FileIOController) Sync() error
type IOController ¶
type IOController interface { // Write a slice to log file at offset. // It returns the number of bytes written and any error encountered. Write(b []byte, offset int64) (int, error) // Read a slice from offset. // It returns the number of bytes read and any error encountered. Read(b []byte, offset int64) (int, error) // Sync commits the current contents of the file from memory to stable storage. Sync() error // Close closes the File. Close() error // Delete delete the file. Delete() error }
func NewFileIOController ¶
func NewFileIOController(fName string, fsize int64) (IOController, error)
NewFileIOController creates a new file io selector.
func NewMMapController ¶
func NewMMapController(fName string, fsize int64) (IOController, error)
NewMMapController creates a new MMap controller
type MMapController ¶
type MMapController struct {
// contains filtered or unexported fields
}
MMapController represents using memory map I/O.
func (*MMapController) Read ¶
func (m *MMapController) Read(b []byte, offset int64) (int, error)
Read reads mapped region at offset into slice b
func (*MMapController) Sync ¶
func (m *MMapController) Sync() error
Sync synchronize the mapped buffer to the file's contents on disk.
Click to show internal directories.
Click to hide internal directories.