Documentation
¶
Index ¶
- type Config
- type Option
- type Store
- func (s *Store) CreateSubscription(ctx context.Context, subscription *subscription.Subscription) error
- func (s *Store) DeleteSubscription(ctx context.Context, subscription *subscription.Subscription) error
- func (s *Store) GetSubscriptions(ctx context.Context, action, schema, table string) ([]*subscription.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a wrapper around a subscription store that keeps an in memory cache to minimise calls to the persistent store. It is concurrency safe. The cache contents will be refreshed on a configurable interval. This is an ephemeral lightweight wrapper that doesn't control memory usage. Should only be used when the amount of subscriptions is manageable for the resources allocated. The sync interval will represent in the worst case scenario the staleness of the cache.
func New ¶
NewStoreCache will wrap the store on input, providing a simple in memory cache to minimise calls to the persistent store. It will perform an initial warm up to retrieve all existing subscriptions, and will sync with the store on input on a configured interval.
func (*Store) CreateSubscription ¶
func (s *Store) CreateSubscription(ctx context.Context, subscription *subscription.Subscription) error
func (*Store) DeleteSubscription ¶
func (s *Store) DeleteSubscription(ctx context.Context, subscription *subscription.Subscription) error
func (*Store) GetSubscriptions ¶
func (s *Store) GetSubscriptions(ctx context.Context, action, schema, table string) ([]*subscription.Subscription, error)