Documentation ¶
Index ¶
- func Scan(it Iter, do func(string) error) error
- type Cache
- type Collection
- type CollectionIter
- type FamilyIter
- type GateCreatedIter
- type GateDisabledIter
- type GateEnabledIter
- type GateIter
- type GroupIter
- type IDIter
- type Iter
- type MountPoint
- func (path MountPoint) CreateTier(group, name string) (*Tier, error)
- func (path MountPoint) DeleteGroup(group string) error
- func (path MountPoint) DeleteTier(group, name string) error
- func (path MountPoint) Groups() *GroupIter
- func (path MountPoint) Load() (*Cache, error)
- func (path MountPoint) Open() (*Store, error)
- func (path MountPoint) OpenTier(group, name string) (*Tier, error)
- func (path MountPoint) Tiers(group string) *TierIter
- func (path MountPoint) Wait(ctx context.Context) error
- type Store
- type Tier
- func (tier *Tier) Close() error
- func (tier *Tier) Collections() *CollectionIter
- func (tier *Tier) CreateCollection(collection string) (*Collection, error)
- func (tier *Tier) CreateGate(family, name, collection string, salt uint32) error
- func (tier *Tier) DeleteCollection(collection string) error
- func (tier *Tier) DeleteGate(family, name, collection string) error
- func (tier *Tier) EnableGate(family, name, collection string, volume float64, open bool) error
- func (tier *Tier) Families() *FamilyIter
- func (tier *Tier) Gates(family string) *GateIter
- func (tier *Tier) GatesCreated(family, gate string) *GateCreatedIter
- func (tier *Tier) GatesDisabled(collection, id string) *GateDisabledIter
- func (tier *Tier) GatesEnabled(collection, id string) *GateEnabledIter
- func (tier *Tier) Group() string
- func (tier *Tier) IDs(collection string) *IDIter
- func (tier *Tier) Name() string
- func (tier *Tier) OpenCollection(collection string) (*Collection, error)
- func (tier *Tier) ReadGate(family, name, collection string) (open bool, salt string, volume float64, err error)
- func (tier *Tier) String() string
- type TierIter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an in-memory view of feature mount point on a file system.
The cache is optimized for fast lookups of gates, and fast test of gate open states for an id. The cache is also immutable, and therefore safe to use concurrently from multiple goroutines.
The cache is designed to minimize the memory footprint. The underlying files containing the id collections are memory mapped so multiple programs are able to share the memory pages.
func (*Cache) GateOpen ¶
GateOpen returns true if a gate is opened for a given id.
The method does not retain any of the strings passed as arguments.
func (*Cache) LookupGates ¶
LookupGates returns the list of open gates in a family for a given id.
The method does not retain any of the strings passed as arguments.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func (*Collection) Add ¶
func (col *Collection) Add(id string) error
func (*Collection) Close ¶
func (col *Collection) Close() error
func (*Collection) IDs ¶
func (col *Collection) IDs() *IDIter
func (*Collection) Path ¶
func (col *Collection) Path() string
func (*Collection) Sync ¶
func (col *Collection) Sync() error
type CollectionIter ¶
type CollectionIter struct {
// contains filtered or unexported fields
}
func (*CollectionIter) Close ¶
func (it *CollectionIter) Close() error
func (*CollectionIter) IDs ¶
func (it *CollectionIter) IDs() *IDIter
func (*CollectionIter) Name ¶
func (it *CollectionIter) Name() string
func (*CollectionIter) Next ¶
func (it *CollectionIter) Next() bool
type FamilyIter ¶
type FamilyIter struct {
// contains filtered or unexported fields
}
func (*FamilyIter) Close ¶
func (it *FamilyIter) Close() error
func (*FamilyIter) Gates ¶
func (it *FamilyIter) Gates() *GateIter
func (*FamilyIter) Name ¶
func (it *FamilyIter) Name() string
func (*FamilyIter) Next ¶
func (it *FamilyIter) Next() bool
type GateCreatedIter ¶
type GateCreatedIter struct {
// contains filtered or unexported fields
}
func (*GateCreatedIter) Close ¶
func (it *GateCreatedIter) Close() error
func (*GateCreatedIter) Name ¶
func (it *GateCreatedIter) Name() string
func (*GateCreatedIter) Next ¶
func (it *GateCreatedIter) Next() bool
type GateDisabledIter ¶
type GateDisabledIter struct {
// contains filtered or unexported fields
}
func (*GateDisabledIter) Close ¶
func (it *GateDisabledIter) Close() error
func (*GateDisabledIter) Family ¶
func (it *GateDisabledIter) Family() string
func (*GateDisabledIter) Gate ¶
func (it *GateDisabledIter) Gate() string
func (*GateDisabledIter) Name ¶
func (it *GateDisabledIter) Name() string
func (*GateDisabledIter) Next ¶
func (it *GateDisabledIter) Next() bool
type GateEnabledIter ¶
type GateEnabledIter struct {
// contains filtered or unexported fields
}
func (*GateEnabledIter) Close ¶
func (it *GateEnabledIter) Close() error
func (*GateEnabledIter) Family ¶
func (it *GateEnabledIter) Family() string
func (*GateEnabledIter) Gate ¶
func (it *GateEnabledIter) Gate() string
func (*GateEnabledIter) Name ¶
func (it *GateEnabledIter) Name() string
func (*GateEnabledIter) Next ¶
func (it *GateEnabledIter) Next() bool
type GateIter ¶
type GateIter struct {
// contains filtered or unexported fields
}
func (*GateIter) Created ¶
func (it *GateIter) Created() *GateCreatedIter
type MountPoint ¶
type MountPoint string
MountPoint represents the mount point of a feature file system.
The type is a simple string alias, its value is the path to the root directory of the file system.
func Mount ¶
func Mount(path string) (MountPoint, error)
func (MountPoint) CreateTier ¶
func (path MountPoint) CreateTier(group, name string) (*Tier, error)
func (MountPoint) DeleteGroup ¶
func (path MountPoint) DeleteGroup(group string) error
func (MountPoint) DeleteTier ¶
func (path MountPoint) DeleteTier(group, name string) error
func (MountPoint) Groups ¶
func (path MountPoint) Groups() *GroupIter
func (MountPoint) Load ¶
func (path MountPoint) Load() (*Cache, error)
The Load method loads the features at the mount point it is called on, returning a Cache object exposing the state.
The returned cache holds operating system resources and therefore must be closed when the program does not need it anymore.
func (MountPoint) Open ¶
func (path MountPoint) Open() (*Store, error)
The Open method opens the features at the mount point it was called on, returning a Store object exposing the state.
The returned store holds operating system resources and therefore must be closed when the program does not need it anymore.
func (MountPoint) Tiers ¶
func (path MountPoint) Tiers(group string) *TierIter
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is similar to Cache, but automatically reloads when updates are made to the underlying file system.
func (*Store) LookupGates ¶
LookupGates returns the list of open gates in a family for a given id.
type Tier ¶
type Tier struct {
// contains filtered or unexported fields
}
func (*Tier) Collections ¶
func (tier *Tier) Collections() *CollectionIter
func (*Tier) CreateCollection ¶
func (tier *Tier) CreateCollection(collection string) (*Collection, error)
func (*Tier) CreateGate ¶
func (*Tier) DeleteCollection ¶
func (*Tier) DeleteGate ¶
func (*Tier) EnableGate ¶
func (*Tier) Families ¶
func (tier *Tier) Families() *FamilyIter
func (*Tier) GatesCreated ¶
func (tier *Tier) GatesCreated(family, gate string) *GateCreatedIter
func (*Tier) GatesDisabled ¶
func (tier *Tier) GatesDisabled(collection, id string) *GateDisabledIter
func (*Tier) GatesEnabled ¶
func (tier *Tier) GatesEnabled(collection, id string) *GateEnabledIter
func (*Tier) OpenCollection ¶
func (tier *Tier) OpenCollection(collection string) (*Collection, error)