levlog

package module
v0.0.0-...-472bff5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PageSize int64 = 20

var Index int64 = -1

Variables

View Source
var (
	//PRE_INDEX   = "IDX-"
	NOW_INDEX_B = []byte("NOW_INDEX")
	FIR_INDEX_B = []byte("FIR_INDEX")
)

Functions

func BytesToInt64

func BytesToInt64(buf []byte) int64

func Int64ToBytes

func Int64ToBytes(i int64) []byte

Types

type Levlog

type Levlog struct {
	Dbdir      string
	DB         *leveldb.DB
	DbLock     *sync.RWMutex
	FirstIndex int64
	NowIndex   int64
}

func GenLevlog

func GenLevlog(dbdir string) (*Levlog, error)

func (*Levlog) Close

func (levlog *Levlog) Close()

func (*Levlog) DelFirstPage

func (levlog *Levlog) DelFirstPage() error

func (*Levlog) GetFirstPageNum

func (levlog *Levlog) GetFirstPageNum() int64

func (*Levlog) GetLastPageNum

func (levlog *Levlog) GetLastPageNum() int64

func (*Levlog) GetLog

func (levlog *Levlog) GetLog(idx int64) (string, error)

func (*Levlog) GetLogs

func (levlog *Levlog) GetLogs(start int64, end int64) ([]string, error)

func (*Levlog) GetLogsInPage

func (levlog *Levlog) GetLogsInPage(page int64) ([]string, error)

func (*Levlog) Log

func (levlog *Levlog) Log(logstr string) error

Jump to

Keyboard shortcuts

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