Documentation ¶
Index ¶
- type FlatFile
- type FlatFileManager
- func (f *FlatFileManager) Append(data []byte) (uint64, error)
- func (ff *FlatFileManager) FileSize() uint64
- func (f *FlatFileManager) PasreFile(fileID uint64) (map[uint64]ReadInfo, error)
- func (ff *FlatFileManager) Path() string
- func (f FlatFileManager) Read(index uint64) ([]byte, error)
- func (f FlatFileManager) ReadFromIndex(index uint64) (chan []byte, chan uint64, func())
- func (ff *FlatFileManager) Size() uint64
- func (ff *FlatFileManager) Truncate(lastIndex uint64) error
- type ReadInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlatFile ¶
type FlatFile interface { //append item uint64o flat file, return item index Append([]byte) (uint64, error) //read item in flatfile with specific index (return from append) Read(index uint64) ([]byte, error) //read recent data, return data channel, errpr channel, and cancel function ReadFromIndex(index uint64) (chan []byte, chan uint64, func()) //truncate flat file system Truncate(lastIndex uint64) error //return current size of ff Size() uint64 //Path Path() string FileSize() uint64 }
type FlatFileManager ¶
type FlatFileManager struct {
// contains filtered or unexported fields
}
func NewFlatFile ¶
func NewFlatFile(dir string, fileBound uint64) (*FlatFileManager, error)
func (*FlatFileManager) FileSize ¶
func (ff *FlatFileManager) FileSize() uint64
func (*FlatFileManager) PasreFile ¶
func (f *FlatFileManager) PasreFile(fileID uint64) (map[uint64]ReadInfo, error)
func (*FlatFileManager) Path ¶
func (ff *FlatFileManager) Path() string
func (FlatFileManager) ReadFromIndex ¶
func (f FlatFileManager) ReadFromIndex(index uint64) (chan []byte, chan uint64, func())
func (*FlatFileManager) Size ¶
func (ff *FlatFileManager) Size() uint64
func (*FlatFileManager) Truncate ¶
func (ff *FlatFileManager) Truncate(lastIndex uint64) error
Click to show internal directories.
Click to hide internal directories.