fs

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func WalkDocuments added in v1.31.0

func WalkDocuments(logger *zap.Logger, src fs.FS, fn func(*ext.Document) error) error

WalkDocuments walks all the Flipt feature documents found in the target fs.FS based on either the default index file or an index file located in the root

Types

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 SnapshotSource added in v1.31.0

type SnapshotSource interface {
	fmt.Stringer

	// Get builds a single instance of a *SnapshotSource
	Get(context.Context) (*StoreSnapshot, error)

	// Subscribe feeds instances of *SnapshotSource 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<- *StoreSnapshot)
}

SnapshotSource produces instances of the storage snapshot. A single snapshot 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 Store

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

Store is an implementation of storage.Store backed by an SnapshotSource. The store subscribes to the source for instances of *SnapshotSource 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 SnapshotSource) (*Store, error)

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

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) CountRollouts added in v1.24.0

func (s Store) CountRollouts(ctx context.Context, namespaceKey, flagKey string) (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) CreateRollout added in v1.24.0

func (s Store) CreateRollout(ctx context.Context, r *flipt.CreateRolloutRequest) (*flipt.Rollout, error)

func (Store) DeleteRollout added in v1.24.0

func (s Store) DeleteRollout(ctx context.Context, r *flipt.DeleteRolloutRequest) error

func (Store) GetEvaluationDistributions

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

func (Store) GetEvaluationRollouts added in v1.29.0

func (s Store) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey string) ([]*storage.EvaluationRollout, 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) GetRollout added in v1.24.0

func (s Store) GetRollout(ctx context.Context, namespaceKey, id string) (*flipt.Rollout, 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) ListRollouts added in v1.24.0

func (s Store) ListRollouts(ctx context.Context, namespaceKey, flagKey string, opts ...storage.QueryOption) (storage.ResultSet[*flipt.Rollout], 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) OrderRollouts added in v1.24.0

func (s Store) OrderRollouts(ctx context.Context, r *flipt.OrderRolloutsRequest) error

func (*Store) String

func (l *Store) String() string

String returns an identifier string for the store type.

func (Store) UpdateRollout added in v1.24.0

func (s Store) UpdateRollout(ctx context.Context, r *flipt.UpdateRolloutRequest) (*flipt.Rollout, error)

type StoreSnapshot added in v1.27.0

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

StoreSnapshot contains the structures necessary for serving flag state to a client.

func SnapshotFromFS added in v1.27.0

func SnapshotFromFS(logger *zap.Logger, fs fs.FS) (*StoreSnapshot, error)

SnapshotFromFS is a convenience function for building a snapshot directly from an implementation of fs.FS using the list state files function to source the relevant Flipt configuration files.

func SnapshotFromFiles added in v1.31.0

func SnapshotFromFiles(logger *zap.Logger, files ...fs.File) (*StoreSnapshot, error)

SnapshotFromFiles constructs a StoreSnapshot from the provided slice of fs.File implementations.

func SnapshotFromPaths added in v1.27.0

func SnapshotFromPaths(logger *zap.Logger, ffs fs.FS, paths ...string) (*StoreSnapshot, error)

SnapshotFromPaths constructs a StoreSnapshot from the provided slice of paths resolved against the provided fs.FS.

func (*StoreSnapshot) CountFlags added in v1.27.0

func (ss *StoreSnapshot) CountFlags(ctx context.Context, namespaceKey string) (uint64, error)

func (*StoreSnapshot) CountNamespaces added in v1.27.0

func (ss *StoreSnapshot) CountNamespaces(ctx context.Context) (uint64, error)

func (*StoreSnapshot) CountRollouts added in v1.27.0

func (ss *StoreSnapshot) CountRollouts(ctx context.Context, namespaceKey, flagKey string) (uint64, error)

func (*StoreSnapshot) CountRules added in v1.27.0

func (ss *StoreSnapshot) CountRules(ctx context.Context, namespaceKey, flagKey string) (uint64, error)

