source

package
v5.0.0-...-b98a0e9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatasourceTplKey    = "DataSource"
	ObjectServiceTplKey = "Object"
)

Variables

View Source
var (
	DataSourceContextKey    = dsContextKey{}
	ObjectServiceContextKey = objContextKey{}
)

Functions

func ListObjects

func ListObjects(ctx context.Context) (objects []string)

ListObjects is a SourcesProvider returning *object.MinioConfig list

func ListSources

func ListSources(ctx context.Context) (sources []string)

ListSources is a SourcesProvider returning *object.Datasource list

Types

type Resolver

type Resolver[T any] struct {
	// contains filtered or unexported fields
}

Resolver is a util for iterating/resolving datasource injected in context

func NewResolver

func NewResolver[T any](ctxKey any, srvPrefix string, provider SourcesProvider) *Resolver[T]

NewResolver creates a new resolver with a SourcesProvider

func (*Resolver[T]) HeatCacheAndWatch

func (r *Resolver[T]) HeatCacheAndWatch(ctx context.Context, watchOpts ...configx.WatchOption) error

HeatCacheAndWatch use internal loader and SourcesProvider to put all data in cache. WatchOptions are used to start a watch on config

func (*Resolver[T]) Lookup

func (r *Resolver[T]) Lookup(ctx context.Context) (T, error)

Lookup tries to load from cache and return an error if not found, without triggering loader

func (*Resolver[T]) Resolve

func (r *Resolver[T]) Resolve(ctx context.Context) (T, error)

Resolve tries to load from cache or using loader

func (*Resolver[T]) SetCleaner

func (r *Resolver[T]) SetCleaner(cleaner func(context.Context, string, T) error)

SetCleaner registers a clean function to be called when a source is removed

func (*Resolver[T]) SetLoader

func (r *Resolver[T]) SetLoader(loader func(context.Context, string) (T, error))

SetLoader provides the initializer for a given source

func (*Resolver[T]) WatchConfig

func (r *Resolver[T]) WatchConfig(ctx context.Context, opts ...configx.WatchOption)

WatchConfig watches sources and triggers loader/cleaner for new/removed sources

type SourcesProvider

type SourcesProvider func(ctx context.Context) []string

SourcesProvider generates a source of keys based on context

Directories

Path Synopsis
Package index provides indexation for datasources
Package index provides indexation for datasources
sessions
Package sessions is used during indexation to start/stop a session an speed-up the process
Package sessions is used during indexation to start/stop a session an speed-up the process
service
Package objects is in charge of exposing the content of the datasource with the S3 protocol.
Package objects is in charge of exposing the content of the datasource with the S3 protocol.
Package sync provides service for synchronizing objects to indexes
Package sync provides service for synchronizing objects to indexes
service
Package sync ties the "objects" and "index" together
Package sync ties the "objects" and "index" together

Jump to

Keyboard shortcuts

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