pgbundle

package
v0.9.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pgbundle answers how pwikit runs the Postgres it ships with.

Index

Constants

View Source
const Database = "pwikit"
View Source
const (
	SystemAccountName = "pwikit"
)
View Source
const Version = "18.6.0"

Variables

This section is empty.

Functions

func Attach

func Attach(ctx context.Context, cfg Config) (string, error)

func Compatible

func Compatible(dataMajor, binaryMajor int) error

func DataVersion

func DataVersion(data string) (int, error)

func DefaultPortTaken

func DefaultPortTaken(timeout time.Duration) bool

Never connect. Whatever answers on 5432 was not set up for pwikit.

func Embedded

func Embedded() bool

func EnsurePassword

func EnsurePassword(secrets string) (string, error)

func FreePort

func FreePort() (int, error)

func Hint

func Hint() string

func ParseVersion

func ParseVersion(out string) (int, error)

func ReadPort

func ReadPort(data string) (int, error)

func RecordedRole

func RecordedRole(data string) string

func RememberRole

func RememberRole(data string) error

func RoleFor

func RoleFor(goos, account string) string

Peer authentication only admits a role named after the OS account.

func SocketDir

func SocketDir(l Layout) string

func SystemAccount

func SystemAccount(home string) (*user.User, error)

func Unpack

func Unpack(dir string) (bool, error)

func WireConf

func WireConf(data string) error

func WriteConf

func WriteConf(data string, p Plan) error

func WriteHBA

func WriteHBA(data string, p Plan) error

Types

type Config

type Config struct {
	Root     string
	Postgres string
	Data     string
	Secrets  string
	Logs     string
	Log      *slog.Logger
}

type HeldError

type HeldError struct {
	PID   int
	Owner Owner
}

func (*HeldError) Error

func (e *HeldError) Error() string

type Layout

type Layout struct {
	Root    string
	Bin     string
	Data    string
	Secrets string
}

func NewLayout

func NewLayout(root, postgres, data, secrets string) Layout

func (Layout) Binary

func (l Layout) Binary(goos, name string) string

func (Layout) Locate

func (l Layout) Locate(goos string) error

type Lock

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

func TryLock

func TryLock(name string, owner Owner) (*Lock, error)

func (*Lock) Release

func (l *Lock) Release() error

type Owner

type Owner string
const (
	OwnerServe   Owner = "serve"
	OwnerCommand Owner = "command"
)

type Plan

type Plan struct {
	Socket   string
	Host     string
	Port     int
	User     string
	Password string
	Auth     string
	Logs     string
	Peers    []string
}

func PlanFor

func PlanFor(goos string, l Layout, port int, user, password string) Plan

func (Plan) Conf

func (p Plan) Conf() string

An empty listen_addresses turns TCP off entirely.

func (Plan) DSN

func (p Plan) DSN(database string) string

func (Plan) HBA

func (p Plan) HBA() string

func (Plan) Ident

func (p Plan) Ident() string

Peer authentication matches the OS account to the role, so an account other than the one PostgreSQL runs under only gets in through this map.

type Server

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

func Start

func Start(ctx context.Context, cfg Config, owner Owner) (_ *Server, err error)

func (*Server) DSN

func (s *Server) DSN() string

func (*Server) ExitError

func (s *Server) ExitError() error

func (*Server) Exited

func (s *Server) Exited() <-chan struct{}

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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