chain_file_manager

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: GPL-3.0 Imports: 13 Imported by: 8

Documentation

Index

Constants

View Source
const (
	LocationSize = 12
)

Variables

This section is empty.

Functions

func NewFdByBuffer

func NewFdByBuffer(fdSet *fdManager, cacheItem *fileCacheItem) *fileDescription

func NewFdByFile

func NewFdByFile(file *os.File) *fileDescription

Types

type DataParser

type DataParser interface {
	Write([]byte) error
	WriteError(err error)
	Close() error
}

type FileManager

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

func NewFileManager

func NewFileManager(dirName string, fileSize int64, cacheCount int) (*FileManager, error)

func (*FileManager) Close

func (fm *FileManager) Close() error

func (*FileManager) DeleteTo

func (fm *FileManager) DeleteTo(location *Location) error

func (*FileManager) Flush

func (fm *FileManager) Flush(startLocation *Location, targetLocation *Location, buf []byte) error

func (*FileManager) GetCacheStatusList

func (fm *FileManager) GetCacheStatusList() []interfaces.DBStatus

func (*FileManager) GetNextLocation

func (fm *FileManager) GetNextLocation(location *Location) (*Location, error)

func (*FileManager) LatestLocation

func (fm *FileManager) LatestLocation() *Location

func (*FileManager) NextFlushStartLocation

func (fm *FileManager) NextFlushStartLocation() *Location

func (*FileManager) Read

func (fm *FileManager) Read(location *Location) ([]byte, *Location, error)

func (*FileManager) ReadRange

func (fm *FileManager) ReadRange(startLocation *Location, endLocation *Location, parser DataParser)

func (*FileManager) ReadRaw

func (fm *FileManager) ReadRaw(startLocation *Location, buf []byte) (*Location, int, error)

func (*FileManager) SetLog

func (fm *FileManager) SetLog(h log15.Handler)

func (*FileManager) SetNextFlushStartLocation

func (fm *FileManager) SetNextFlushStartLocation(location *Location)

func (*FileManager) Write

func (fm *FileManager) Write(buf []byte) (*Location, error)

type Location

type Location struct {
	FileId uint64
	Offset int64
}

func NewLocation

func NewLocation(fileId uint64, offset int64) *Location

func (*Location) Compare

func (location *Location) Compare(a *Location) int

func (*Location) Distance

func (location *Location) Distance(fileSize int64, backLocation *Location) int64

Jump to

Keyboard shortcuts

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