cloudspanner

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 36 Imported by: 7

Documentation

Overview

Package cloudspanner contains the Cloud Spanner storage implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// NumUnseqBuckets is the length of the unsequenced time ring buffer.
	NumUnseqBuckets = int64(4)
	// NumMerkleBuckets is the number of individual buckets below each unsequenced ring buffer.
	NumMerkleBuckets = int64(16)
	// TimeNow is the function used to get the current time. Exposed so it may be mocked by tests.
	TimeNow = time.Now
)
View Source
var (
	// ErrNotFound is returned when a read/lookup fails because there was no such
	// item.
	ErrNotFound = status.Errorf(codes.NotFound, "not found")

	// ErrNotImplemented is returned by any interface methods which have not been
	// implemented yet.
	ErrNotImplemented = errors.New("not implemented")

	// ErrTransactionClosed is returned by interface methods when an operation is
	// attempted on a transaction whose Commit or Close methods have
	// previously been called.
	ErrTransactionClosed = errors.New("transaction is closed")

	// ErrWrongTXType is returned when, somehow, a write operation is attempted
	// with a read-only transaction.  This should not even be possible.
	ErrWrongTXType = errors.New("mutating method called on read-only transaction")
)

Functions

func NewAdminStorage

func NewAdminStorage(client *spanner.Client) storage.AdminStorage

NewAdminStorage returns a Spanner-based storage.AdminStorage implementation.

func NewLogStorage

func NewLogStorage(client *spanner.Client) storage.LogStorage

NewLogStorage initialises and returns a new LogStorage.

func NewLogStorageWithOpts

func NewLogStorageWithOpts(client *spanner.Client, opts LogStorageOptions) storage.LogStorage

NewLogStorageWithOpts initialises and returns a new LogStorage. The opts parameter can be used to enable custom workarounds.

Types

type LogStorageOptions

type LogStorageOptions struct {
	TreeStorageOptions

	// DequeueAcrossMerkleBuckets controls whether DequeueLeaves will only dequeue
	// from within the chosen Time+Merkle bucket, or whether it will attempt to
	// continue reading from contiguous Merkle buckets until a sufficient number
	// of leaves have been dequeued, or the entire Time bucket has been read.
	DequeueAcrossMerkleBuckets bool
	// DequeueAcrossMerkleBucketsRangeFraction specifies the fraction of Merkle
	// keyspace to dequeue from when using multi-bucket-dequeue.
	DequeueAcrossMerkleBucketsRangeFraction float64
}

LogStorageOptions are tuning, experiments and workarounds that can be used.

type QueuedEntry

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

QueuedEntry represents a leaf which was dequeued. It's used to store some extra info which is necessary for rebuilding the leaf's primary key when it's passed back in to UpdateSequencedLeaves.

type TreeStorageOptions

type TreeStorageOptions struct {
	// ReadOnlyStaleness controls how far in the past a read-only snapshot
	// transaction will read.
	// This is intended to allow Spanner to use local replicas for read requests
	// to help with performance.
	// See https://cloud.google.com/spanner/docs/timestamp-bounds for more details.
	ReadOnlyStaleness time.Duration
}

TreeStorageOptions holds various levers for configuring the tree storage instance.

Directories

Path Synopsis
Package spannerpb contains the generated protobuf code for the Spanner storage implementation.
Package spannerpb contains the generated protobuf code for the Spanner storage implementation.

Jump to

Keyboard shortcuts

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