file

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncDir

func SyncDir(dir string) error

Types

type MmapFile

type MmapFile struct {
	Fd     *os.File
	Buf    []byte
	BufLen int64
}

func OpenMmapFile

func OpenMmapFile(fileName string, flag int, maxSz int32) (*MmapFile, error)

func (*MmapFile) AppendBuffer

func (m *MmapFile) AppendBuffer(offset uint32, buf []byte) error

func (*MmapFile) Bytes

func (m *MmapFile) Bytes(off, sz int) ([]byte, error)

func (*MmapFile) Close

func (m *MmapFile) Close() error

func (*MmapFile) Delete

func (m *MmapFile) Delete() error

func (*MmapFile) NewReader

func (m *MmapFile) NewReader(offset int) io.Reader

func (*MmapFile) Read

func (m *MmapFile) Read(b []byte, offset int64) (int, error)

Read copy data from mapped region(buf) into slice b at offset.

func (*MmapFile) Sync

func (m *MmapFile) Sync() error

Sync synchronize the mapped buffer to the file's contents on disk.

func (*MmapFile) Truncature

func (m *MmapFile) Truncature(maxSz int64) error

type VLogFile

type VLogFile struct {
	FID uint32

	Lock sync.RWMutex
	// contains filtered or unexported fields
}

func (*VLogFile) Close

func (vlog *VLogFile) Close() error

func (*VLogFile) DecodeEntry

func (vlog *VLogFile) DecodeEntry(buf []byte, offset uint32) (*model.Entry, error)

func (*VLogFile) DoneWriting

func (vlog *VLogFile) DoneWriting(offset uint32) error

func (*VLogFile) EncodeEntry

func (vlog *VLogFile) EncodeEntry(entry *model.Entry, out *bytes.Buffer) (int, error)

EncodeEntry will encode entry to the buf layout of entry +--------+-----+-------+-------+ | header | key | value | crc32 | +--------+-----+-------+-------+

func (*VLogFile) FD

func (vlog *VLogFile) FD() *os.File

func (*VLogFile) FileName

func (vlog *VLogFile) FileName() string

func (*VLogFile) Init

func (vlog *VLogFile) Init() error

func (*VLogFile) Open

func (vlog *VLogFile) Open(opt *utils.FileOptions) error

func (*VLogFile) Read

func (vlog *VLogFile) Read(vptr *model.ValuePtr) (buf []byte, err error)

func (*VLogFile) Seek

func (vlog *VLogFile) Seek(offset int64, whence int) (ret int64, err error)

func (*VLogFile) SetSize

func (vlog *VLogFile) SetSize(offset uint32)

func (*VLogFile) Size

func (vlog *VLogFile) Size() int64

func (*VLogFile) Sync

func (vlog *VLogFile) Sync() error

Sync You must hold lf.lock to sync()

func (*VLogFile) Truncate

func (vlog *VLogFile) Truncate(offset int64) error

func (*VLogFile) Write

func (vlog *VLogFile) Write(offset uint32, buf []byte) (err error)

Jump to

Keyboard shortcuts

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