message

package
v0.0.0-...-e9fe98c Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: MIT Imports: 0 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrCritcal = iota
	ErrOverQuota
)

* Constants to represent error types. * * ErrCritical is a critical provider error. * ErrOverQuota is an over quota warning.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audit

type Audit struct {
	Type    string       `json:"type"`
	Options *AuditOption `json:"options,omitempty"`
}

Audit describes an audit type with its options.

type AuditOption

type AuditOption struct {
	Standard         string `json:"standard,omitempty"`
	Report           string `json:"report,omitempty"`
	Encoding         string `json:"encoding,omitempty"`
	RuntimeSet       string `json:"runtime-set,omitempty"`
	Ignore           string `json:"ignore,omitempty"`
	StandardOverride string `json:"standard-override,omitempty"`
}

AuditOption describes specific options for an Audit.

type Message

type Message struct {
	ResponseAPIEndpoint string  `json:"response_api_endpoint"`
	PayloadType         string  `json:"payload_type"`
	Title               string  `json:"title"`
	Content             string  `json:"content"`
	Slug                string  `json:"slug"`
	ProjectType         string  `json:"project_type,omitempty"`
	SourceURL           string  `json:"source_url"`
	SourceType          string  `json:"source_type"`
	RequestClient       string  `json:"request_client"`
	Force               bool    `json:"force"`
	Visibility          string  `json:"visibility"`
	ExternalRef         *string `json:"external_ref,omitempty"`
	// @todo: Legacy fields. Need to deprecate over time.
	Standards []string `json:"standards,omitempty"`
	Audits    []*Audit `json:"audits,omitempty"`
}

Message represents a task to read from or send to a queue.

type Provider

type Provider interface {
	SendMessage(msg *Message) error
	GetNextMessage() (*Message, error)
	DeleteMessage(ref *string) error
	Close() error
}

Provider is an interface for creating new providers. E.g. firestore, mongo, sqs.

type ProviderError

type ProviderError struct {
	Type int
	// contains filtered or unexported fields
}

ProviderError is a new error type for message providers.

func NewProviderError

func NewProviderError(s string) *ProviderError

NewProviderError creates a new error object with the provided string as the message.

func (ProviderError) Error

func (p ProviderError) Error() string

type QueueMessage

type QueueMessage struct {
	Created        int64    `json:"created" firestore:"created"`
	Lock           int64    `json:"lock" firestore:"lock"`
	Message        *Message `json:"message" firestore:"message"`
	Retries        int64    `json:"retries" firestore:"retries"`
	Status         string   `json:"status" firestore:"status"`
	RetryAvailable bool     `json:"retry_available" firestore:"retry_available"`
}

QueueMessage defines how messages are stored in a document store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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