loader

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 10 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 loader provides interfaces and implementations for hot-reloadable data sources used by components such as auth, bypass, hosts, and admission.

Index

Constants

View Source
const (
	// DefaultRedisKey is the default Redis key used by loaders.
	DefaultRedisKey = "tnet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPLoaderOption

type HTTPLoaderOption func(opts *httpLoaderOptions)

HTTPLoaderOption configures an HTTP loader.

func TimeoutHTTPLoaderOption

func TimeoutHTTPLoaderOption(timeout time.Duration) HTTPLoaderOption

TimeoutHTTPLoaderOption sets the HTTP request timeout.

type Lister

type Lister interface {
	List(ctx context.Context) ([]string, error)
}

Lister lists entries from a backend source.

type Loader

type Loader interface {
	Load(context.Context) (io.Reader, error)
	Close() error
}

Loader loads data from a backend source, returning it as an io.Reader.

func FileLoader

func FileLoader(filename string) Loader

FileLoader loads data from file.

func HTTPLoader

func HTTPLoader(url string, opts ...HTTPLoaderOption) Loader

HTTPLoader loads data from HTTP request.

func RedisHashLoader

func RedisHashLoader(addr string, opts ...RedisLoaderOption) Loader

RedisHashLoader loads data from redis hash.

func RedisListLoader

func RedisListLoader(addr string, opts ...RedisLoaderOption) Loader

RedisListLoader loads data from redis list.

func RedisSetLoader

func RedisSetLoader(addr string, opts ...RedisLoaderOption) Loader

RedisSetLoader loads data from redis set.

func RedisStringLoader

func RedisStringLoader(addr string, opts ...RedisLoaderOption) Loader

RedisStringLoader loads data from redis string.

type Mapper

type Mapper interface {
	Map(ctx context.Context) (map[string]string, error)
}

Mapper loads key-value pairs from a backend source.

type RedisLoaderOption

type RedisLoaderOption func(opts *redisLoaderOptions)

RedisLoaderOption configures a Redis loader.

func DBRedisLoaderOption

func DBRedisLoaderOption(db int) RedisLoaderOption

DBRedisLoaderOption sets the Redis database number.

func KeyRedisLoaderOption

func KeyRedisLoaderOption(key string) RedisLoaderOption

KeyRedisLoaderOption sets the Redis key.

func PasswordRedisLoaderOption

func PasswordRedisLoaderOption(password string) RedisLoaderOption

PasswordRedisLoaderOption sets the Redis password.

func UsernameRedisLoaderOption added in v0.0.3

func UsernameRedisLoaderOption(username string) RedisLoaderOption

UsernameRedisLoaderOption sets the Redis username.

Jump to

Keyboard shortcuts

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