binlog

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinLogger

type BinLogger interface {
	// TruncateFront add next time
	//  @Description:
	//  @param index
	//  @return error
	TruncateFront(index uint64) error

	// ReadLastSegSection add next time
	//  @Description:
	//  @param index
	//  @return data
	//  @return fileName
	//  @return offset
	//  @return blkLen
	//  @return err
	ReadLastSegSection(index uint64, forceFetch bool) (data []byte, fileName string, offset, blkLen uint64, err error)

	// LastIndex add next time
	//  @Description:
	//  @return index
	//  @return err
	LastIndex() (index uint64, err error)

	// Write add next time
	//  @Description:
	//  @param index
	//  @param data
	//  @return fileName
	//  @return offset
	//  @return blkLen
	//  @return err
	Write(index uint64, data []byte) (fileName string, offset, blkLen uint64, err error)

	// ReadFileSection read data, according to file index
	// @Description:
	// @param fiIndex
	// @param timeOut
	// @return []byte
	// @return error
	ReadFileSection(fiIndex *storePb.StoreInfo, timeOut time.Duration) ([]byte, error)

	// DropOpenedFileCache drop opened file handle cache
	// @Description:
	// @param path
	// @return bool
	DropOpenedFileCache(path string) bool

	// CheckFileExist check file exist
	// @Description:
	// @param fiIndex
	// @return bool
	// @return error
	CheckFileExist(fiIndex *storePb.StoreInfo) (bool, error)

	// Close add next time
	//  @Description:
	//  @return error
	Close() error
}

BinLogger add next time @Description:

type MemBinlog

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

MemBinlog add next time

@Description:

func NewMemBinlog

func NewMemBinlog(log protocol.Logger) *MemBinlog

NewMemBinlog 创建一个内存binlog

@Description:
@param log
@return *MemBinlog

func (*MemBinlog) CheckFileExist added in v3.0.1

func (l *MemBinlog) CheckFileExist(fiIndex *storePb.StoreInfo) (bool, error)

CheckFileExist check file exist

@receiver l

@Description: @param fiIndex @return bool @return error

func (*MemBinlog) Close

func (l *MemBinlog) Close() error

Close 关闭

@Description:
@receiver l
@return error

func (*MemBinlog) DropOpenedFileCache added in v3.0.1

func (l *MemBinlog) DropOpenedFileCache(_ string) bool

DropOpenedFileCache drop opened file handle cache @Description: @receiver l @param _ @return bool

func (*MemBinlog) LastIndex

func (l *MemBinlog) LastIndex() (uint64, error)

LastIndex 返回最后写入的索引

@Description:
@receiver l
@return uint64
@return error

func (*MemBinlog) ReadFileSection

func (l *MemBinlog) ReadFileSection(fiIndex *storePb.StoreInfo, _ time.Duration) ([]byte, error)

ReadFileSection 根据索引,读取对应数据

@Description:
@receiver l
@param fiIndex
@return []byte
@return error

func (*MemBinlog) ReadLastSegSection

func (l *MemBinlog) ReadLastSegSection(index uint64, _ bool) ([]byte, string, uint64, uint64, error)

ReadLastSegSection 读取最后的segment

@Description:
@receiver l
@param index
@return []byte
@return string
@return uint64
@return uint64
@return error

func (*MemBinlog) TruncateFront

func (l *MemBinlog) TruncateFront(index uint64) error

TruncateFront 指定index 清空

@Description:
@receiver l
@param index
@return error

func (*MemBinlog) Write

func (l *MemBinlog) Write(index uint64, data []byte) (fileName string, offset, blkLen uint64, err error)

Write 写一个区块到内存中

@Description:
@receiver l
@param index
@param data
@return fileName
@return offset
@return blkLen
@return err

Jump to

Keyboard shortcuts

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