oplog

package
v0.0.0-...-bccea44 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

oplog provides the interface to the in-memory log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpRequestLog

type OpRequestLog struct {
	Requests []rpc.OpRequest
}

OpRequestLog is the in-memory log to store all the records.

func New

func New() *OpRequestLog

New creates an OpRequestLog.

func (*OpRequestLog) AppendRequest

func (o *OpRequestLog) AppendRequest(ctx context.Context, request *rpc.Request, opNum int) error

AppendRequest appends a request along with its opNum to the log.

func (*OpRequestLog) ReadLast

func (o *OpRequestLog) ReadLast(ctx context.Context) (*rpc.Request, int, error)

ReadLast returns the last request from the log or an error if the log is empty.

func (*OpRequestLog) Undo

func (o *OpRequestLog) Undo(ctx context.Context)

Undo removes the last record from the log.

Jump to

Keyboard shortcuts

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