datastore

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Code generated by github.com/ecordell/optgen. DO NOT EDIT.

Index

Constants

View Source
const (
	MemoryEngine    = "memory"
	PostgresEngine  = "postgres"
	CockroachEngine = "cockroachdb"
	SpannerEngine   = "spanner"
	MySQLEngine     = "mysql"
)

Variables

View Source
var BuilderForEngine = map[string]engineBuilderFunc{
	CockroachEngine: newCRDBDatastore,
	PostgresEngine:  newPostgresDatastore,
	MemoryEngine:    newMemoryDatstore,
	SpannerEngine:   newSpannerDatastore,
	MySQLEngine:     newMySQLDatastore,
}

Functions

func NewDatastore

func NewDatastore(options ...ConfigOption) (datastore.Datastore, error)

NewDatastore initializes a datastore given the options

func RegisterDatastoreFlags

func RegisterDatastoreFlags(cmd *cobra.Command, opts *Config)

RegisterDatastoreFlags adds datastore flags to a cobra command

Types

type Config

type Config struct {
	Engine               string
	URI                  string
	GCWindow             time.Duration
	LegacyFuzzing        time.Duration
	RevisionQuantization time.Duration

	// Options
	MaxIdleTime            time.Duration
	MaxLifetime            time.Duration
	MaxOpenConns           int
	MinOpenConns           int
	SplitQueryCount        uint16
	ReadOnly               bool
	EnableDatastoreMetrics bool
	DisableStats           bool

	// Bootstrap
	BootstrapFiles     []string
	BootstrapOverwrite bool

	// Hedging
	RequestHedgingEnabled          bool
	RequestHedgingInitialSlowValue time.Duration
	RequestHedgingMaxRequests      uint64
	RequestHedgingQuantile         float64

	// CRDB
	FollowerReadDelay time.Duration
	MaxRetries        int
	OverlapKey        string
	OverlapStrategy   string

	// Postgres
	HealthCheckPeriod  time.Duration
	GCInterval         time.Duration
	GCMaxOperationTime time.Duration

	// Spanner
	SpannerCredentialsFile string
	SpannerEmulatorHost    string

	// MySQL
	TablePrefix string

	// Internal
	WatchBufferLength uint16
}

func ConfigWithOptions

func ConfigWithOptions(c *Config, opts ...ConfigOption) *Config

ConfigWithOptions configures an existing Config with the passed in options set

func DefaultDatastoreConfig

func DefaultDatastoreConfig() *Config

func NewConfigWithOptions

func NewConfigWithOptions(opts ...ConfigOption) *Config

NewConfigWithOptions creates a new Config with the passed in options set

func (*Config) ToOption

func (c *Config) ToOption() ConfigOption

ToOption returns a new ConfigOption that sets the values from the passed in Config

type ConfigOption

type ConfigOption func(c *Config)

func SetBootstrapFiles

func SetBootstrapFiles(bootstrapFiles []string) ConfigOption

SetBootstrapFiles returns an option that can set BootstrapFiles on a Config

func WithBootstrapFiles

func WithBootstrapFiles(bootstrapFiles string) ConfigOption

WithBootstrapFiles returns an option that can append BootstrapFiless to Config.BootstrapFiles

func WithBootstrapOverwrite

func WithBootstrapOverwrite(bootstrapOverwrite bool) ConfigOption

WithBootstrapOverwrite returns an option that can set BootstrapOverwrite on a Config

func WithDisableStats added in v1.11.0

func WithDisableStats(disableStats bool) ConfigOption

WithDisableStats returns an option that can set DisableStats on a Config

func WithEnableDatastoreMetrics added in v1.6.0

func WithEnableDatastoreMetrics(enableDatastoreMetrics bool) ConfigOption

WithEnableDatastoreMetrics returns an option that can set EnableDatastoreMetrics on a Config

func WithEngine

func WithEngine(engine string) ConfigOption

WithEngine returns an option that can set Engine on a Config

func WithFollowerReadDelay

func WithFollowerReadDelay(followerReadDelay time.Duration) ConfigOption

WithFollowerReadDelay returns an option that can set FollowerReadDelay on a Config

func WithGCInterval

func WithGCInterval(gCInterval time.Duration) ConfigOption

WithGCInterval returns an option that can set GCInterval on a Config

func WithGCMaxOperationTime

