runner

package
v0.0.0-...-23becbe Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderSignature = "X-Goflow-Signature"
	HeaderRequestID = "X-Goflow-RequestID"
	HeaderPID       = "X-Goflow-PID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	ProjectName       string    `json:"projectName" validate:"required"`
	ActivityName      string    `json:"activityName" validate:"required"`
	CurrentState      string    `json:"currentState" validate:"required"`
	CurrentEvent      string    `json:"currentEvent" validate:"required"`
	CurrentActionName string    `json:"currentActionName" validate:"required"`
	CurrentActionType string    `json:"currentActionType" validate:"required"`
	RetryCount        int       `json:"retryCount" validate:"required"`
	BuildAt           time.Time `json:"buildAt" validate:"required"`
}

func NewMeta

func NewMeta(projectName, activityName, currentState, currentEvent, currentActionName, currentActionType string, retryCount int) *Meta

func (*Meta) Validate

func (m *Meta) Validate() error

type MetaResponse

type MetaResponse struct {
	RequestID            string    `json:"requestID"`
	PID                  string    `json:"pid"`
	ProjectUID           string    `json:"projectUID"`
	ProjectName          string    `json:"projectName"`
	ActivityName         string    `json:"activityName"`
	State                string    `json:"state"`
	Event                string    `json:"event"`
	ActionName           string    `json:"actionName"`
	ActionType           string    `json:"actionType"`
	InternalResponseTime string    `json:"internalResponseTime"`
	ResponseSignature    string    `json:"responseSignature"`
	BuildAt              time.Time `json:"buildAt"`
}

type Request

type Request struct {
	Meta    *Meta       `json:"meta"`
	Payload interface{} `json:"payload"`
}

func (*Request) BuildSignatureFromPayload

func (r *Request) BuildSignatureFromPayload() string

type RequestHeader

type RequestHeader struct {
	RequestID string
	PID       string
	Signature string
}

type Response

type Response struct {
	Status string        `json:"status"`
	Reason string        `json:"reason,omitempty"`
	Data   interface{}   `json:"data"`
	Meta   *MetaResponse `json:"meta"`
}

type Runner

type Runner struct {
	*core.Component
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(backoffBuilder backoff.Builder, transporter Transporter) *Runner

func (*Runner) BuildData

func (r *Runner) BuildData(pid, projectUID, requestID string, meta *Meta, payload interface{})

func (*Runner) Start

func (r *Runner) Start(ctx context.Context, endpoint string) (*Response, error)

type RunnerBuilder

type RunnerBuilder interface {
	BuildData(pid, projectUID, requestID string, meta *Meta, payload interface{})
	Start(ctx context.Context, endpoint string) (*Response, error)
}

type Transporter

type Transporter interface {
	Send(ctx context.Context, endpoint string, header *RequestHeader, payload *Request) (*Response, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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