flatfile

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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) Append

func (f *FlatFileManager) Append(data []byte) (uint64, 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) Read

func (f FlatFileManager) Read(index uint64) ([]byte, error)

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

type ReadInfo

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

Jump to

Keyboard shortcuts

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