Documentation ¶
Index ¶
- func NewPgxpoolStatsCollector(dbpool *pgxpool.Pool, dbName string) prometheus.Collector
- func NewPostgresDatastore(url string, options ...Option) (datastore.Datastore, error)
- type Option
- func ConnMaxIdleTime(idle time.Duration) Option
- func ConnMaxLifetime(lifetime time.Duration) Option
- func EnablePrometheusStats() Option
- func EnableTracing() Option
- func GCInterval(interval time.Duration) Option
- func GCMaxOperationTime(time time.Duration) Option
- func GCWindow(window time.Duration) Option
- func HealthCheckPeriod(period time.Duration) Option
- func MaxOpenConns(conns int) Option
- func MinOpenConns(conns int) Option
- func RevisionFuzzingTimedelta(delta time.Duration) Option
- func SplitAtEstimatedQuerySize(splitAtEstimatedQuerySize units.Base2Bytes) Option
- func WatchBufferLength(watchBufferLength uint16) Option
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 ¶
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 ¶
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 ¶
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
GCInterval is the the interval at which garbage collection will occur.
This value defaults to 3 minutes.
func GCMaxOperationTime ¶ added in v1.1.0
GCMaxOperationTime is the maximum operation time of a garbage collection pass before it times out.
This value defaults to 1 minute.
func GCWindow ¶
GCWindow is the maximum age of a passed revision that will be considered valid.
This value defaults to 24 hours.
func HealthCheckPeriod ¶
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 ¶
MaxOpenConns is the maximum size of the connection pool.
This value defaults to having no maximum.
func MinOpenConns ¶
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 ¶
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 ¶
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.