task

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: MPL-2.0 Imports: 41 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectIdFieldIsRequired  = errors.New("project_id field should be a string")
	ErrProjectIdFieldIsNotString = errors.New("project_id field does not exist on the document")
)
View Source
var (
	ErrDeliveryAttemptFailed = errors.New("error sending event")
	ErrRateLimit             = errors.New("rate limit error")
)
View Source
var ErrInvalidEmailPayload = errors.New("invalid email payload")
View Source
var ErrInvalidNotificationPayload = errors.New("invalid notification payload")
View Source
var ErrInvalidNotificationType = errors.New("invalid notification type")
View Source
var ErrInvalidSlackPayload = errors.New("invalid slack payload")
View Source
var (
	ErrMetaEventDeliveryFailed = errors.New("meta event delivery failed")
)

Functions

func DeleteArchivedTasks added in v1.1.6

func DeleteArchivedTasks(r queue.Queuer, rd *rdb.Redis) func(context.Context, *asynq.Task) error

func ExpireSecret added in v0.7.2

func ExpireSecret(a datastore.EndpointRepository) func(ctx context.Context, t *asynq.Task) error

func ExportCollection added in v0.6.0

func ExportCollection(
	ctx context.Context, tableName string, exportDir string, expDate time.Time,
	objectStoreClient objectstore.ObjectStore, project *datastore.Project,
	eventRepo datastore.EventRepository, eventDeliveriesRepo datastore.EventDeliveryRepository,
	projectRepo datastore.ProjectRepository, exportRepo datastore.ExportRepository, searcher searcher.Searcher,
) error

func GeneralTokenizerHandler added in v1.1.6

func GeneralTokenizerHandler(projectRepository datastore.ProjectRepository, eventRepo datastore.EventRepository, jobRepo datastore.JobRepository) func(context.Context, *asynq.Task) error

func GetArgsByCollection added in v0.6.0

func GetArgsByCollection(tableName string, exportDir string, project *datastore.Project) string

func GetRetryDelay added in v0.6.0

func GetRetryDelay(n int, err error, t *asynq.Task) time.Duration

func MonitorTwitterSources added in v0.6.0

func MonitorTwitterSources(db database.Database, queue queue.Queuer) func(context.Context, *asynq.Task) error

func NewObjectStoreClient added in v0.6.0

func NewObjectStoreClient(storage *datastore.StoragePolicyConfiguration) (objectstore.ObjectStore, string, error)

func ProcessDeadLetters

func ProcessDeadLetters(job *queue.Job)

func ProcessDynamicEventCreation added in v1.1.6

func ProcessDynamicEventCreation(endpointRepo datastore.EndpointRepository, eventRepo datastore.EventRepository, projectRepo datastore.ProjectRepository, eventDeliveryRepo datastore.EventDeliveryRepository, cache cache.Cache, eventQueue queue.Queuer, subRepo datastore.SubscriptionRepository, deviceRepo datastore.DeviceRepository) func(context.Context, *asynq.Task) error

func ProcessEmails added in v0.6.5

func ProcessEmails(sc smtp.SmtpClient) func(context.Context, *asynq.Task) error

func ProcessEventCreation added in v0.6.5

func ProcessEventCreation(endpointRepo datastore.EndpointRepository, eventRepo datastore.EventRepository, projectRepo datastore.ProjectRepository, eventDeliveryRepo datastore.EventDeliveryRepository, cache cache.Cache, eventQueue queue.Queuer, subRepo datastore.SubscriptionRepository, deviceRepo datastore.DeviceRepository) func(context.Context, *asynq.Task) error

func ProcessEventDelivery

func ProcessEventDelivery(endpointRepo datastore.EndpointRepository, eventDeliveryRepo datastore.EventDeliveryRepository, projectRepo datastore.ProjectRepository, subRepo datastore.SubscriptionRepository, notificationQueue queue.Queuer) func(context.Context, *asynq.Task) error

func ProcessMetaEvent added in v1.1.6

func ProcessMetaEvent(projectRepo datastore.ProjectRepository, metaEventRepo datastore.MetaEventRepository) func(context.Context, *asynq.Task) error

func ProcessNotifications added in v0.6.5

func ProcessNotifications(sc smtp.SmtpClient) func(context.Context, *asynq.Task) error

func RetentionPolicies added in v0.9.0

func RetentionPolicies(configRepo datastore.ConfigurationRepository, projectRepo datastore.ProjectRepository, eventRepo datastore.EventRepository, eventDeliveriesRepo datastore.EventDeliveryRepository, exportRepo datastore.ExportRepository, searcher searcher.Searcher) func(context.Context, *asynq.Task) error

func RetryEventDeliveries added in v0.6.0

func RetryEventDeliveries(statuses []datastore.EventDeliveryStatus, lookBackDuration string, db database.Database, eventQueue queue.Queuer)

func TokenizerHandler added in v1.1.6

func TokenizerHandler(eventRepo datastore.EventRepository, jobRepo datastore.JobRepository) func(context.Context, *asynq.Task) error

func ValidateEndpointAuthentication added in v1.1.6

func ValidateEndpointAuthentication(auth *datastore.EndpointAuthentication) (*datastore.EndpointAuthentication, error)

Types

type CreateEvent added in v0.8.0

type CreateEvent struct {
	Event              datastore.Event
	CreateSubscription bool
}

type EndpointError

type EndpointError struct {
	Err error
	// contains filtered or unexported fields
}

func (*EndpointError) Delay

func (e *EndpointError) Delay() time.Duration

func (*EndpointError) Error

func (e *EndpointError) Error() string

type EventDelivery added in v0.9.0

type EventDelivery struct {
	EventDeliveryID string
	ProjectID       string
}

type EventDeliveryConfig added in v0.7.0

type EventDeliveryConfig struct {
	// contains filtered or unexported fields
}

type IndexDocument added in v1.1.6

type IndexDocument struct {
	// contains filtered or unexported fields
}

func NewIndexDocument added in v1.1.6

func NewIndexDocument(cfg config.Configuration) (*IndexDocument, error)

func (*IndexDocument) ProcessTask added in v1.1.6

func (id *IndexDocument) ProcessTask(_ context.Context, t *asynq.Task) error

type MetaEvent added in v1.1.6

type MetaEvent struct {
	MetaEventID string
	ProjectID   string
}

type Payload added in v0.7.2

type Payload struct {
	EndpointID string `json:"endpoint_id"`
	SecretID   string `json:"secret_id"`
	ProjectID  string `json:"project_id"`
}

type RateLimitConfig added in v0.7.0

type RateLimitConfig struct {
	Count    int
	Duration time.Duration
}

type RateLimitError added in v0.6.0

type RateLimitError struct {
	Err error
	// contains filtered or unexported fields
}

func (*RateLimitError) Delay added in v0.6.0

func (e *RateLimitError) Delay() time.Duration

func (*RateLimitError) Error added in v0.6.0

func (e *RateLimitError) Error() string

func (*RateLimitError) RateLimit added in v0.6.0

func (e *RateLimitError) RateLimit()

type RetryConfig added in v0.7.0

type RetryConfig struct {
	Type       datastore.StrategyProvider
	Duration   uint64
	RetryCount uint64
}

type SignatureValues added in v0.5.3

type SignatureValues struct {
	HMAC      string
	Timestamp string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL