postgres

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPgxpoolStatsCollector

func NewPgxpoolStatsCollector(dbpool *pgxpool.Pool, dbName string) prometheus.Collector

NewPgxpoolStatsCollector returns a collector that exports stats available in a pgxpool.

For more info see: https://pkg.go.dev/github.com/jackc/pgx/v4/pgxpool#Stat

func NewPostgresDatastore

func NewPostgresDatastore(
	url string,
	options ...Option,
) (datastore.Datastore, error)

NewPostgresDatastore initializes a SpiceDB datastore that uses a PostgreSQL database by leveraging manual book-keeping to implement revisioning.

This datastore is also tested to be compatible with CockroachDB.

Types

type Option added in v1.0.0

type Option func(*postgresOptions)

Option provides the facility to configure how clients within the Postgres datastore interact with the running Postgres database.

func ConnMaxIdleTime

func ConnMaxIdleTime(idle time.Duration) Option

ConnMaxIdleTime is the duration after which an idle connection will be automatically closed by the health check.

This value defaults to having no maximum.

func ConnMaxLifetime

func ConnMaxLifetime(lifetime time.Duration) Option

ConnMaxLifetime is the duration since creation after which a connection will be automatically closed.

This value defaults to having no maximum.

func EnablePrometheusStats

func EnablePrometheusStats() Option

EnablePrometheusStats enables Prometheus metrics provided by the Postgres clients being used by the datastore.

Prometheus metrics are disable by default.

func EnableTracing

func EnableTracing() Option

EnableTracing enables trace-level logging for the Postgres clients being used by the datastore.

Tracing is disabled by default.

func GCInterval added in v1.1.0

func GCInterval(interval time.Duration) Option

GCInterval is the the interval at which garbage collection will occur.

This value defaults to 3 minutes.

func GCMaxOperationTime added in v1.1.0

func GCMaxOperationTime(time time.Duration) Option

GCMaxOperationTime is the maximum operation time of a garbage collection pass before it times out.

This value defaults to 1 minute.

func GCWindow

func GCWindow(window time.Duration) Option

GCWindow is the maximum age of a passed revision that will be considered valid.

This value defaults to 24 hours.

func HealthCheckPeriod

func HealthCheckPeriod(period time.Duration) Option

HealthCheckPeriod is the interval by which idle Postgres client connections are health checked in order to keep them alive in a connection pool.

func MaxOpenConns

func MaxOpenConns(conns int) Option

MaxOpenConns is the maximum size of the connection pool.

This value defaults to having no maximum.

func MinOpenConns

func MinOpenConns(conns int) Option

MinOpenConns is the minimum size of the connection pool. The health check will increase the number of connections to this amount if it had dropped below.

This value defaults to zero.

func RevisionFuzzingTimedelta

func RevisionFuzzingTimedelta(delta time.Duration) Option

RevisionFuzzingTimedelta is the time bucket size to which advertised revisions will be rounded.

This value defaults to 5 seconds.

func SplitAtEstimatedQuerySize

func SplitAtEstimatedQuerySize(splitAtEstimatedQuerySize units.Base2Bytes) Option

SplitAtEstimatedQuerySize is the query size at which it is split into two (or more) queries.

This value defaults to `common.DefaultSplitAtEstimatedQuerySize`.

func WatchBufferLength

func WatchBufferLength(watchBufferLength uint16) Option

WatchBufferLength is the number of entries that can be stored in the watch buffer while awaiting read by the client.

This value defaults to 128.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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