lm2log

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

lm2log CircleCI GoDoc

Commit log backed by lm2

Documentation

Overview

Package lm2log implements a commit log on top of lm2.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("lm2log: not found")
)

Functions

This section is empty.

Types

type Log

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

Log is a commit log. NOTE: It is *not* goroutine-safe.

func New

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

New initializes a commit log in an lm2 collection.

func Open

func Open(file string) (*Log, error)

Open opens an existing commit log in an lm2 collection.

func (*Log) Close added in v1.1.0

func (l *Log) Close()

Close closes the log.

func (*Log) Commit

func (l *Log) Commit() error

Commit marks the prepared data as committed.

func (*Log) Committed

func (l *Log) Committed() (uint64, error)

Committed returns the latest committed record number.

func (*Log) Compact added in v1.1.0

func (l *Log) Compact(recordsToKeep uint) error

Compact compacts the log and keeps up to recordsToKeep records.

func (*Log) Destroy added in v1.1.0

func (l *Log) Destroy() error

Destroy removes the log.

func (*Log) Get

func (l *Log) Get(record uint64) (string, error)

Get retrieves data in the commit log associated with the given record number.

func (*Log) Prepare

func (l *Log) Prepare(data string) error

Prepare durably prepares data in the log.

func (*Log) Prepared

func (l *Log) Prepared() (uint64, error)

Prepared returns the currently prepared record number.

func (*Log) Rollback

func (l *Log) Rollback() error

Rollback clears any prepared data.

func (*Log) SetCommitted

func (l *Log) SetCommitted(record uint64, data string) error

SetCommitted updates the data at the given record number and updates any internal state accordingly.

Jump to

Keyboard shortcuts

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