pgbk

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name    = "postgresql"
	AltName = "postgres"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMode

type AuthMode string

AuthMode determines if we should use some environment-specific authentication mechanism or credentials.

const (
	// StaticAuth uses the static credentials as defined in the connection
	// string.
	StaticAuth AuthMode = ""
	// AzureADAuth gets a connection token from Azure and uses it as the
	// password when connecting.
	AzureADAuth AuthMode = "azure"
)

func (AuthMode) Check

func (a AuthMode) Check() error

Check returns an error if the AuthMode is invalid.

type Backend

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

Backend is a PostgreSQL-backed backend.Backend.

func NewFromParams

func NewFromParams(ctx context.Context, params backend.Params) (*Backend, error)

NewFromParams starts and returns a *Backend with the given params (generally read from the Teleport configuration file).

func NewWithConfig

func NewWithConfig(ctx context.Context, cfg Config) (*Backend, error)

NewWithConfig starts and returns a *Backend with the given Config.

func (*Backend) AtomicWrite

func (b *Backend) AtomicWrite(ctx context.Context, condacts []backend.ConditionalAction) (revision string, err error)

func (*Backend) Clock

func (b *Backend) Clock() clockwork.Clock

Clock implements backend.Backend.

func (*Backend) Close

func (b *Backend) Close() error

func (*Backend) CloseWatchers

func (b *Backend) CloseWatchers()

CloseWatchers implements backend.Backend.

func (*Backend) CompareAndSwap

func (b *Backend) CompareAndSwap(ctx context.Context, expected, replaceWith backend.Item) (*backend.Lease, error)

CompareAndSwap implements backend.Backend.

func (*Backend) ConditionalDelete

func (b *Backend) ConditionalDelete(ctx context.Context, key []byte, rev string) error

func (*Backend) ConditionalUpdate

func (b *Backend) ConditionalUpdate(ctx context.Context, i backend.Item) (*backend.Lease, error)

func (*Backend) Create

func (b *Backend) Create(ctx context.Context, i backend.Item) (*backend.Lease, error)

Create implements backend.Backend.

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, key []byte) error

Delete implements backend.Backend.

func (*Backend) DeleteRange

func (b *Backend) DeleteRange(ctx context.Context, startKey []byte, endKey []byte) error

DeleteRange implements backend.Backend.

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key []byte) (*backend.Item, error)

Get implements backend.Backend.

func (*Backend) GetName

func (*Backend) GetName() string

GetName implements backend.Backend.

func (*Backend) GetRange

func (b *Backend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error)

GetRange implements backend.Backend.

func (*Backend) KeepAlive

func (b *Backend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error

KeepAlive implements backend.Backend.

func (*Backend) NewWatcher

func (b *Backend) NewWatcher(ctx context.Context, watch backend.Watch) (backend.Watcher, error)

NewWatcher implements backend.Backend.

func (*Backend) Put

func (b *Backend) Put(ctx context.Context, i backend.Item) (*backend.Lease, error)

Put implements backend.Backend.

func (*Backend) Update

func (b *Backend) Update(ctx context.Context, i backend.Item) (*backend.Lease, error)

Update implements backend.Backend.

type Config

type Config struct {
	ConnString string `json:"conn_string"`

	AuthMode AuthMode `json:"auth_mode"`

	ChangeFeedConnString   string         `json:"change_feed_conn_string"`
	ChangeFeedPollInterval types.Duration `json:"change_feed_poll_interval"`
	ChangeFeedBatchSize    int            `json:"change_feed_batch_size"`

	DisableExpiry   bool           `json:"disable_expiry"`
	ExpiryInterval  types.Duration `json:"expiry_interval"`
	ExpiryBatchSize int            `json:"expiry_batch_size"`
}

Config is the configuration struct for Backend; outside of tests or custom code, it's usually generated by converting the backend.Params from the Teleport configuration file.

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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