Documentation
¶
Index ¶
- Constants
- Variables
- func AddSQLitePragmas(connectString string, journalSizeLimit int64) string
- func AppRBACMarkerPresent(ctx context.Context) bool
- func CleanAbsolutePath(name string) (string, error)
- func CleanFilename(filename string) (string, error)
- func CleanRelativeLocalPath(name string) (string, error)
- func CleanRelativePath(name string) (string, error)
- func FileExists(filename string) bool
- func FindExec(name string) string
- func FuncNow(dbType DBType) string
- func GetClientIP(r *http.Request, trustedProxies []string) string
- func GetConnectString(pluginContext *types.PluginContext) (string, error)
- func GetContextAppId(ctx context.Context) types.AppId
- func GetContextAppPathDomain(ctx context.Context) types.AppPathDomain
- func GetContextGroups(ctx context.Context) []string
- func GetContextRequestId(ctx context.Context) string
- func GetContextUserEmail(ctx context.Context) string
- func GetContextUserId(ctx context.Context) string
- func GetContextUserSubject(ctx context.Context) string
- func GetContextValue(ctx context.Context, key types.ContextKey) string
- func GetCustomPerms(ctx context.Context) []string
- func GetDefaultConfigs() (*types.GlobalConfig, *types.ClientConfig, *types.ServerConfig, error)
- func GetFuncMap() template.FuncMap
- func GetHostname(host string) string
- func GetRequestContext(thread *starlark.Thread) context.Context
- func GetRequestGroups(thread *starlark.Thread) []string
- func GetRequestScheme(r *http.Request, trustedProxies []string) string
- func GetRequestUrl(r *http.Request, trustedProxies []string) string
- func GetRequestUserId(thread *starlark.Thread) string
- func GetThreadLocalKey(thread *starlark.Thread, key string) string
- func HumanDuration(d time.Duration) string
- func InsertIgnorePrefix(dbType DBType) string
- func InsertIgnoreSuffix(dbType DBType) string
- func IsAppRBACEnabled(ctx context.Context) bool
- func IsGit(url string) bool
- func IsOrigRequestHTTPS(r *http.Request, trustedProxies []string) bool
- func IsRunningAsService() bool
- func IsTrustedOperation(ctx context.Context) bool
- func KillGroup(process *os.Process) error
- func LitestreamBindingPrefix(config types.LitestreamConfig, pathPrefixOverride, bindingId, env string) string
- func LitestreamEffectivePrefix(config types.LitestreamConfig, pathPrefixOverride string, subPath string) string
- func LitestreamReplicaURL(config types.LitestreamConfig, replicaPath string) (string, error)
- func LoadClientConfig(contents string, config *types.ClientConfig) error
- func LoadGlobalConfig(contents string, config *types.GlobalConfig) error
- func LoadProperties(filename string) (map[string]string, error)
- func LoadServerConfig(contents string, config *types.ServerConfig) error
- func MapDataType(dbType DBType, dataType string) string
- func MapServerHost(host string) string
- func MaybeRunAsService()
- func NewClientConfigEmbedded() (*types.ClientConfig, error)
- func NewServerConfigEmbedded() (*types.ServerConfig, error)
- func NotifyServiceFailed(exitCode uint32)
- func NotifyServiceReady()
- func NotifyServiceStopped()
- func NotifyServiceStopping()
- func PathInDir(root, relPath string) (string, error)
- func PathWithinDir(root, targetPath string) (bool, error)
- func PostgresRebind(q string) string
- func RebindQuery(dbType DBType, q string) string
- func ServiceStopNotify() <-chan struct{}
- func SetProcessGroup(cmd *exec.Cmd)
- func ValidHostHeader(host string) bool
- func ValidateLitestreamConfig(name string, config types.LitestreamConfig) error
- func WithTrustedOperation(ctx context.Context) context.Context
- type DBType
- type HttpClient
- func (h *HttpClient) Delete(url string, params url.Values, output any) error
- func (h *HttpClient) Get(url string, params url.Values, output any) error
- func (h *HttpClient) Post(url string, params url.Values, input any, output any) error
- func (h *HttpClient) Put(url string, params url.Values, input any, output any) error
- func (h *HttpClient) SetHeader(name, value string)
- type LitestreamDBStatus
- type LitestreamManager
- func (m *LitestreamManager) Close(ctx context.Context) error
- func (m *LitestreamManager) ConfigName() string
- func (m *LitestreamManager) PrepareDB(ctx context.Context, name, dbFilePath string) error
- func (m *LitestreamManager) Start(ctx context.Context) error
- func (m *LitestreamManager) Status(ctx context.Context) []LitestreamDBStatus
- type LitestreamReplicaDB
- type SecretManager
- func (s *SecretManager) AppEvalTemplate(appSecrets [][]string, defaultProvider, input string) (string, error)
- func (s *SecretManager) BindDBStores(ctx context.Context, store SecretStore) error
- func (s *SecretManager) CreateSecret(ctx context.Context, req *types.CreateSecretRequest, createdBy string, ...) (*types.SecretCreateResponse, error)
- func (s *SecretManager) DeleteSecret(ctx context.Context, providerName, name string) error
- func (s *SecretManager) EvalTemplate(input string) (string, error)
- func (s *SecretManager) GetSecretInfo(ctx context.Context, providerName, name string, reveal bool) (*types.SecretGetResponse, error)
- func (s *SecretManager) ListSecrets(ctx context.Context, providerName, nameGlob string) ([]types.SecretInfo, error)
- func (s *SecretManager) RekeySecrets(ctx context.Context, providerName string) (*types.SecretRekeyResponse, error)
- type SecretStore
- type Transport
- type Upgrader
- func (u *Upgrader) Exit() <-chan struct{}
- func (u *Upgrader) HasParent() bool
- func (u *Upgrader) Listen(network, addr string, bind func(network, addr string) (net.Listener, error)) (net.Listener, error)
- func (u *Upgrader) ParentExited() bool
- func (u *Upgrader) Ready() error
- func (u *Upgrader) Stop()
- func (u *Upgrader) Supported() bool
- func (u *Upgrader) Upgrade() error
- func (u *Upgrader) WaitForParent(ctx context.Context) error
Constants ¶
const ( ApplicationJson = "application/json" OpenRunServiceLocation = "openrun" )
const (
DB_CONNECTION_CONFIG = "db_connection"
)
const DEFAULT_CONFIG = "openrun.default.toml"
const LitestreamMetadataPrefix = "metadata"
LitestreamMetadataPrefix is the replica sub-path for the server's own databases, below the config's path_prefix. App binding replicas use "bindings/<binding-id>/<env>" instead.
const LitestreamReplicaTypeFile = "file"
LitestreamReplicaTypeFile is the litestream config type for a local directory replica (tests, simple local-disk backups); the default is s3.
const ( // MaxSecretValueBytes is the max size of a secret value (after base64 // decoding). This is a config secrets store, not a blob store MaxSecretValueBytes = 1 << 20 )
const Scheme = "http+unix"
Scheme is the URL scheme used for HTTP over UNIX domain sockets.
Variables ¶
var ( DB_SQLITE_POSTGRES = []DBType{DB_TYPE_SQLITE, DB_TYPE_POSTGRES} DB_SQLITE = []DBType{DB_TYPE_SQLITE} DRIVER_MAP = map[DBType]string{ DB_TYPE_SQLITE: "sqlite", DB_TYPE_POSTGRES: "pgx", } )
ErrInPlaceRestartUnavailable is returned by Upgrader.Upgrade when a zero downtime in-place restart cannot be performed in this environment. The wrapped message says why and what to do instead.
Functions ¶
func AddSQLitePragmas ¶ added in v0.18.5
AddSQLitePragmas appends the default _pragma query parameters to a sqlite connect string (the file path part, after the sqlite: prefix is stripped). Pragmas already present in the connect string are not overridden.
func AppRBACMarkerPresent ¶ added in v0.18.7
AppRBACMarkerPresent reports whether the per-request RBAC enforcement bool is present in the context, regardless of its value. It is set for every app request during authentication, so presence identifies an attributed app request: enforcement state is computed once per request and stays stable for its lifetime (enabling RBAC mid-request applies from the next request on)
func CleanAbsolutePath ¶ added in v0.17.0
CleanAbsolutePath returns an absolute, cleaned local filesystem path. If the path exists, symlinks are resolved.
func CleanFilename ¶ added in v0.17.0
CleanFilename returns a single filename with no directory components.
As with CleanRelativePath, backslashes are treated as path separators on every platform so that filenames are validated portably. On Windows the result is also checked against reserved device names (NUL, CON, COM1, ...).
func CleanRelativeLocalPath ¶ added in v0.17.0
CleanRelativeLocalPath returns a platform-local relative path that cannot escape its containing directory. On Windows, filepath.IsLocal additionally rejects reserved device names such as NUL, CON, COM1, etc.
For example, `sub\file.txt` is returned as `sub/file.txt` on Unix and `sub\file.txt` on Windows. Use this when the result is passed to filepath, os, or host commands.
func CleanRelativePath ¶ added in v0.17.0
CleanRelativePath returns a slash-separated relative path that cannot escape its containing directory.
For example, `sub\file.txt` is returned as `sub/file.txt`. Use this for logical paths such as fs.FS names, URL/static paths, metadata paths, and tar header names.
Backslashes in the input are treated as path separators on every platform so that configs authored on Windows or Unix are validated identically. The trade-off is that a legitimate Unix filename containing a backslash will be re-interpreted as a multi-component path; callers that need to preserve such names should not route them through this function.
func FileExists ¶
func FindExec ¶
FindExec looks for the executable in the system PATH and returns its full path. If not found, it checks common Homebrew locations for the executable.
func GetClientIP ¶ added in v0.17.0
GetClientIP returns the caller IP, honoring forwarding headers only when the direct peer is explicitly configured as a trusted proxy.
func GetConnectString ¶
func GetConnectString(pluginContext *types.PluginContext) (string, error)
func GetContextAppPathDomain ¶ added in v0.18.7
func GetContextAppPathDomain(ctx context.Context) types.AppPathDomain
GetContextAppPathDomain returns the path domain of the app serving the request, the zero value when not present
func GetContextGroups ¶ added in v0.15.0
func GetContextRequestId ¶
func GetContextUserEmail ¶ added in v0.17.3
func GetContextUserId ¶
func GetContextUserSubject ¶ added in v0.17.3
func GetContextValue ¶
func GetContextValue(ctx context.Context, key types.ContextKey) string
func GetCustomPerms ¶ added in v0.16.26
func GetDefaultConfigs ¶
func GetDefaultConfigs() (*types.GlobalConfig, *types.ClientConfig, *types.ServerConfig, error)
func GetFuncMap ¶
GetFuncMap returns a template.FuncMap that includes all the sprig functions except for env and expandenv.
func GetHostname ¶ added in v0.17.0
GetHostname returns the hostname portion of an HTTP host header, handling hostnames, IPv4 addresses, and bracketed or bare IPv6 literals.
func GetRequestContext ¶ added in v0.15.14
GetRequestContext returns the request context stored on the Starlark thread. A missing thread context yields context.Background(), which carries no enforcement or trust marker: RBAC fails closed for it when enabled, so a propagation bug denies instead of silently running as a trusted internal call
func GetRequestGroups ¶ added in v0.15.0
func GetRequestScheme ¶ added in v0.17.1
GetRequestScheme returns "https" if the request was received over TLS locally, or if the direct peer is listed in trustedProxies and set X-Forwarded-Proto: https. Otherwise it returns "http". Only the first value of X-Forwarded-Proto is honored and only when the direct peer is a trusted proxy.
func GetRequestUrl ¶ added in v0.15.3
func GetRequestUserId ¶
func HumanDuration ¶ added in v0.15.10
HumanDuration returns a human readable duration string
func InsertIgnorePrefix ¶
func InsertIgnoreSuffix ¶
func IsAppRBACEnabled ¶ added in v0.16.26
func IsOrigRequestHTTPS ¶ added in v0.17.1
IsOrigRequestHTTPS reports whether the request is (or originally came in as) HTTPS, honoring X-Forwarded-Proto only when the direct peer is a trusted proxy.
func IsRunningAsService ¶ added in v0.18.15
func IsRunningAsService() bool
IsRunningAsService reports whether the process was started by the OS service control manager. Always false on platforms without OS service integration. Only valid after MaybeRunAsService has been called.
func IsTrustedOperation ¶ added in v0.18.7
IsTrustedOperation reports whether the context is a trusted administrative path, see WithTrustedOperation
func LitestreamBindingPrefix ¶ added in v0.18.15
func LitestreamBindingPrefix(config types.LitestreamConfig, pathPrefixOverride, bindingId, env string) string
LitestreamBindingPrefix is the replica key prefix for one sqlite binding: keyed by the stable binding id (not the path, which can be deleted and recreated) and the environment (prod/staged). Data follows the binding: re-attaching a base binding to a new app restores into the new app's fresh volume.
func LitestreamEffectivePrefix ¶ added in v0.18.15
func LitestreamEffectivePrefix(config types.LitestreamConfig, pathPrefixOverride string, subPath string) string
LitestreamEffectivePrefix returns the replica key prefix for a sub path, applying the config's path_prefix (or the per-service override when set).
func LitestreamReplicaURL ¶ added in v0.18.15
func LitestreamReplicaURL(config types.LitestreamConfig, replicaPath string) (string, error)
LitestreamReplicaURL returns the replica URL for one database, in the form the litestream CLI accepts for restore (s3://bucket/path?endpoint=...). Credentials are never part of the URL; they are passed via the LITESTREAM_ACCESS_KEY_ID / LITESTREAM_SECRET_ACCESS_KEY env variables.
func LoadClientConfig ¶
func LoadClientConfig(contents string, config *types.ClientConfig) error
LoadClientConfig load a ClientConfig from the given contents
func LoadGlobalConfig ¶
func LoadGlobalConfig(contents string, config *types.GlobalConfig) error
LoadGlobalConfig load a GlobalConfig from the given contents
func LoadServerConfig ¶
func LoadServerConfig(contents string, config *types.ServerConfig) error
LoadServerConfig loads a ServerConfig from the given contents
func MapDataType ¶
func MapServerHost ¶
func MaybeRunAsService ¶ added in v0.18.5
func MaybeRunAsService()
MaybeRunAsService is a no-op on platforms without OS service integration
func NewClientConfigEmbedded ¶
func NewClientConfigEmbedded() (*types.ClientConfig, error)
NewClientConfigEmbedded reads the embedded toml file and creates a ClientConfig
func NewServerConfigEmbedded ¶
func NewServerConfigEmbedded() (*types.ServerConfig, error)
NewServerConfigEmbedded reads the embedded toml file and creates a ServerConfig
func NotifyServiceFailed ¶ added in v0.18.5
func NotifyServiceFailed(exitCode uint32)
NotifyServiceFailed reports a failed startup or shutdown with a service specific exit code. Call before exiting the process on a fatal error so the control manager does not log an unexpected termination.
func NotifyServiceReady ¶ added in v0.17.6
func NotifyServiceReady()
NotifyServiceReady reports the Running state to the service control manager. No-op when not running as a service.
func NotifyServiceStopped ¶ added in v0.17.6
func NotifyServiceStopped()
NotifyServiceStopped reports a clean shutdown to the service control manager and waits for the report to be delivered before returning
func NotifyServiceStopping ¶ added in v0.17.6
func NotifyServiceStopping()
NotifyServiceStopping reports that a graceful shutdown has started
func PathInDir ¶ added in v0.17.0
PathInDir joins relPath under root after validating that relPath is local.
Because CleanRelativeLocalPath enforces filepath.IsLocal, the resulting joined path is guaranteed to be lexically inside root. This is a lexical guarantee only: it does not resolve symlinks. For symlink-safe access use os.Root from the standard library.
func PathWithinDir ¶ added in v0.17.0
PathWithinDir reports whether targetPath is lexically inside root.
This is a purely lexical check: symlinks under root that point outside root are not detected. For symlink-safe access prefer os.Root from the standard library.
func PostgresRebind ¶
func RebindQuery ¶
func ServiceStopNotify ¶ added in v0.17.6
func ServiceStopNotify() <-chan struct{}
ServiceStopNotify returns a channel that is closed when the OS requests a service stop or shutdown. Returns nil when not running as a service.
func SetProcessGroup ¶
SetProcessGroup sets the process group flag for the command
func ValidHostHeader ¶ added in v0.17.5
ValidHostHeader reports whether host is well-formed enough to be used as an HTTP Host value. Empty is rejected — OpenRun's TCP router and app proxying always require a concrete authority.
func ValidateLitestreamConfig ¶ added in v0.18.15
func ValidateLitestreamConfig(name string, config types.LitestreamConfig) error
ValidateLitestreamConfig checks one named [litestream.<name>] entry. The credential values are expected to be already secret-resolved.
func WithTrustedOperation ¶ added in v0.18.7
WithTrustedOperation marks the context as a trusted administrative path. Set ONLY where the caller's authority is established by other means: the admin/UDS management API after authentication, token authenticated webhooks, and internal background operations (newBackgroundOperationContext). RBAC enforcement fails closed for contexts with neither this nor an enforcement marker, so an unmarked context (a propagation bug, e.g. a missing Starlark thread context) is denied instead of running as admin
Types ¶
type DBType ¶
type DBType string
func CheckConnectString ¶
func InitDBConnection ¶
func InitDBConnection(logger *types.Logger, connectString string, invoker string, supportedDBs []DBType, sqliteCfg *types.MetadataConfig) (*sql.DB, DBType, error)
InitDBConnection opens a database connection pool. sqliteCfg carries the sqlite self-maintenance settings from the [metadata] config section; nil uses the built-in defaults (app data stores, tests). It is ignored for postgres.
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(serverUri, user, password string, skipCertCheck bool) *HttpClient
NewHttpClient creates a new HttpClient instance
func (*HttpClient) SetHeader ¶ added in v0.18.7
func (h *HttpClient) SetHeader(name, value string)
SetHeader adds a header sent with every request made by this client
type LitestreamDBStatus ¶ added in v0.18.15
type LitestreamDBStatus struct {
Name string `json:"name"` // metadata, audit
Path string `json:"path"`
LocalTXID uint64 `json:"local_txid"`
RemoteTXID uint64 `json:"remote_txid"`
InSync bool `json:"in_sync"`
LastSyncAt time.Time `json:"last_sync_at"`
Error string `json:"error,omitempty"`
}
LitestreamDBStatus is the replication state of one embedded-litestream database, reported by the replication status API.
type LitestreamManager ¶ added in v0.18.15
type LitestreamManager struct {
// contains filtered or unexported fields
}
LitestreamManager replicates the server's own sqlite databases (metadata and audit; the file cache is a rebuildable cache and is excluded) using litestream embedded as a library. Usage: NewLitestreamManager, PrepareDB for each database before its pool is opened (restores a missing file from the replica), Start once all databases are open, Close on server shutdown.
func NewLitestreamManager ¶ added in v0.18.15
func NewLitestreamManager(logger *types.Logger, logLevel string, configName string, config types.LitestreamConfig) (*LitestreamManager, error)
NewLitestreamManager builds the manager. logLevel is the level for litestream's own logs (logging.litestream_log_level, defaulted to logging.level by the caller); they are written to the openrun log sinks through the logger's slog bridge.
func (*LitestreamManager) Close ¶ added in v0.18.15
func (m *LitestreamManager) Close(ctx context.Context) error
Close performs a final sync and stops replication.
func (*LitestreamManager) ConfigName ¶ added in v0.18.15
func (m *LitestreamManager) ConfigName() string
ConfigName returns the [litestream.<name>] config name this manager uses.
func (*LitestreamManager) PrepareDB ¶ added in v0.18.15
func (m *LitestreamManager) PrepareDB(ctx context.Context, name, dbFilePath string) error
PrepareDB registers one database for replication and restores it from the replica if the local file is missing (disaster recovery: a wiped metadata directory is repopulated from the replica on startup). Must be called before the database pool is opened and before Start.
func (*LitestreamManager) Start ¶ added in v0.18.15
func (m *LitestreamManager) Start(ctx context.Context) error
Start begins replication for all prepared databases. Called after the database pools are open (litestream opens its own read connection).
func (*LitestreamManager) Status ¶ added in v0.18.15
func (m *LitestreamManager) Status(ctx context.Context) []LitestreamDBStatus
Status reports the replication state of each managed database.
type LitestreamReplicaDB ¶ added in v0.18.15
type LitestreamReplicaDB struct {
SubPath string `json:"sub_path"`
MaxTXID uint64 `json:"max_txid"`
LastUpdated time.Time `json:"last_updated"`
Size int64 `json:"size"`
}
LitestreamReplicaDB describes one database found in a litestream replica location: its path relative to the listed prefix (e.g. "data.db" or "tenants/acme.db") plus activity derived from the LTX object listing.
func ListLitestreamReplicaDBs ¶ added in v0.18.15
func ListLitestreamReplicaDBs(ctx context.Context, config types.LitestreamConfig, replicaPrefix string) ([]LitestreamReplicaDB, error)
ListLitestreamReplicaDBs lists the databases replicated under replicaPrefix (a full key prefix inside the bucket / file root). A database is recognized by its "<subpath>/ltx/<level>/<min>-<max>.ltx" objects; the returned info aggregates the latest activity per database.
type SecretManager ¶
type SecretManager struct {
// contains filtered or unexported fields
}
SecretManager provides access to the secrets for the system
func NewSecretManager ¶
func NewSecretManager(ctx context.Context, secretConfig map[string]types.SecretConfig, defaultProvider string, serverConfig *types.ServerConfig) (*SecretManager, error)
func (*SecretManager) AppEvalTemplate ¶
func (s *SecretManager) AppEvalTemplate(appSecrets [][]string, defaultProvider, input string) (string, error)
EvalTemplate evaluates the input string and replaces any secret placeholders with the actual secret value
func (*SecretManager) BindDBStores ¶ added in v0.18.6
func (s *SecretManager) BindDBStores(ctx context.Context, store SecretStore) error
BindDBStores connects the db secret providers to the metadata database. Called after the metadata database is initialized (the db provider cannot be used for server config values because of this ordering). A no-op when no db provider is configured
func (*SecretManager) CreateSecret ¶ added in v0.18.6
func (s *SecretManager) CreateSecret(ctx context.Context, req *types.CreateSecretRequest, createdBy string, update bool) (*types.SecretCreateResponse, error)
CreateSecret stores a secret value. If req.Name is set, that name is used (update allows overwriting an existing value). Otherwise a unique name is generated from req.Prefix. Returns the name and the {{secret}} template reference to use
func (*SecretManager) DeleteSecret ¶ added in v0.18.6
func (s *SecretManager) DeleteSecret(ctx context.Context, providerName, name string) error
DeleteSecret deletes a stored secret
func (*SecretManager) EvalTemplate ¶
func (s *SecretManager) EvalTemplate(input string) (string, error)
EvalTemplate evaluates the input string and replaces any secret placeholders with the actual secret value
func (*SecretManager) GetSecretInfo ¶ added in v0.18.6
func (s *SecretManager) GetSecretInfo(ctx context.Context, providerName, name string, reveal bool) (*types.SecretGetResponse, error)
GetSecretInfo returns info about one stored secret. With reveal, the value is included: binary values are base64 encoded with Encoding set to "base64"
func (*SecretManager) ListSecrets ¶ added in v0.18.6
func (s *SecretManager) ListSecrets(ctx context.Context, providerName, nameGlob string) ([]types.SecretInfo, error)
ListSecrets returns info about stored secrets (never values), optionally filtered by a glob pattern on the name
func (*SecretManager) RekeySecrets ¶ added in v0.18.6
func (s *SecretManager) RekeySecrets(ctx context.Context, providerName string) (*types.SecretRekeyResponse, error)
RekeySecrets re-encrypts stored secrets with the active master key. Used after adding a new key to the key material to phase out old keys
type SecretStore ¶ added in v0.18.6
type SecretStore interface {
GetSecretEntry(ctx context.Context, name string) (*types.SecretEntry, error)
InsertSecretEntry(ctx context.Context, entry *types.SecretEntry) error
UpdateSecretEntry(ctx context.Context, entry *types.SecretEntry) error
// UpdateSecretEntryIfUnchanged updates the row only if its current key_id
// and nonce still match prevKeyId/prevNonce, returning whether a row was
// updated. Used by rekey so a concurrent value update is never overwritten
// with re-encrypted stale plaintext
UpdateSecretEntryIfUnchanged(ctx context.Context, entry *types.SecretEntry, prevKeyId string, prevNonce []byte) (bool, error)
DeleteSecretEntry(ctx context.Context, name string) error
// ListSecretEntries returns all rows sorted by name. With includeValues
// false, the Value and Nonce fields are not fetched (listing does not need
// the ciphertext)
ListSecretEntries(ctx context.Context, includeValues bool) ([]*types.SecretEntry, error)
}
SecretStore is the persistence interface for the db secret provider, implemented by the metadata database layer. Values are encrypted by the provider before being stored
type Transport ¶
type Transport struct {
// DialTimeout is deprecated. Use context instead.
DialTimeout time.Duration
// RequestTimeout is deprecated and has no effect.
RequestTimeout time.Duration
// ResponseHeaderTimeout is deprecated. Use context instead.
ResponseHeaderTimeout time.Duration
// contains filtered or unexported fields
}
Transport is a http.RoundTripper that connects to Unix domain sockets.
func (*Transport) RegisterLocation ¶
RegisterLocation registers an URL location and maps it to the given file system path.
Calling RegisterLocation twice for the same location is a programmer error, and causes a panic.
type Upgrader ¶ added in v0.18.15
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader wraps tableflip to provide zero downtime in-place restarts: the running process re-execs its binary, passes the listener fds to the child and drains once the child reports ready. tableflip allows a single Upgrader per process, so an Upgrader is only created for the `server start` command path (config.EnableInPlaceRestart); embedded and test servers fall back to plain listeners. The fallback is also used where a handoff cannot work: Windows (fds cannot be turned back into listeners) and containers (the parent exiting after handoff terminates the container, killing the child)
func NewUpgrader ¶ added in v0.18.15
func NewUpgrader(logger *types.Logger, config *types.ServerConfig) *Upgrader
NewUpgrader creates the process Upgrader. It never fails: when in-place restarts are not possible the Upgrader runs in fallback mode where Listen binds plain listeners and Upgrade returns ErrInPlaceRestartUnavailable
func (*Upgrader) Exit ¶ added in v0.18.15
func (u *Upgrader) Exit() <-chan struct{}
Exit returns a channel that is closed when an upgrade has succeeded and the process must drain and exit. Returns nil in fallback mode (a nil channel never fires in a select)
func (*Upgrader) HasParent ¶ added in v0.18.15
HasParent reports whether this process was started as the child of an in-place restart handoff, meaning the previous process is still running (draining) until it exits
func (*Upgrader) Listen ¶ added in v0.18.15
func (u *Upgrader) Listen(network, addr string, bind func(network, addr string) (net.Listener, error)) (net.Listener, error)
Listen returns a listener for the address, inheriting it from the previous process during an in-place restart when possible. bind is used to create a fresh listener when there is nothing to inherit; it also runs in fallback mode, so address-specific recovery logic (like the UDS stale socket probe) applies on every path
func (*Upgrader) ParentExited ¶ added in v0.18.15
ParentExited reports whether the previous process of an in-place restart handoff has exited. True when there was no handoff. Once true, stays true
func (*Upgrader) Ready ¶ added in v0.18.15
Ready signals the previous process (if any) that this process has bound its listeners and can serve traffic, allowing the old process to drain. It also writes the pid file. Must be called once startup is complete
func (*Upgrader) Stop ¶ added in v0.18.15
func (u *Upgrader) Stop()
Stop releases upgrade resources on shutdown. In-flight upgrades are aborted
func (*Upgrader) Supported ¶ added in v0.18.15
Supported reports whether an in-place restart can be attempted