retriever

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitializableRetriever added in v1.21.0

type InitializableRetriever interface {
	Retrieve(ctx context.Context) ([]byte, error)
	Init(ctx context.Context, logger *log.Logger) error
	Shutdown(ctx context.Context) error
	Status() Status
}

InitializableRetriever is an extended version of the retriever that can be initialized and shutdown.

type Manager added in v1.21.0

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

Manager is a struct that managed the retrievers.

func NewManager added in v1.21.0

func NewManager(ctx context.Context, retrievers []Retriever, logger *log.Logger) *Manager

NewManager create a new Manager.

func (*Manager) GetRetrievers added in v1.21.0

func (m *Manager) GetRetrievers() []Retriever

GetRetrievers return the retrievers. If an error occurred during the initialization of the retrievers, we will return the retrievers that are ready.

func (*Manager) Init added in v1.21.0

func (m *Manager) Init(ctx context.Context) error

Init the retrievers. This function will call the Init function of the retrievers that implements the InitializableRetriever interface.

func (*Manager) Shutdown added in v1.21.0

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown the retrievers. This function will call the Shutdown function of the retrievers that implements the InitializableRetriever interface.

type Retriever

type Retriever interface {
	// Retrieve function is supposed to load the file and to return a []byte of your flag configuration file.
	Retrieve(ctx context.Context) ([]byte, error)
}

Retriever is the interface to create a Retriever to load you flags.

type Status added in v1.21.0

type Status = string

Status is the status of the retriever. It can be used to check if the retriever is ready to be used. If not ready, we wi will not use it.

const (
	RetrieverReady    Status = "READY"
	RetrieverNotReady Status = "NOT_READY"
	RetrieverError    Status = "ERROR"
)

Jump to

Keyboard shortcuts

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