spinbroker

package
v0.0.0-...-c0b5b33 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "spin-broker"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [6]string{"new", "add", "enqueue", "status", "next", "complete"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeRecordNotFound

func MakeRecordNotFound(err error) *goa.ServiceError

MakeRecordNotFound builds a goa.ServiceError from an error.

func NewAddEndpoint

func NewAddEndpoint(s Service) goa.Endpoint

NewAddEndpoint returns an endpoint function that calls the method "add" of service "spin-broker".

func NewCompleteEndpoint

func NewCompleteEndpoint(s Service) goa.Endpoint

NewCompleteEndpoint returns an endpoint function that calls the method "complete" of service "spin-broker".

func NewEnqueueEndpoint

func NewEnqueueEndpoint(s Service) goa.Endpoint

NewEnqueueEndpoint returns an endpoint function that calls the method "enqueue" of service "spin-broker".

func NewNewEndpoint

func NewNewEndpoint(s Service) goa.Endpoint

NewNewEndpoint returns an endpoint function that calls the method "new" of service "spin-broker".

func NewNextEndpoint

func NewNextEndpoint(s Service) goa.Endpoint

NewNextEndpoint returns an endpoint function that calls the method "next" of service "spin-broker".

func NewStatusEndpoint

func NewStatusEndpoint(s Service) goa.Endpoint

NewStatusEndpoint returns an endpoint function that calls the method "status" of service "spin-broker".

Types

type AddPayload

type AddPayload struct {
	// Package ID
	ID string
	// Resource name
	Resource string
	// Action name
	Action string
	// Action parameters
	Parameters map[string]interface{}
	// Dependency UUIDs
	Dependencies []string
}

AddPayload is the payload type of the spin-broker service add method.

type Client

type Client struct {
	NewEndpoint      goa.Endpoint
	AddEndpoint      goa.Endpoint
	EnqueueEndpoint  goa.Endpoint
	StatusEndpoint   goa.Endpoint
	NextEndpoint     goa.Endpoint
	CompleteEndpoint goa.Endpoint
}

Client is the "spin-broker" service client.

func NewClient

func NewClient(new, add, enqueue, status, next, complete goa.Endpoint) *Client

NewClient initializes a "spin-broker" service client given the endpoints.

func (*Client) Add

func (c *Client) Add(ctx context.Context, p *AddPayload) (res string, err error)

Add calls the "add" endpoint of the "spin-broker" service.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, p *CompletePayload) (err error)

Complete calls the "complete" endpoint of the "spin-broker" service.

func (*Client) Enqueue

func (c *Client) Enqueue(ctx context.Context, p *EnqueuePayload) (res []string, err error)

Enqueue calls the "enqueue" endpoint of the "spin-broker" service.

func (*Client) New

func (c *Client) New(ctx context.Context) (res string, err error)

New calls the "new" endpoint of the "spin-broker" service.

func (*Client) Next

func (c *Client) Next(ctx context.Context, p *NextPayload) (res *NextResult, err error)

Next calls the "next" endpoint of the "spin-broker" service. Next may return the following errors:

  • "record_not_found" (type *goa.ServiceError)
  • error: internal error

func (*Client) Status

func (c *Client) Status(ctx context.Context, p *StatusPayload) (res *StatusResult, err error)

Status calls the "status" endpoint of the "spin-broker" service. Status may return the following errors:

  • "record_not_found" (type *goa.ServiceError)
  • error: internal error

type CompletePayload

type CompletePayload struct {
	// Command ID
	ID string
	// status of work
	Status bool
	// reason of success/failure
	StatusReason *string
}

CompletePayload is the payload type of the spin-broker service complete method.

type Endpoints

type Endpoints struct {
	New      goa.Endpoint
	Add      goa.Endpoint
	Enqueue  goa.Endpoint
	Status   goa.Endpoint
	Next     goa.Endpoint
	Complete goa.Endpoint
}

Endpoints wraps the "spin-broker" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "spin-broker" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "spin-broker" service endpoints.

type EnqueuePayload

type EnqueuePayload struct {
	// Package ID
	ID string
}

EnqueuePayload is the payload type of the spin-broker service enqueue method.

type NextPayload

type NextPayload struct {
	// resource type
	Resource string
}

NextPayload is the payload type of the spin-broker service next method.

type NextResult

type NextResult struct {
	// Command ID
	UUID string
	// resource type
	Resource string
	// action name
	Action string
	// Action parameters
	Parameters map[string]json.RawMessage
}

NextResult is the result type of the spin-broker service next method.

type Service

type Service interface {
	// Create a new package; a collection of items to join into the queue
	// simultaneously
	New(context.Context) (res string, err error)
	// Add a command to the package
	Add(context.Context, *AddPayload) (res string, err error)
	// Enqueue the package into the various resource queues
	Enqueue(context.Context, *EnqueuePayload) (res []string, err error)
	// Get the status for a package
	Status(context.Context, *StatusPayload) (res *StatusResult, err error)
	// Get the next command for a given resource
	Next(context.Context, *NextPayload) (res *NextResult, err error)
	// Mark a command as completed with a result status
	Complete(context.Context, *CompletePayload) (err error)
}

The message broker for the other services

type StatusPayload

type StatusPayload struct {
	// Package ID
	ID string
}

StatusPayload is the payload type of the spin-broker service status method.

type StatusResult

type StatusResult struct {
	// Pass/Fail status
	Status bool
	// Failure reason (if any)
	Reason *string
	// Failure causer as UUID (if any)
	Causer *string
}

StatusResult is the result type of the spin-broker service status method.

Jump to

Keyboard shortcuts

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