Version: v0.1.1-alpha Latest Latest

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 12 Imported by: 0



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



This section is empty.


This section is empty.


This section is empty.


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,
	start int64, batchSize int32) (int32, int64, 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, low, high int64, 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) Send

func (m *Mutations) Send(ctx context.Context, directoryID string, updates ...*pb.EntryUpdate) error

Send writes mutations to the leading edge (by sequence number) of the mutations table. TODO(gbelvin): Make updates a slice.

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