Documentation ¶
Index ¶
- Variables
- func CreateReceiversMap(ctx context.Context, receiverService ReceiverService, ...) (map[uint64]*receiver.Receiver, error)
- func MergeConfigsMap(subscriptionConfigMap map[string]interface{}, ...) map[string]interface{}
- type Filter
- type NamespaceService
- type NotFoundError
- type Receiver
- type ReceiverService
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, sub *Subscription) error
- func (s *Service) Delete(ctx context.Context, id uint64) error
- func (s *Service) Get(ctx context.Context, id uint64) (*Subscription, error)
- func (s *Service) List(ctx context.Context, flt Filter) ([]Subscription, error)
- func (s *Service) MatchByLabels(ctx context.Context, labels map[string]string) ([]Subscription, error)
- func (s *Service) Update(ctx context.Context, sub *Subscription) error
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicate = errors.New("urn already exist") ErrRelation = errors.New("namespace id does not exist") )
Functions ¶
func CreateReceiversMap ¶
func CreateReceiversMap(ctx context.Context, receiverService ReceiverService, subscriptions []Subscription) (map[uint64]*receiver.Receiver, error)
func MergeConfigsMap ¶ added in v0.5.0
Types ¶
type NamespaceService ¶
type NotFoundError ¶
type NotFoundError struct {
ID uint64
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type ReceiverService ¶
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(repository Repository, namespaceService NamespaceService, receiverService ReceiverService) *Service
NewService returns service struct
func (*Service) MatchByLabels ¶ added in v0.5.0
func (s *Service) MatchByLabels(ctx context.Context, labels map[string]string) ([]Subscription, error)
TODO we might want to add filter by namespace id too here to filter by tenant
type Subscription ¶
type Subscription struct { ID uint64 `json:"id"` URN string `json:"urn"` Namespace uint64 `json:"namespace"` Receivers []Receiver `json:"receivers"` Match map[string]string `json:"match"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func AssignReceivers ¶
func AssignReceivers(receiversMap map[uint64]*receiver.Receiver, subscriptions []Subscription) ([]Subscription, error)
Click to show internal directories.
Click to hide internal directories.