func (*StoreSnapshot) CountSegments added in v1.27.0

func (ss *StoreSnapshot) CountSegments(ctx context.Context, namespaceKey string) (uint64, error)

func (*StoreSnapshot) CreateConstraint added in v1.27.0

func (ss *StoreSnapshot) CreateConstraint(ctx context.Context, r *flipt.CreateConstraintRequest) (*flipt.Constraint, error)

func (*StoreSnapshot) CreateDistribution added in v1.27.0

func (*StoreSnapshot) CreateFlag added in v1.27.0

func (ss *StoreSnapshot) CreateFlag(ctx context.Context, r *flipt.CreateFlagRequest) (*flipt.Flag, error)

func (*StoreSnapshot) CreateNamespace added in v1.27.0

func (ss *StoreSnapshot) CreateNamespace(ctx context.Context, r *flipt.CreateNamespaceRequest) (*flipt.Namespace, error)

func (*StoreSnapshot) CreateRollout added in v1.27.0

func (ss *StoreSnapshot) CreateRollout(ctx context.Context, r *flipt.CreateRolloutRequest) (*flipt.Rollout, error)

func (*StoreSnapshot) CreateRule added in v1.27.0

func (ss *StoreSnapshot) CreateRule(ctx context.Context, r *flipt.CreateRuleRequest) (*flipt.Rule, error)

func (*StoreSnapshot) CreateSegment added in v1.27.0

func (ss *StoreSnapshot) CreateSegment(ctx context.Context, r *flipt.CreateSegmentRequest) (*flipt.Segment, error)

func (*StoreSnapshot) CreateVariant added in v1.27.0

func (ss *StoreSnapshot) CreateVariant(ctx context.Context, r *flipt.CreateVariantRequest) (*flipt.Variant, error)

func (*StoreSnapshot) DeleteConstraint added in v1.27.0

func (ss *StoreSnapshot) DeleteConstraint(ctx context.Context, r *flipt.DeleteConstraintRequest) error

func (*StoreSnapshot) DeleteDistribution added in v1.27.0

func (ss *StoreSnapshot) DeleteDistribution(ctx context.Context, r *flipt.DeleteDistributionRequest) error

func (*StoreSnapshot) DeleteFlag added in v1.27.0

func (ss *StoreSnapshot) DeleteFlag(ctx context.Context, r *flipt.DeleteFlagRequest) error

func (*StoreSnapshot) DeleteNamespace added in v1.27.0

func (ss *StoreSnapshot) DeleteNamespace(ctx context.Context, r *flipt.DeleteNamespaceRequest) error

func (*StoreSnapshot) DeleteRollout added in v1.27.0

func (ss *StoreSnapshot) DeleteRollout(ctx context.Context, r *flipt.DeleteRolloutRequest) error

func (*StoreSnapshot) DeleteRule added in v1.27.0

func (ss *StoreSnapshot) DeleteRule(ctx context.Context, r *flipt.DeleteRuleRequest) error

func (*StoreSnapshot) DeleteSegment added in v1.27.0

func (ss *StoreSnapshot) DeleteSegment(ctx context.Context, r *flipt.DeleteSegmentRequest) error

func (*StoreSnapshot) DeleteVariant added in v1.27.0

func (ss *StoreSnapshot) DeleteVariant(ctx context.Context, r *flipt.DeleteVariantRequest) error

func (*StoreSnapshot) GetEvaluationDistributions added in v1.27.0

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

func (*StoreSnapshot) GetEvaluationRollouts added in v1.27.0

func (ss *StoreSnapshot) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey string) ([]*storage.EvaluationRollout, error)

func (*StoreSnapshot) GetEvaluationRules added in v1.27.0

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

func (*StoreSnapshot) GetFlag added in v1.27.0

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

func (*StoreSnapshot) GetNamespace added in v1.27.0

