Documentation ¶
Index ¶
- Constants
- Variables
- func WalkDocuments(logger *zap.Logger, src fs.FS, fn func(*ext.Document) error) error
- func WithInterval(interval time.Duration) containers.Option[Poller]
- func WithNotify(t *testing.T, n func(modified bool)) containers.Option[Poller]
- type FliptIndex
- type Poller
- type ReferencedSnapshotStore
- type SingleReferenceSnapshotStore
- type Snapshot
- func (ss *Snapshot) CountFlags(ctx context.Context, p storage.NamespaceRequest) (uint64, error)
- func (ss *Snapshot) CountNamespaces(ctx context.Context, _ storage.ReferenceRequest) (uint64, error)
- func (ss *Snapshot) CountRollouts(ctx context.Context, flag storage.ResourceRequest) (uint64, error)
- func (ss *Snapshot) CountRules(ctx context.Context, req storage.ResourceRequest) (uint64, error)
- func (ss *Snapshot) CountSegments(ctx context.Context, p storage.NamespaceRequest) (uint64, error)
- func (ss *Snapshot) GetEvaluationDistributions(ctx context.Context, rule storage.IDRequest) ([]*storage.EvaluationDistribution, error)
- func (ss *Snapshot) GetEvaluationRollouts(ctx context.Context, flag storage.ResourceRequest) ([]*storage.EvaluationRollout, error)
- func (ss *Snapshot) GetEvaluationRules(ctx context.Context, flag storage.ResourceRequest) ([]*storage.EvaluationRule, error)
- func (ss *Snapshot) GetFlag(ctx context.Context, req storage.ResourceRequest) (*flipt.Flag, error)
- func (ss *Snapshot) GetNamespace(ctx context.Context, p storage.NamespaceRequest) (*flipt.Namespace, error)
- func (ss *Snapshot) GetRollout(ctx context.Context, p storage.NamespaceRequest, id string) (*flipt.Rollout, error)
- func (ss *Snapshot) GetRule(ctx context.Context, p storage.NamespaceRequest, id string) (rule *flipt.Rule, _ error)
- func (ss *Snapshot) GetSegment(ctx context.Context, req storage.ResourceRequest) (*flipt.Segment, error)
- func (ss *Snapshot) ListFlags(ctx context.Context, req *storage.ListRequest[storage.NamespaceRequest]) (set storage.ResultSet[*flipt.Flag], err error)
- func (ss *Snapshot) ListNamespaces(ctx context.Context, req *storage.ListRequest[storage.ReferenceRequest]) (set storage.ResultSet[*flipt.Namespace], err error)
- func (ss *Snapshot) ListRollouts(ctx context.Context, req *storage.ListRequest[storage.ResourceRequest]) (set storage.ResultSet[*flipt.Rollout], err error)
- func (ss *Snapshot) ListRules(ctx context.Context, req *storage.ListRequest[storage.ResourceRequest]) (set storage.ResultSet[*flipt.Rule], _ error)
- func (ss *Snapshot) ListSegments(ctx context.Context, req *storage.ListRequest[storage.NamespaceRequest]) (set storage.ResultSet[*flipt.Segment], err error)
- func (ss Snapshot) String() string
- type SnapshotStore
- type Store
- func (s *Store) CountFlags(ctx context.Context, p storage.NamespaceRequest) (count uint64, err error)
- func (s *Store) CountNamespaces(ctx context.Context, req storage.ReferenceRequest) (count uint64, err error)
- func (s *Store) CountRollouts(ctx context.Context, flag storage.ResourceRequest) (count uint64, err error)
- func (s *Store) CountRules(ctx context.Context, flag storage.ResourceRequest) (count uint64, err error)
- func (s *Store) CountSegments(ctx context.Context, p storage.NamespaceRequest) (count uint64, err error)
- func (s *Store) CreateConstraint(ctx context.Context, r *flipt.CreateConstraintRequest) (*flipt.Constraint, error)
- func (s *Store) CreateDistribution(ctx context.Context, r *flipt.CreateDistributionRequest) (*flipt.Distribution, error)
- func (s *Store) CreateFlag(ctx context.Context, r *flipt.CreateFlagRequest) (*flipt.Flag, error)
- func (s *Store) CreateNamespace(ctx context.Context, r *flipt.CreateNamespaceRequest) (*flipt.Namespace, error)
- func (s *Store) CreateRollout(ctx context.Context, r *flipt.CreateRolloutRequest) (*flipt.Rollout, error)
- func (s *Store) CreateRule(ctx context.Context, r *flipt.CreateRuleRequest) (*flipt.Rule, error)
- func (s *Store) CreateSegment(ctx context.Context, r *flipt.CreateSegmentRequest) (*flipt.Segment, error)
- func (s *Store) CreateVariant(ctx context.Context, r *flipt.CreateVariantRequest) (*flipt.Variant, error)
- func (s *Store) DeleteConstraint(ctx context.Context, r *flipt.DeleteConstraintRequest) error
- func (s *Store) DeleteDistribution(ctx context.Context, r *flipt.DeleteDistributionRequest) error
- func (s *Store) DeleteFlag(ctx context.Context, r *flipt.DeleteFlagRequest) error
- func (s *Store) DeleteNamespace(ctx context.Context, r *flipt.DeleteNamespaceRequest) error
- func (s *Store) DeleteRollout(ctx context.Context, r *flipt.DeleteRolloutRequest) error
- func (s *Store) DeleteRule(ctx context.Context, r *flipt.DeleteRuleRequest) error
- func (s *Store) DeleteSegment(ctx context.Context, r *flipt.DeleteSegmentRequest) error
- func (s *Store) DeleteVariant(ctx context.Context, r *flipt.DeleteVariantRequest) error
- func (s *Store) GetEvaluationDistributions(ctx context.Context, rule storage.IDRequest) (dists []*storage.EvaluationDistribution, err error)
- func (s *Store) GetEvaluationRollouts(ctx context.Context, flag storage.ResourceRequest) (rollouts []*storage.EvaluationRollout, err error)
- func (s *Store) GetEvaluationRules(ctx context.Context, flag storage.ResourceRequest) (rules []*storage.EvaluationRule, err error)
- func (s *Store) GetFlag(ctx context.Context, req storage.ResourceRequest) (flag *flipt.Flag, err error)
- func (s *Store) GetNamespace(ctx context.Context, p storage.NamespaceRequest) (ns *flipt.Namespace, err error)
- func (s *Store) GetRollout(ctx context.Context, p storage.NamespaceRequest, id string) (rollout *flipt.Rollout, err error)
- func (s *Store) GetRule(ctx context.Context, p storage.NamespaceRequest, id string) (rule *flipt.Rule, err error)
- func (s *Store) GetSegment(ctx context.Context, p storage.ResourceRequest) (segment *flipt.Segment, err error)
- func (s *Store) ListFlags(ctx context.Context, req *storage.ListRequest[storage.NamespaceRequest]) (set storage.ResultSet[*flipt.Flag], err error)
- func (s *Store) ListNamespaces(ctx context.Context, req *storage.ListRequest[storage.ReferenceRequest]) (set storage.ResultSet[*flipt.Namespace], err error)
- func (s *Store) ListRollouts(ctx context.Context, req *storage.ListRequest[storage.ResourceRequest]) (set storage.ResultSet[*flipt.Rollout], err error)
- func (s *Store) ListRules(ctx context.Context, req *storage.ListRequest[storage.ResourceRequest]) (set storage.ResultSet[*flipt.Rule], err error)
- func (s *Store) ListSegments(ctx context.Context, req *storage.ListRequest[storage.NamespaceRequest]) (set storage.ResultSet[*flipt.Segment], err error)
- func (s *Store) OrderRollouts(ctx context.Context, r *flipt.OrderRolloutsRequest) error
- func (s *Store) OrderRules(ctx context.Context, r *flipt.OrderRulesRequest) error
- func (s *Store) String() string
- func (s *Store) UpdateConstraint(ctx context.Context, r *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)
- func (s *Store) UpdateDistribution(ctx context.Context, r *flipt.UpdateDistributionRequest) (*flipt.Distribution, error)
- func (s *Store) UpdateFlag(ctx context.Context, r *flipt.UpdateFlagRequest) (*flipt.Flag, error)
- func (s *Store) UpdateNamespace(ctx context.Context, r *flipt.UpdateNamespaceRequest) (*flipt.Namespace, error)
- func (s *Store) UpdateRollout(ctx context.Context, r *flipt.UpdateRolloutRequest) (*flipt.Rollout, error)
- func (s *Store) UpdateRule(ctx context.Context, r *flipt.UpdateRuleRequest) (*flipt.Rule, error)
- func (s *Store) UpdateSegment(ctx context.Context, r *flipt.UpdateSegmentRequest) (*flipt.Segment, error)
- func (s *Store) UpdateVariant(ctx context.Context, r *flipt.UpdateVariantRequest) (*flipt.Variant, error)
- type UpdateFunc
Constants ¶
const (
// IndexFileName is the name of the index file on disk
IndexFileName = ".flipt.yml"
)
Variables ¶
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
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
Types ¶
type FliptIndex ¶
type FliptIndex struct {
// contains filtered or unexported fields
}
FliptIndex is a set of glob include and exclude patterns which can be used to filter a set of provided paths.
func DefaultFliptIndex ¶ added in v1.35.0
func DefaultFliptIndex() (*FliptIndex, error)
DefaultFliptIndex returns the default value for the FliptIndex. It used when a .flipt.yml can not be located.
func OpenFliptIndex ¶ added in v1.35.0
OpenFliptIndex attempts to retrieve a FliptIndex from the provided source fs.FS implementation. If the index cannot be found then it returns the instance returned by defaultFliptIndex().
func ParseFliptIndex ¶ added in v1.35.0
func ParseFliptIndex(r io.Reader) (*FliptIndex, error)
ParseFliptIndex reads and parses the provided io.Reader and returns a *FliptIndex it deemed valid.
func (*FliptIndex) Match ¶ added in v1.35.0
func (i *FliptIndex) Match(path string) bool
Match returns true if the path should be kept because it matches the underlying index filter
type Poller ¶ added in v1.34.0
type Poller struct {
// contains filtered or unexported fields
}
type ReferencedSnapshotStore ¶ added in v1.35.0
type ReferencedSnapshotStore interface { // View accepts a function which takes a storage.ReadOnlyStore (*StoreSnapshot). // The ReferencedSnapshotStore will supply a snapshot which is valid // for the lifetime of the provided function call. // It expects a reference to be supplied on calls to View. // Empty reference will be regarded as the default reference by the store. View(storage.Reference, func(storage.ReadOnlyStore) error) error fmt.Stringer }
ReferencedSnapshotStore 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 SingleReferenceSnapshotStore ¶ added in v1.35.0
type SingleReferenceSnapshotStore struct { SnapshotStore // contains filtered or unexported fields }
SingleReferenceSnapshotStore implements ReferencedSnapshotStore but delegates to a SnapshotStore implementation. Calls with View with a non-empty reference log a warning with the requested reference.
func NewSingleReferenceStore ¶ added in v1.35.0
func NewSingleReferenceStore(logger *zap.Logger, s SnapshotStore) *SingleReferenceSnapshotStore
NewSingleReferenceStore adapts a SnapshotStore implementation into a ReferencedSnapshotStore implementation which expects to be called with an empty reference.
func (*SingleReferenceSnapshotStore) View ¶ added in v1.35.0
func (s *SingleReferenceSnapshotStore) View(ref storage.Reference, fn func(storage.ReadOnlyStore) error) error
View delegates to the embedded snapshot store implementation and drops the reference. It logs a warning if a non-empty reference is supplied as the wrapped store isn't intended for use with custom references.
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
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
SnapshotFromFiles constructs a StoreSnapshot from the provided slice of fs.File implementations.
func SnapshotFromPaths ¶ added in v1.27.0
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 (*Snapshot) CountNamespaces ¶ added in v1.34.0
func (*Snapshot) CountRollouts ¶ added in v1.34.0
func (*Snapshot) CountRules ¶ added in v1.34.0
func (*Snapshot) CountSegments ¶ added in v1.34.0
func (*Snapshot) GetEvaluationDistributions ¶ added in v1.34.0
func (*Snapshot) GetEvaluationRollouts ¶ added in v1.34.0
func (ss *Snapshot) GetEvaluationRollouts(ctx context.Context, flag storage.ResourceRequest) ([]*storage.EvaluationRollout, error)
func (*Snapshot) GetEvaluationRules ¶ added in v1.34.0
func (ss *Snapshot) GetEvaluationRules(ctx context.Context, flag storage.ResourceRequest) ([]*storage.EvaluationRule, error)
func (*Snapshot) GetNamespace ¶ added in v1.34.0
func (*Snapshot) GetRollout ¶ added in v1.34.0
func (*Snapshot) GetSegment ¶ added in v1.34.0
func (*Snapshot) ListNamespaces ¶ added in v1.34.0
func (*Snapshot) ListRollouts ¶ added in v1.34.0
func (*Snapshot) ListSegments ¶ added in v1.34.0
type SnapshotStore ¶ added in v1.34.0
type SnapshotStore interface { // View accepts a function which takes a storage.ReadOnlyStore (*SnapshotStore). // 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 ReferencedSnapshotStore) *Store
func (*Store) CountFlags ¶
func (*Store) CountNamespaces ¶
func (*Store) CountRollouts ¶ added in v1.24.0
func (*Store) CountRules ¶
func (*Store) CountSegments ¶
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 (*Store) CreateNamespace ¶ added in v1.34.0
func (*Store) CreateRollout ¶ added in v1.24.0
func (*Store) CreateRule ¶ added in v1.34.0
func (*Store) CreateSegment ¶ added in v1.34.0
func (*Store) CreateVariant ¶ added in v1.34.0
func (*Store) DeleteConstraint ¶ added in v1.34.0
func (*Store) DeleteDistribution ¶ added in v1.34.0
func (*Store) DeleteFlag ¶ added in v1.34.0
func (*Store) DeleteNamespace ¶ added in v1.34.0
func (*Store) DeleteRollout ¶ added in v1.24.0
func (*Store) DeleteRule ¶ added in v1.34.0
func (*Store) DeleteSegment ¶ added in v1.34.0
func (*Store) DeleteVariant ¶ added in v1.34.0
func (*Store) GetEvaluationDistributions ¶
func (*Store) GetEvaluationRollouts ¶ added in v1.29.0
func (s *Store) GetEvaluationRollouts(ctx context.Context, flag storage.ResourceRequest) (rollouts []*storage.EvaluationRollout, err error)
func (*Store) GetEvaluationRules ¶
func (s *Store) GetEvaluationRules(ctx context.Context, flag storage.ResourceRequest) (rules []*storage.EvaluationRule, err error)
func (*Store) GetNamespace ¶
func (*Store) GetRollout ¶ added in v1.24.0
func (*Store) GetSegment ¶
func (*Store) ListNamespaces ¶
func (*Store) ListRollouts ¶ added in v1.24.0
func (*Store) ListSegments ¶
func (*Store) OrderRollouts ¶ added in v1.24.0
func (*Store) OrderRules ¶ added in v1.34.0
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)