provider

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package provider defines the Provider interface for configuration backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	// Get retrieves the current raw value for a key from the backend.
	Get(ctx context.Context, key string) (string, error)

	// Watch monitors multiple keys for changes. The provider is free to
	// implement this as a single prefix watch, a batch poll, or any other
	// efficient strategy. When a change is detected for a key, onChange is
	// called with the key and the new raw string value.
	// The implementation must block until the context is cancelled or an error occurs.
	Watch(ctx context.Context, keys []string, onChange func(key string, value string)) error

	// Close releases any resources held by the provider.
	Close() error
}

Provider is the interface that all config backends must implement. Each provider decides its own strategy for watching changes:

  • etcd: native Watch API with prefix watching (event-driven)
  • Redis/MySQL/PostgreSQL/Vault: batch polling of all keys
  • File: filesystem event notification

Directories

Path Synopsis
Package etcd implements the provider.Provider interface for etcd configuration backends.
Package etcd implements the provider.Provider interface for etcd configuration backends.
Package file implements provider.Provider for local file-based configuration.
Package file implements provider.Provider for local file-based configuration.
Package mysql implements the provider.Provider interface for MySQL configuration backends.
Package mysql implements the provider.Provider interface for MySQL configuration backends.
Package postgresql implements the provider.Provider interface for PostgreSQL configuration backends.
Package postgresql implements the provider.Provider interface for PostgreSQL configuration backends.
Package redis implements the provider.Provider interface for Redis configuration backends.
Package redis implements the provider.Provider interface for Redis configuration backends.
Package vault implements the provider.Provider interface for HashiCorp Vault KV v2 backends.
Package vault implements the provider.Provider interface for HashiCorp Vault KV v2 backends.

Jump to

Keyboard shortcuts

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