func (ss *StoreSnapshot) GetNamespace(ctx context.Context, key string) (*flipt.Namespace, error)

func (*StoreSnapshot) GetRollout added in v1.27.0

func (ss *StoreSnapshot) GetRollout(ctx context.Context, namespaceKey, id string) (*flipt.Rollout, error)

func (*StoreSnapshot) GetRule added in v1.27.0

func (ss *StoreSnapshot) GetRule(ctx context.Context, namespaceKey string, id string) (rule *flipt.Rule, _ error)

func (*StoreSnapshot) GetSegment added in v1.27.0

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

func (*StoreSnapshot) ListFlags added in v1.27.0

func (ss *StoreSnapshot) ListFlags(ctx context.Context, namespaceKey string, opts ...storage.QueryOption) (set storage.ResultSet[*flipt.Flag], err error)

func (*StoreSnapshot) ListNamespaces added in v1.27.0

func (ss *StoreSnapshot) ListNamespaces(ctx context.Context, opts ...storage.QueryOption) (set storage.ResultSet[*flipt.Namespace], err error)

func (*StoreSnapshot) ListRollouts added in v1.27.0

func (ss *StoreSnapshot) ListRollouts(ctx context.Context, namespaceKey, flagKey string, opts ...storage.QueryOption) (set storage.ResultSet[*flipt.Rollout], err error)

func (*StoreSnapshot) ListRules added in v1.27.0

func (ss *StoreSnapshot) ListRules(ctx context.Context, namespaceKey string, flagKey string, opts ...storage.QueryOption) (set storage.ResultSet[*flipt.Rule], _ error)

func (*StoreSnapshot) ListSegments added in v1.27.0

func (ss *StoreSnapshot) ListSegments(ctx context.Context, namespaceKey string, opts ...storage.QueryOption) (set storage.ResultSet[*flipt.Segment], err error)

func (*StoreSnapshot) OrderRollouts added in v1.27.0

func (ss *StoreSnapshot) OrderRollouts(ctx context.Context, r *flipt.OrderRolloutsRequest) error

func (*StoreSnapshot) OrderRules added in v1.27.0

func (ss *StoreSnapshot) OrderRules(ctx context.Context, r *flipt.OrderRulesRequest) error

func (StoreSnapshot) String added in v1.27.0

func (ss StoreSnapshot) String() string

func (*StoreSnapshot) UpdateConstraint added in v1.27.0

func (ss *StoreSnapshot) UpdateConstraint(ctx context.Context, r *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)

func (*StoreSnapshot) UpdateDistribution added in v1.27.0

func (*StoreSnapshot) UpdateFlag added in v1.27.0

func (ss *StoreSnapshot) UpdateFlag(ctx context.Context, r *flipt.UpdateFlagRequest) (*flipt.Flag, error)

func (*StoreSnapshot) UpdateNamespace added in v1.27.0

func (ss *StoreSnapshot) UpdateNamespace(ctx context.Context, r *flipt.UpdateNamespaceRequest) (*flipt.Namespace, error)

func (*StoreSnapshot) UpdateRollout added in v1.27.0

func (ss *StoreSnapshot) UpdateRollout(ctx context.Context, r *flipt.UpdateRolloutRequest) (*flipt.Rollout, error)

func (*StoreSnapshot) UpdateRule added in v1.27.0

func (ss *StoreSnapshot) UpdateRule(ctx context.Context, r *flipt.UpdateRuleRequest) (*flipt.Rule, error)

func (*StoreSnapshot) UpdateSegment added in v1.27.0

func (ss *StoreSnapshot) UpdateSegment(ctx context.Context, r *flipt.UpdateSegmentRequest) (*flipt.Segment, error)

func (*StoreSnapshot) UpdateVariant added in v1.27.0

func (ss *StoreSnapshot) UpdateVariant(ctx context.Context, r *flipt.UpdateVariantRequest) (*flipt.Variant, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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