binlog

package
v0.0.0-...-197f44b Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL_BINLOG_MANAGER   XBinlogManagerType = 1
	SYNC_BINLOG_MANAGER    XBinlogManagerType = 2
	TRACKER_BINLOG_MANAGER XBinlogManagerType = 3
	MAX_BINLOG_SIZE        int                = 2 << 20 // 200w binlog records
	LOCAL_BINLOG_SIZE                         = 102     // single binlog size.
)

Variables

This section is empty.

Functions

func Copy8

func Copy8(src []byte) [8]byte

func CreateLocalBinlog

func CreateLocalBinlog(fileId string, fileLength int64, instanceId string) *common.BingLog

CreateLocalBinlog builds an Binlog.

func TryFixBinlogFile

func TryFixBinlogFile() error

TryFixBinlogFile tries to fix binlog file by appending '\n' to current binlog file in every boot.

Types

type XBinlogManager

type XBinlogManager interface {

	// GetType returns this manager type.
	//
	// manager type could be one of:
	// `LOCAL_BINLOG_MANAGER`,
	// `SYNC_BINLOG_MANAGER`,
	// `TRACKER_BINLOG_MANAGER`
	GetType() XBinlogManagerType

	// GetCurrentIndex gets current binlog file index.
	GetCurrentIndex() int

	// Write writes a binlog to file.
	Write(bin ...*common.BingLog) error

	// Read reads binlog from file.
	//
	//  fileIndex: the binlog file index, -1 means reads from latest binlog file.
	//  offset: read offset in bytes, must be integer multiple of the binlog.
	Read(fileIndex int, offset int64, fetchLine int) ([]common.BingLogDTO, int64, error)
}

XBinlogManager is an interface for binlog manager.

func NewXBinlogManager

func NewXBinlogManager(managerType XBinlogManagerType) XBinlogManager

NewXBinlogManager creates a new binlog manager.

type XBinlogManagerType

type XBinlogManagerType byte

type XBinlogMapManager

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

func (*XBinlogMapManager) GetRecords

func (m *XBinlogMapManager) GetRecords(fileIndex int) (size int, err error)

GetRecords get binlog record size by binlog file index.

func (*XBinlogMapManager) SetRecords

func (m *XBinlogMapManager) SetRecords(fileIndex int, value int) (err error)

Jump to

Keyboard shortcuts

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