wal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2015 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package wal provides a write-ahead log.

Index

Constants

View Source
const (
	OperationInsert walOperation = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWAL

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

A FileWAL is a write-ahead log represented by a file on disk.

func NewFileWAL

func NewFileWAL(filename string) (*FileWAL, error)

NewFileWAL returns a new on-disk write-ahead log with the given file name.

func OpenFileWAL

func OpenFileWAL(filename string) (*FileWAL, error)

OpenFileWAL opens a write-ahead long stored at filename.

func (*FileWAL) Append

func (w *FileWAL) Append(entry WALEntry) (int, error)

Append writes the WALentry to the write-ahead log. It returns the number of bytes written and an error.

func (*FileWAL) Close

func (w *FileWAL) Close() error

Close flushes any pending writes and closes the file.

func (*FileWAL) Destroy

func (w *FileWAL) Destroy() error

Destroy closes the FileWAL and removes the file on disk.

func (*FileWAL) Filename

func (w *FileWAL) Filename() string

func (*FileWAL) ReadEntry

func (w *FileWAL) ReadEntry() (WALEntry, error)

ReadEntry reads a WALEntry from the write-ahead log. If a non-nil error is returned, w.Truncate() may be called to make the WAL safe for writing.

func (*FileWAL) Truncate

func (w *FileWAL) Truncate() error

Truncate truncates w's backing file to lastReadOffset. Truncation ensures that new entries can be safely read after they are appended.

type WAL

type WAL interface {
	Append(WALEntry) (int, error)
	ReadEntry() (WALEntry, error)
	Truncate() error
	Close() error
	Destroy() error
	Filename() string
}

A WAL is a write-ahead log.

type WALEntry

type WALEntry struct {
	Operation walOperation
	Rows      []partition.Row
}

WALEntry is an entry in the write-ahead log.

Jump to

Keyboard shortcuts

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