memory

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

Documentation

Overview

Package memory supplies fake in-memory implementations for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MutationLogs

type MutationLogs map[int64][]batch // Map of logID to Slice of LogMessages

MutationLogs is a fake, in-memory implementation of a keyserver.MutationLogss. All requests are presumed to be for the same domainID. TODO(gbelvin): Support multiple domainIDs, if tests call for it. MutationLogs is NOT threadsafe.

func NewMutationLogs

func NewMutationLogs() MutationLogs

NewMutationLogs creates a new fake MutationLogs.

func (MutationLogs) AddLogs

func (m MutationLogs) AddLogs(_ context.Context, _ string, logIDs ...int64) error

AddLogs adds logIDs to the mutation database.

func (MutationLogs) HighWatermark

func (m MutationLogs) HighWatermark(_ context.Context, _ string, logID int64, start water.Mark,
	batchSize int32) (int32, water.Mark, error)

HighWatermark returns the highest watermark batchSize items beyond start.

func (MutationLogs) ListLogs

func (m MutationLogs) ListLogs(_ context.Context, _ string, writable bool) ([]int64, error)

ListLogs returns a sorted list of logIDs.

func (MutationLogs) ReadLog

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

ReadLog returns mutations between [low, high). Always returns complete batches. ReadLog will return more items than batchSize if necessary to return a complete batch.

func (MutationLogs) SendBatch added in v0.3.0

func (m MutationLogs) SendBatch(_ context.Context, _ string, logID int64, mutations []*pb.EntryUpdate) (water.Mark, error)

SendBatch stores a batch of mutations in a given logID.

Jump to

Keyboard shortcuts

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