fs

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

This section is empty.

Types

type FSSource

type FSSource interface {
	fmt.Stringer

	// Get builds a single instance of an fs.FS
	Get() (fs.FS, error)

	// Subscribe feeds implementations of fs.FS onto the provided channel.
	// It should block until the provided context is cancelled (it will be called in a goroutine).
	// It should close the provided channel before it returns.
	Subscribe(context.Context, chan<- fs.FS)
}

FSSource produces implementations of fs.FS. A single FS can be produced via Get or a channel may be provided to Subscribe in order to received new instances when new state becomes available.

type FliptIndex

type FliptIndex struct {
	Version string   `yaml:"version,omitempty"`
	Include []string `yaml:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty"`
}

FliptIndex represents the structure of a well-known file ".flipt.yml" at the root of an FS.

type Store

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

Store is an implementation of storage.Store backed by an FSSource. The store subscribes to the source for instances of fs.FS with new contents. When a new fs is received the contents is fetched and built into a snapshot of Flipt feature flag state.

func NewStore

func NewStore(logger *zap.Logger, source FSSource) (*Store, error)

NewStore constructs and configure a Store. The store creates a background goroutine which feeds a channel of fs.FS.

func (*Store) Close

func (l *Store) Close() error

Close cancels the polling routine and waits for the routine to return.

func (Store) CountFlags

func (s Store) CountFlags(ctx context.Context, namespaceKey string) (uint64, error)

func (Store) CountNamespaces

func (s Store) CountNamespaces(ctx context.Context) (uint64, error)

func (Store) CountRules

func (s Store) CountRules(ctx context.Context, namespaceKey, flagKey string) (uint64, error)

func (Store) CountSegments

func (s Store) CountSegments(ctx context.Context, namespaceKey string) (uint64, error)

func (Store) GetEvaluationDistributions

func (s Store) GetEvaluationDistributions(ctx context.Context, ruleID string) ([]*storage.EvaluationDistribution, error)

func (Store) GetEvaluationRules

func (s Store) GetEvaluationRules(ctx context.Context, namespaceKey string, flagKey string) ([]*storage.EvaluationRule, error)

func (Store) GetFlag

func (s Store) GetFlag(ctx context.Context, namespaceKey string, key string) (*flipt.Flag, error)

func (Store) GetNamespace

func (s Store) GetNamespace(ctx context.Context, key string) (*flipt.Namespace, error)

func (Store) GetRule

func (s Store) GetRule(ctx context.Context, namespaceKey string, id string) (*flipt.Rule, error)

func (Store) GetSegment

func (s Store) GetSegment(ctx context.Context, namespaceKey string, key string) (*flipt.Segment, error)

func (Store) ListFlags

func (s Store) ListFlags(ctx context.Context, namespaceKey string, opts ...storage.QueryOption) (storage.ResultSet[*flipt.Flag], error)

func (Store) ListNamespaces

func (s Store) ListNamespaces(ctx context.Context, opts ...storage.QueryOption) (storage.ResultSet[*flipt.Namespace], error)

func (Store) ListRules

func (s Store) ListRules(ctx context.Context, namespaceKey string, flagKey string, opts ...storage.QueryOption) (storage.ResultSet[*flipt.Rule], error)

func (Store) ListSegments

func (s Store) ListSegments(ctx context.Context, namespaceKey string, opts ...storage.QueryOption) (storage.ResultSet[*flipt.Segment], error)

func (*Store) String

func (l *Store) String() string

String returns an identifier string for the store type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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