mutationstorage

package
v0.0.0-...-e557385 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 9 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) NewReceiver

func (m *Mutations) NewReceiver(ctx context.Context, last time.Time, domainID string, recieveFunc mutator.ReceiveFunc, rOpts mutator.ReceiverOptions) mutator.Receiver

NewReceiver starts receiving messages sent to the queue. As batches become ready, recieveFunc will be called.

func (*Mutations) ReadPage

func (m *Mutations) ReadPage(ctx context.Context, domainID string, revision, start int64, pageSize int32) (int64, []*pb.Entry, error)

ReadPage reads all mutations for a specific given domainID and sequence range. The range is identified by a starting sequence number and a count. Note that startSequence is not included in the result. ReadRange stops when endSequence or count is reached, whichever comes first. ReadRange also returns the maximum sequence number read.

func (*Mutations) Send

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

Send writes mutations to the leading edge (by sequence number) of the mutations table.

func (*Mutations) WriteBatch

func (m *Mutations) WriteBatch(ctx context.Context, domainID string, revision int64, mutations []*pb.Entry) error

WriteBatch saves the mutations in the database.

type Receiver

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

Receiver receives messages from a queue.

func (*Receiver) Close

func (r *Receiver) Close()

Close stops the receiver and returns only when all callbacks are complete.

func (*Receiver) Flush

func (r *Receiver) Flush(ctx context.Context)

Flush sends any waiting queue items.

Jump to

Keyboard shortcuts

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