logentry

package
v0.0.0-...-07370e6 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

dister日志模块 顶部索引域:随机数(14bit,固定4位正整数)数据开始位置(43bit,8TB) 数据长度(23bit,8MB) 底部数据域:[消息数据](变长)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Id    uint64 // ID
	Value []byte // 内容
	// contains filtered or unexported fields
}

日志项

type Log

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

消息日志管理对象

func New

func New(path string) (*Log, error)

创建消息日志管理对象

func (*Log) Add

func (log *Log) Add(msg []byte) (uint64, error)

添加日志

func (*Log) AddById

func (log *Log) AddById(id uint64, msg []byte) error

根据指定的id添加日志

func (*Log) Get

func (log *Log) Get(id uint64) []byte

根据消息id查询日志

func (*Log) GetByRange

func (log *Log) GetByRange(id uint64, length int) []Item

获取比id在length长度范围内的日志列表,length > 0表示往后获取,length < 0表示往前获取

func (*Log) Length

func (log *Log) Length() uint64

获取日志的总数

func (*Log) Valid

func (log *Log) Valid(id uint64) bool

验证所给的日志id是否合法

Jump to

Keyboard shortcuts

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