taskqueue

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegisterValidator = func(v *validator.Validate) {
		if err := v.RegisterValidation("isValidTaskQueueState", ValidTaskQueueState); err != nil {
			panic(err)
		}
	}
	Validator = func() *validator.Validate {
		v := validator.New()
		RegisterValidator(v)
		return v
	}()
)

Functions

func ValidTaskQueueState

func ValidTaskQueueState(fl validator.FieldLevel) bool

func ValidateQueueName

func ValidateQueueName(queueName string) *util.ValidationError

Types

type TaskQueue

type TaskQueue struct {
	// UID is uuid of the queue. This can distinguish two queues with the same name in different lifecycle.
	UID    uuid.UUID `json:"uid" yaml:"uid" validate:"required"`
	Spec   TaskQueueSpec
	Status TaskQueueStatus
}

func NewTaskQueue

func NewTaskQueue(queueSpec TaskQueueSpec) *TaskQueue

type TaskQueueSpec

type TaskQueueSpec struct {
	Name  string         `json:"name" validate:"required,min=1,max=256,excludesall=:"`
	State TaskQueueState `json:"state" validate:"isValidTaskQueueState,required"`
}

func NewTaskQueueSpec

func NewTaskQueueSpec(name string, state TaskQueueState) TaskQueueSpec

func (TaskQueueSpec) Validate

func (s TaskQueueSpec) Validate() *util.ValidationError

type TaskQueueState

type TaskQueueState string
const (
	TaskQueueStateActive  TaskQueueState = "active"
	TaskQueueStateSuspend TaskQueueState = "suspend"
)

type TaskQueueStatus

type TaskQueueStatus struct {
	// CreatedAt is the timestamp of this queue
	CreatedAt time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
	// UpdatedAt is the last updated timestamp
	UpdatedAt time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
}

type TaskToDeadletterError

type TaskToDeadletterError struct {
	Body string `jsong:"body"`
	Err  string `json:"error"`
}

func NewTaskToDeadletterError

func NewTaskToDeadletterError(body string, err error) TaskToDeadletterError

func (TaskToDeadletterError) DLItem

func (e TaskToDeadletterError) DLItem() string

func (TaskToDeadletterError) Error

func (e TaskToDeadletterError) Error() string

Jump to

Keyboard shortcuts

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