mutationstorage

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: 14 Imported by: 0

Documentation

Overview

Package mutationstorage defines operations to write and read mutations to and from the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutations

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

Mutations implements mutator.MutationStorage and mutator.MutationQueue.

func New

func New(db *sql.DB) (*Mutations, error)

New creates a new Mutations instance.

func (*Mutations) AddLogs

func (m *Mutations) AddLogs(ctx context.Context, directoryID string, logIDs ...int64) error

AddLogs creates and adds new logs for writing to a directory.

func (*Mutations) HighWatermark

func (m *Mutations) HighWatermark(ctx context.Context, directoryID string, logID int64,
	start water.Mark, batchSize int32) (int32, water.Mark, error)

HighWatermark returns the highest watermark +1 in logID that is less than or equal to batchSize items greater than start.

func (*Mutations) HighestRev

func (m *Mutations) HighestRev(ctx context.Context, directoryID string) (int64, error)

HighestRev returns the highest defined revision number for directoryID.

func (*Mutations) ListLogs

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

ListLogs returns a list of all logs for directoryID, optionally filtered for writable logs.

func (*Mutations) ReadBatch

func (m *Mutations) ReadBatch(ctx context.Context, domainID string, rev int64) (*spb.MapMetadata, error)

ReadBatch returns the batch definitions for a given revision.

func (*Mutations) ReadLog

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

ReadLog reads all mutations in logID between [low, high). ReadLog may return more rows than batchSize in order to fetch all the rows at a particular timestamp.

func (*Mutations) SendBatch added in v0.3.0

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

SendBatch writes mutations to the leading edge (by sequence number) of the mutations table. Returns the logID/watermark pair that was written, or nil if nothing was written.

func (*Mutations) SetWritable

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

SetWritable enables or disables new writes from going to logID.

func (*Mutations) WriteBatchSources

func (m *Mutations) WriteBatchSources(ctx context.Context, dirID string, rev int64,
	sources *spb.MapMetadata) error

WriteBatchSources saves the mutations in the database. If revision has already been defined, this will fail.

Jump to

Keyboard shortcuts

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