mutations

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mutations stores mutations by timestamp.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStatusCols

type LogStatusCols struct {
	DirectoryID string
	LogID       int64
	WriteToLog  bool
}

LogStatusCols are the columns in the LogStatus table.

type Table

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

Table implements a queue of mutations.

func New

func New(client *spanner.Client) *Table

New returns a new Table object.

func (*Table) AddLogs

func (t *Table) AddLogs(ctx context.Context, directoryID string, logIDs ...int64) error

AddLogs adds the logIDs to the list of active logs to send mutations to, and read mutations from. If directoryID and logID already exist, they will be marked as writable.

func (*Table) HighWatermark

func (t *Table) HighWatermark(ctx context.Context, directoryID string, logID int64, start water.Mark, limit int32) (count int32, high water.Mark, err error)

HighWatermark returns the number of items and the highest timestamp (exclusive) up to limit items after start (inclusive). Because batches (items that have the same timestamp) can contain more than one item, count may exceed limit.

func (*Table) ListLogs

func (t *Table) ListLogs(ctx context.Context, directoryID string, writable bool) ([]int64, error)

ListLogs returns the mutation logIDs assocciated with directoryID. If writable is true, the list is filtered to only contain writable logs. Returns codes.NotFound if the list is empty.

func (*Table) ReadLog

func (t *Table) ReadLog(ctx context.Context, directoryID string, logID int64, low, high water.Mark,
	limit int32) ([]*mutator.LogMessage, error)

ReadLog reads all mutations between [low, high). If limit is used, ReadLog ensures that complete batches are returned, which could slightly exceed limit.

func (*Table) SendBatch

func (t *Table) SendBatch(ctx context.Context, directoryID string, logID int64, batch []*pb.EntryUpdate) (water.Mark, error)

Send submits a batch of items to the queue and returns the commit timestamp.

func (*Table) SetWritable

func (t *Table) SetWritable(ctx context.Context, directoryID string, logID int64, enabled bool) error

SetWritable enables or disables new writes from going to logID.

Jump to

Keyboard shortcuts

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