middleware

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoordinatingCheckService

type CoordinatingCheckService struct {
	influxdb.CheckService

	Now func() time.Time
	// contains filtered or unexported fields
}

CoordinatingCheckService acts as a CheckService decorator that handles coordinating the api request with the required task control actions asynchronously via a message dispatcher

func NewCheckService

func NewCheckService(cs influxdb.CheckService, ts influxdb.TaskService, coordinator Coordinator) *CoordinatingCheckService

NewCheckService constructs a new coordinating check service

func (*CoordinatingCheckService) CreateCheck

func (cs *CoordinatingCheckService) CreateCheck(ctx context.Context, c influxdb.CheckCreate, userID influxdb.ID) error

CreateCheck Creates a check and Publishes the change it can be scheduled.

func (*CoordinatingCheckService) DeleteCheck

func (cs *CoordinatingCheckService) DeleteCheck(ctx context.Context, id influxdb.ID) error

DeleteCheck delete the check and publishes the change, to allow the task owner to find out about this change faster.

func (*CoordinatingCheckService) PatchCheck

PatchCheck Updates a check and publishes the change so the task owner can act on the update

func (*CoordinatingCheckService) UpdateCheck

UpdateCheck Updates a check and publishes the change so the task owner can act on the update

type CoordinatingNotificationRuleStore

type CoordinatingNotificationRuleStore struct {
	influxdb.NotificationRuleStore

	Now func() time.Time
	// contains filtered or unexported fields
}

CoordinatingNotificationRuleStore acts as a NotificationRuleStore decorator that handles coordinating the api request with the required task control actions asynchronously via a message dispatcher

func NewNotificationRuleStore

NewNotificationRuleStore constructs a new coordinating notification service

func (*CoordinatingNotificationRuleStore) CreateNotificationRule

CreateNotificationRule Creates a notification and Publishes the change it can be scheduled.

func (*CoordinatingNotificationRuleStore) DeleteNotificationRule

func (ns *CoordinatingNotificationRuleStore) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error

DeleteNotificationRule delete the notification and publishes the change, to allow the task owner to find out about this change faster.

func (*CoordinatingNotificationRuleStore) PatchNotificationRule

PatchNotificationRule Updates a notification and publishes the change so the task owner can act on the update

func (*CoordinatingNotificationRuleStore) UpdateNotificationRule

UpdateNotificationRule Updates a notification and publishes the change so the task owner can act on the update

type CoordinatingTaskService

type CoordinatingTaskService struct {
	influxdb.TaskService
	// contains filtered or unexported fields
}

CoordinatingTaskService acts as a TaskService decorator that handles coordinating the api request with the required task control actions asynchronously via a message dispatcher

func New

func New(service influxdb.TaskService, coordinator Coordinator, opts ...Option) *CoordinatingTaskService

New constructs a new coordinating task service

func (*CoordinatingTaskService) CancelRun

func (s *CoordinatingTaskService) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error

CancelRun Cancel the run and publish the cancelation.

func (*CoordinatingTaskService) CreateTask

CreateTask Creates a task in the existing task service and Publishes the change so any TaskD service can lease it.

func (*CoordinatingTaskService) DeleteTask

func (s *CoordinatingTaskService) DeleteTask(ctx context.Context, id influxdb.ID) error

DeleteTask delete the task and publishes the change, to allow the task owner to find out about this change faster.

func (*CoordinatingTaskService) ForceRun

func (s *CoordinatingTaskService) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)

ForceRun create the forced run in the task system and publish to the pubSub.

func (*CoordinatingTaskService) RetryRun

func (s *CoordinatingTaskService) RetryRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)

RetryRun calls retry on the task service and publishes the retry.

func (*CoordinatingTaskService) UpdateTask

UpdateTask Updates a task and publishes the change so the task owner can act on the update

type Coordinator

type Coordinator interface {
	TaskCreated(context.Context, *influxdb.Task) error
	TaskUpdated(ctx context.Context, from, to *influxdb.Task) error
	TaskDeleted(context.Context, influxdb.ID) error
	RunCancelled(ctx context.Context, runID influxdb.ID) error
	RunRetried(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
	RunForced(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
}

Coordinator is a type which is used to react to task related actions

type Option

type Option func(*CoordinatingTaskService)

Option is a functional option for the coordinating task service

func WithNowFunc

func WithNowFunc(fn func() time.Time) Option

WithNowFunc sets the now func used to derive time

Jump to

Keyboard shortcuts

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