fs

package
v1.34.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotImplemented is returned when a method has intentionally not been implemented
	// This is usually reserved for the store write actions when the store is read-only
	// but still needs to implement storage.Store
	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

func WithInterval added in v1.34.0

func WithInterval(interval time.Duration) containers.Option[Poller]

func WithNotify added in v1.34.0

func WithNotify(t *testing.T, n func(modified bool)) containers.Option[Poller]

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 Poller added in v1.34.0

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

func NewPoller added in v1.34.0

func NewPoller(logger *zap.Logger, ctx context.Context, update UpdateFunc, opts ...containers.Option[Poller]) *Poller

func (*Poller) Close added in v1.34.0

func (p *Poller) Close() error

func (*Poller) Poll added in v1.34.0

func (p *Poller) Poll()

Poll is a utility function for a common polling strategy used by lots of declarative store implementations.

type Snapshot added in v1.34.0

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

Snapshot 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) (*Snapshot, 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) (*Snapshot, 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) (*Snapshot, error)

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

func (*Snapshot) CountFlags added in v1.34.0

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

func (*Snapshot) CountNamespaces added in v1.34.0

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

func (*Snapshot) CountRollouts added in v1.34.0

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

func (*Snapshot) CountRules added in v1.34.0

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

func (*Snapshot) CountSegments added in v1.34.0

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

func (*Snapshot) GetEvaluationDistributions added in v1.34.0

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

func (*Snapshot) GetEvaluationRollouts added in v1.34.0

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

func (*Snapshot) GetEvaluationRules added in v1.34.0

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

func (*Snapshot) GetFlag added in v1.34.0

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

func (*Snapshot) GetNamespace added in v1.34.0

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

func (*Snapshot) GetRollout added in v1.34.0

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

func (*Snapshot) GetRule added in v1.34.0

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

func (*Snapshot) GetSegment added in v1.34.0

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

func (*Snapshot) ListFlags added in v1.34.0

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

func (*Snapshot) ListNamespaces added in v1.34.0

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

func (*Snapshot) ListRollouts added in v1.34.0

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

func (*Snapshot) ListRules added in v1.34.0

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

func (*Snapshot) ListSegments added in v1.34.0

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

func (Snapshot) String added in v1.34.0

func (ss Snapshot) String() string

type SnapshotStore added in v1.34.0

type SnapshotStore interface {
	// View accepts a function which takes a *StoreSnapshot.
	// The SnapshotStore will supply a snapshot which is valid
	// for the lifetime of the provided function call.
	View(func(storage.ReadOnlyStore) error) error
	fmt.Stringer
}

SnapshotStore is a type which has a single function View. View is a functional transaction interface for reading a snapshot during the lifetime of a supplied function.

type Store

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

Store embeds a StoreSnapshot and wraps the Store methods with a read-write mutex to synchronize reads with atomic replacements of the embedded snapshot.

func NewStore

func NewStore(viewer SnapshotStore) *Store

func (*Store) CountFlags

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

func (*Store) CountNamespaces

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

func (*Store) CountRollouts added in v1.24.0

func (s *Store) CountRollouts(ctx context.Context, namespaceKey, flagKey string) (count uint64, err error)

func (*Store) CountRules

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

func (*Store) CountSegments

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

func (*Store) CreateConstraint added in v1.34.0

func (s *Store) CreateConstraint(ctx context.Context, r *flipt.CreateConstraintRequest) (*flipt.Constraint, error)

func (*Store) CreateDistribution added in v1.34.0

func (s *Store) CreateDistribution(ctx context.Context, r *flipt.CreateDistributionRequest) (*flipt.Distribution, error)

func (*Store) CreateFlag added in v1.34.0

func (s *Store) CreateFlag(ctx context.Context, r *flipt.CreateFlagRequest) (*flipt.Flag, error)

func (*Store) CreateNamespace added in v1.34.0

func (s *Store) CreateNamespace(ctx context.Context, r *flipt.CreateNamespaceRequest) (*flipt.Namespace, error)

func (*Store) CreateRollout added in v1.24.0

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

func (*Store) CreateRule added in v1.34.0

func (s *Store) CreateRule(ctx context.Context, r *flipt.CreateRuleRequest) (*flipt.Rule, error)

func (*Store) CreateSegment added in v1.34.0

func (s *Store) CreateSegment(ctx context.Context, r *flipt.CreateSegmentRequest) (*flipt.Segment, error)

func (*Store) CreateVariant added in v1.34.0

func (s *Store) CreateVariant(ctx context.Context, r *flipt.CreateVariantRequest) (*flipt.Variant, error)

func (*Store) DeleteConstraint added in v1.34.0

func (s *Store) DeleteConstraint(ctx context.Context, r *flipt.DeleteConstraintRequest) error

func (*Store) DeleteDistribution added in v1.34.0

func (s *Store) DeleteDistribution(ctx context.Context, r *flipt.DeleteDistributionRequest) error

func (*Store) DeleteFlag added in v1.34.0

func (s *Store) DeleteFlag(ctx context.Context, r *flipt.DeleteFlagRequest) error

func (*Store) DeleteNamespace added in v1.34.0

func (s *Store) DeleteNamespace(ctx context.Context, r *flipt.DeleteNamespaceRequest) error

func (*Store) DeleteRollout added in v1.24.0

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

func (*Store) DeleteRule added in v1.34.0

func (s *Store) DeleteRule(ctx context.Context, r *flipt.DeleteRuleRequest) error

func (*Store) DeleteSegment added in v1.34.0

func (s *Store) DeleteSegment(ctx context.Context, r *flipt.DeleteSegmentRequest) error

func (*Store) DeleteVariant added in v1.34.0

func (s *Store) DeleteVariant(ctx context.Context, r *flipt.DeleteVariantRequest) error

func (*Store) GetEvaluationDistributions

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

func (*Store) GetEvaluationRollouts added in v1.29.0

func (s *Store) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey string) (rollouts []*storage.EvaluationRollout, err error)

func (*Store) GetEvaluationRules

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

func (*Store) GetFlag

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

func (*Store) GetNamespace

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

func (*Store) GetRollout added in v1.24.0

func (s *Store) GetRollout(ctx context.Context, namespaceKey, id string) (rollout *flipt.Rollout, err error)

func (*Store) GetRule

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

func (*Store) GetSegment

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

func (*Store) ListFlags

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

func (*Store) ListNamespaces

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

func (*Store) ListRollouts added in v1.24.0

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

func (*Store) ListRules

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

func (*Store) ListSegments

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

func (*Store) OrderRollouts added in v1.24.0

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

func (*Store) OrderRules added in v1.34.0

func (s *Store) OrderRules(ctx context.Context, r *flipt.OrderRulesRequest) error

func (*Store) String

func (s *Store) String() string

func (*Store) UpdateConstraint added in v1.34.0

func (s *Store) UpdateConstraint(ctx context.Context, r *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)

func (*Store) UpdateDistribution added in v1.34.0

func (s *Store) UpdateDistribution(ctx context.Context, r *flipt.UpdateDistributionRequest) (*flipt.Distribution, error)

func (*Store) UpdateFlag added in v1.34.0

func (s *Store) UpdateFlag(ctx context.Context, r *flipt.UpdateFlagRequest) (*flipt.Flag, error)

func (*Store) UpdateNamespace added in v1.34.0

func (s *Store) UpdateNamespace(ctx context.Context, r *flipt.UpdateNamespaceRequest) (*flipt.Namespace, error)

func (*Store) UpdateRollout added in v1.24.0

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

func (*Store) UpdateRule added in v1.34.0

func (s *Store) UpdateRule(ctx context.Context, r *flipt.UpdateRuleRequest) (*flipt.Rule, error)

func (*Store) UpdateSegment added in v1.34.0

func (s *Store) UpdateSegment(ctx context.Context, r *flipt.UpdateSegmentRequest) (*flipt.Segment, error)

func (*Store) UpdateVariant added in v1.34.0

func (s *Store) UpdateVariant(ctx context.Context, r *flipt.UpdateVariantRequest) (*flipt.Variant, error)

type UpdateFunc added in v1.34.0

type UpdateFunc func(context.Context) (bool, error)

Directories

Path Synopsis
object
s3

Jump to

Keyboard shortcuts

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