func WithGCMaxOperationTime(gCMaxOperationTime time.Duration) ConfigOption

WithGCMaxOperationTime returns an option that can set GCMaxOperationTime on a Config

func WithGCWindow

func WithGCWindow(gCWindow time.Duration) ConfigOption

WithGCWindow returns an option that can set GCWindow on a Config

func WithHealthCheckPeriod

func WithHealthCheckPeriod(healthCheckPeriod time.Duration) ConfigOption

WithHealthCheckPeriod returns an option that can set HealthCheckPeriod on a Config

func WithLegacyFuzzing added in v1.7.0

func WithLegacyFuzzing(legacyFuzzing time.Duration) ConfigOption

WithLegacyFuzzing returns an option that can set LegacyFuzzing on a Config

func WithMaxIdleTime

func WithMaxIdleTime(maxIdleTime time.Duration) ConfigOption

WithMaxIdleTime returns an option that can set MaxIdleTime on a Config

func WithMaxLifetime

func WithMaxLifetime(maxLifetime time.Duration) ConfigOption

WithMaxLifetime returns an option that can set MaxLifetime on a Config

func WithMaxOpenConns

func WithMaxOpenConns(maxOpenConns int) ConfigOption

WithMaxOpenConns returns an option that can set MaxOpenConns on a Config

func WithMaxRetries

func WithMaxRetries(maxRetries int) ConfigOption

WithMaxRetries returns an option that can set MaxRetries on a Config

func WithMinOpenConns

func WithMinOpenConns(minOpenConns int) ConfigOption

WithMinOpenConns returns an option that can set MinOpenConns on a Config

func WithOverlapKey

func WithOverlapKey(overlapKey string) ConfigOption

WithOverlapKey returns an option that can set OverlapKey on a Config

func WithOverlapStrategy

func WithOverlapStrategy(overlapStrategy string) ConfigOption

WithOverlapStrategy returns an option that can set OverlapStrategy on a Config

func WithReadOnly

func WithReadOnly(readOnly bool) ConfigOption

WithReadOnly returns an option that can set ReadOnly on a Config

func WithRequestHedgingEnabled

func WithRequestHedgingEnabled(requestHedgingEnabled bool) ConfigOption

WithRequestHedgingEnabled returns an option that can set RequestHedgingEnabled on a Config

func WithRequestHedgingInitialSlowValue

func WithRequestHedgingInitialSlowValue(requestHedgingInitialSlowValue time.Duration) ConfigOption

WithRequestHedgingInitialSlowValue returns an option that can set RequestHedgingInitialSlowValue on a Config

func WithRequestHedgingMaxRequests

func WithRequestHedgingMaxRequests(requestHedgingMaxRequests uint64) ConfigOption

WithRequestHedgingMaxRequests returns an option that can set RequestHedgingMaxRequests on a Config

func WithRequestHedgingQuantile

func WithRequestHedgingQuantile(requestHedgingQuantile float64) ConfigOption

WithRequestHedgingQuantile returns an option that can set RequestHedgingQuantile on a Config

func WithRevisionQuantization

func WithRevisionQuantization(revisionQuantization time.Duration) ConfigOption

WithRevisionQuantization returns an option that can set RevisionQuantization on a Config

func WithSpannerCredentialsFile

func WithSpannerCredentialsFile(spannerCredentialsFile string) ConfigOption

WithSpannerCredentialsFile returns an option that can set SpannerCredentialsFile on a Config

func WithSpannerEmulatorHost added in v1.8.0

func WithSpannerEmulatorHost(spannerEmulatorHost string) ConfigOption

WithSpannerEmulatorHost returns an option that can set SpannerEmulatorHost on a Config

func WithSplitQueryCount

func WithSplitQueryCount(splitQueryCount uint16) ConfigOption

WithSplitQueryCount returns an option that can set SplitQueryCount on a Config

func WithTablePrefix added in v1.7.0

func WithTablePrefix(tablePrefix string) ConfigOption

WithTablePrefix returns an option that can set TablePrefix on a Config

func WithURI

func WithURI(uRI string) ConfigOption

WithURI returns an option that can set URI on a Config

func WithWatchBufferLength added in v1.6.0

func WithWatchBufferLength(watchBufferLength uint16) ConfigOption

WithWatchBufferLength returns an option that can set WatchBufferLength on a Config

Jump to

Keyboard shortcuts

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