Documentation ¶
Index ¶
Constants ¶
View Source
const (
ConfKey = "storage"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterDriver ¶
func RegisterDriver(name string, cons Constructor)
RegisterDriver registers a storage driver.
func TestSubscription ¶
func TestSubscription(s Subscribable) func(*testing.T, ...Event)
TestSubscription is a helper to test subscriptions.
Types ¶
type Constructor ¶
Constructor is a constructor function for a storage driver.
type Event ¶
Event is an event detected by the storage layer.
type EventKind ¶
type EventKind int
EventKind identifies the kind of storage event such as addition or deletion.
type InvalidPolicyError ¶
InvalidPolicyError is a custom error to signal that a policy is invalid.
func NewInvalidPolicyError ¶
func NewInvalidPolicyError(err error, msg string, args ...interface{}) InvalidPolicyError
func (InvalidPolicyError) Error ¶
func (ipe InvalidPolicyError) Error() string
func (InvalidPolicyError) Unwrap ¶
func (ipe InvalidPolicyError) Unwrap() error
type MutableStore ¶
type MutableStore interface { Store AddOrUpdate(context.Context, ...policy.Wrapper) error Delete(context.Context, ...namer.ModuleID) error }
MutableStore is a store that allows mutations.
type Store ¶
type Store interface { Subscribable // Driver is the name of the storage backend implementation. Driver() string // GetCompilationUnits gets the compilation units for the given module IDs. GetCompilationUnits(context.Context, ...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error) // GetDependents returns the dependents of the given modules. GetDependents(context.Context, ...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error) // GetPolicies returns the policies recorded in the store. GetPolicies(context.Context) ([]*policy.Wrapper, error) }
Store is the common interface implemented by storage backends.
type Subscribable ¶
type Subscribable interface { // Subscribe adds a subscriber to listen for storage notifications. Subscribe(Subscriber) // Unsubscribe removes a subscriber. Unsubscribe(Subscriber) }
Subscribable is an interface for managing subscriptions to storage events.
type Subscriber ¶
Subscriber is the interface implemented by storage subscribers.
type SubscriptionManager ¶
type SubscriptionManager struct {
// contains filtered or unexported fields
}
func NewSubscriptionManager ¶
func NewSubscriptionManager(ctx context.Context) *SubscriptionManager
func (*SubscriptionManager) NotifySubscribers ¶
func (sm *SubscriptionManager) NotifySubscribers(events ...Event)
Notify sends the events to all subscribers.
func (*SubscriptionManager) Subscribe ¶
func (sm *SubscriptionManager) Subscribe(s Subscriber)
func (*SubscriptionManager) Unsubscribe ¶
func (sm *SubscriptionManager) Unsubscribe(s Subscriber)
Click to show internal directories.
Click to hide internal directories.