Documentation
¶
Index ¶
- Constants
- Variables
- type AESCipher
- type Cipher
- type Config
- type Credentials
- type Data
- type Delivery
- type DeliveryEvent
- type DeliveryEventTelemetry
- type Destination
- type DestinationFilter
- type DestinationSummary
- type EntityStore
- type EntityStoreOption
- type Event
- type EventTelemetry
- type ListDeliveryRequest
- type ListDestinationByTenantOpts
- type ListEventRequest
- type LogStore
- type Metadata
- type Tenant
- type Topics
Constants ¶
View Source
const ( DeliveryStatusOK = "ok" DeliveryStatusFailed = "failed" )
Variables ¶
View Source
var ( ErrInvalidTopics = errors.New("validation failed: invalid topics") ErrInvalidTopicsFormat = errors.New("validation failed: invalid topics format") )
View Source
var ( ErrTenantNotFound = errors.New("tenant does not exist") ErrTenantDeleted = errors.New("tenant has been deleted") ErrDuplicateDestination = errors.New("destination already exists") ErrDestinationNotFound = errors.New("destination does not exist") ErrDestinationDeleted = errors.New("destination has been deleted") ErrMaxDestinationsPerTenantReached = errors.New("maximum number of destinations per tenant reached") )
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
func NewAESCipher ¶
type Credentials ¶
func (*Credentials) MarshalBinary ¶
func (c *Credentials) MarshalBinary() ([]byte, error)
func (*Credentials) UnmarshalBinary ¶
func (c *Credentials) UnmarshalBinary(data []byte) error
func (*Credentials) UnmarshalJSON ¶
func (c *Credentials) UnmarshalJSON(data []byte) error
type DeliveryEvent ¶
type DeliveryEvent struct { ID string Attempt int DestinationID string Event Event Delivery *Delivery Telemetry *DeliveryEventTelemetry Manual bool // Indicates if this is a manual retry }
func NewDeliveryEvent ¶
func NewDeliveryEvent(event Event, destinationID string) DeliveryEvent
func NewManualDeliveryEvent ¶
func NewManualDeliveryEvent(event Event, destinationID string) DeliveryEvent
func (*DeliveryEvent) FromMessage ¶
func (e *DeliveryEvent) FromMessage(msg *mqs.Message) error
func (*DeliveryEvent) GetRetryID ¶
func (e *DeliveryEvent) GetRetryID() string
GetRetryID returns the ID used for scheduling retries. We use Event.ID instead of DeliveryEvent.ID because: 1. Each event should only have one scheduled retry at a time 2. Event.ID is always accessible, while DeliveryEvent.ID may require additional queries in retry scenarios
type DeliveryEventTelemetry ¶
type Destination ¶
type Destination struct { ID string `json:"id" redis:"id"` Type string `json:"type" redis:"type"` Topics Topics `json:"topics" redis:"-"` Config Config `json:"config" redis:"-"` Credentials Credentials `json:"credentials" redis:"-"` CreatedAt time.Time `json:"created_at" redis:"created_at"` DisabledAt *time.Time `json:"disabled_at" redis:"disabled_at"` TenantID string `json:"-" redis:"-"` }
func (*Destination) ToSummary ¶
func (d *Destination) ToSummary() *DestinationSummary
func (*Destination) Validate ¶
func (d *Destination) Validate(topics []string) error
type DestinationFilter ¶
type DestinationSummary ¶
type DestinationSummary struct { ID string `json:"id"` Type string `json:"type"` Topics Topics `json:"topics"` Disabled bool `json:"disabled"` }
func (*DestinationSummary) MarshalBinary ¶
func (ds *DestinationSummary) MarshalBinary() ([]byte, error)
func (*DestinationSummary) UnmarshalBinary ¶
func (ds *DestinationSummary) UnmarshalBinary(data []byte) error
type EntityStore ¶
type EntityStore interface { RetrieveTenant(ctx context.Context, tenantID string) (*Tenant, error) UpsertTenant(ctx context.Context, tenant Tenant) error DeleteTenant(ctx context.Context, tenantID string) error ListDestinationByTenant(ctx context.Context, tenantID string, options ...ListDestinationByTenantOpts) ([]Destination, error) RetrieveDestination(ctx context.Context, tenantID, destinationID string) (*Destination, error) CreateDestination(ctx context.Context, destination Destination) error UpsertDestination(ctx context.Context, destination Destination) error DeleteDestination(ctx context.Context, tenantID, destinationID string) error MatchEvent(ctx context.Context, event Event) ([]DestinationSummary, error) }
func NewEntityStore ¶
func NewEntityStore(redisClient *redis.Client, opts ...EntityStoreOption) EntityStore
type EntityStoreOption ¶
type EntityStoreOption func(*entityStoreImpl)
func WithAvailableTopics ¶
func WithAvailableTopics(topics []string) EntityStoreOption
func WithCipher ¶
func WithCipher(cipher Cipher) EntityStoreOption
func WithMaxDestinationsPerTenant ¶
func WithMaxDestinationsPerTenant(maxDestinationsPerTenant int) EntityStoreOption
type Event ¶
type Event struct { ID string `json:"id"` TenantID string `json:"tenant_id"` DestinationID string `json:"destination_id"` Topic string `json:"topic"` EligibleForRetry bool `json:"eligible_for_retry"` Time time.Time `json:"time"` Metadata Metadata `json:"metadata"` Data Data `json:"data"` Telemetry *EventTelemetry `json:"-"` }
type EventTelemetry ¶
type ListDeliveryRequest ¶
type ListDeliveryRequest struct {
EventID string
}
type ListDestinationByTenantOpts ¶
type ListDestinationByTenantOpts struct {
Filter *DestinationFilter
}
func WithDestinationFilter ¶
func WithDestinationFilter(filter DestinationFilter) ListDestinationByTenantOpts
type ListEventRequest ¶
type LogStore ¶
type LogStore interface { ListEvent(context.Context, ListEventRequest) ([]*Event, string, error) RetrieveEvent(ctx context.Context, tenantID, eventID string) (*Event, error) ListDelivery(ctx context.Context, request ListDeliveryRequest) ([]*Delivery, error) InsertManyEvent(context.Context, []*Event) error InsertManyDelivery(context.Context, []*Delivery) error }
func NewLogStore ¶
func NewLogStore(chDB clickhouse.DB) LogStore
type Metadata ¶
func (*Metadata) UnmarshalBinary ¶
type Topics ¶
type Topics []string
func TopicsFromString ¶
func (*Topics) MarshalBinary ¶
func (*Topics) MarshalJSON ¶
func (*Topics) MatchesAll ¶
func (*Topics) UnmarshalBinary ¶
func (*Topics) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.