biglogdb

package
v0.0.0-...-03c569e Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFilePtrSeekSize = 4 + 4 + 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BigLogDB

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

*

  • big log db

func NewBigLogDB

func NewBigLogDB(config *BigLogDBConfig) (*BigLogDB, error)

create DataBase

func NewBigLogDBByLevelDB

func NewBigLogDBByLevelDB(config *BigLogDBConfig, keySubfix string, ldb *leveldb.DB) (*BigLogDB, error)

create DataBase

func (*BigLogDB) Close

func (db *BigLogDB) Close()

func (*BigLogDB) GetFileNum

func (db *BigLogDB) GetFileNum() (uint32, error)

func (*BigLogDB) Read

func (db *BigLogDB) Read(key []byte, readlen uint32) ([]byte, error)

Read log all data

func (*BigLogDB) ReadBodyByPosition

func (db *BigLogDB) ReadBodyByPosition(ptrseek *LogFilePtrSeek, readlen uint32) ([]byte, error)

Read data by position

func (*BigLogDB) ReadHead

func (db *BigLogDB) ReadHead(key []byte) ([]byte, *LogFilePtrSeek, error)

Read log Head

func (*BigLogDB) Save

func (db *BigLogDB) Save(key []byte, valuedata []byte) (*LogFilePtrSeek, error)

save data

func (*BigLogDB) SetFileNum

func (db *BigLogDB) SetFileNum(newnum uint32) error

type BigLogDBConfig

type BigLogDBConfig struct {
	//UseLevelDB bool
	DataDir string
	KeySize uint8
	//KeyReverse               bool
	LogHeadMaxSize       int
	BlockPartFileMaxSize int64
}

*

  • config

func NewBigLogDBConfig

func NewBigLogDBConfig(
	DataDir string,
	keySize uint8,
	partFileSize int64,
) *BigLogDBConfig

type LogFilePtrSeek

type LogFilePtrSeek struct {
	Filenum  uint32
	Fileseek uint32
	Valsize  uint32
}

func (*LogFilePtrSeek) Copy

func (lp *LogFilePtrSeek) Copy() *LogFilePtrSeek

func (*LogFilePtrSeek) Parse

func (lp *LogFilePtrSeek) Parse(data []byte, seek uint32) (uint32, error)

func (*LogFilePtrSeek) Serialize

func (lp *LogFilePtrSeek) Serialize() ([]byte, error)

assembling datas

func (*LogFilePtrSeek) Size

func (lp *LogFilePtrSeek) Size() uint32

Jump to

Keyboard shortcuts

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