direktiv

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DirektivDebug enables debug on dirtektiv applications
	DirektivDebug = "DIREKTIV_DEBUG"

	// DBConn database connection
	DBConn = "DIREKTIV_DB"
)
View Source
const (

	// TLSCert cert
	TLSCert = "/etc/certs/direktiv/tls.crt"
	// TLSKey key
	TLSKey = "/etc/certs/direktiv/tls.key"
)
View Source
const (
	DirektivActionIDHeader    = "Direktiv-ActionID"
	DirektivInstanceIDHeader  = "Direktiv-InstanceID"
	DirektivExchangeKeyHeader = "Direktiv-ExchangeKey"
	DirektivPingAddrHeader    = "Direktiv-PingAddr"
	DirektivTimeoutHeader     = "Direktiv-Timeout"
	DirektivStepHeader        = "Direktiv-Step"
	DirektivResponseHeader    = "Direktiv-Response"
	DirektivNamespaceHeader   = "Direktiv-Namespace"

	DirektivErrorCodeHeader    = "Direktiv-ErrorCode"
	DirektivErrorMessageHeader = "Direktiv-ErrorMessage"
)

headers for flow->container communication

View Source
const (
	ServiceResponseNoError = ""
	ServiceErrorInternal   = "au.com.direktiv.error.internal"
	ServiceErrorImage      = "au.com.direktiv.error.image"
	ServiceErrorNetwork    = "au.com.direktiv.error.network"
	ServiceErrorIO         = "au.com.direktiv.error.io"
)

internal error codes for knative services

View Source
const (
	AddTimerSync = iota
	DeleteTimerSync
	EnableTimerSync
	DisableTimerSync
	CancelIsolate
	CancelSubflow
)

direktiv pub/sub items

View Source
const FlowSync = "flowsync"

FlowSync is the name of postgres pubsub channel

View Source
const (
	// WorkflowStateSubscription is the channel that runs workflow states.
	WorkflowStateSubscription = "workflow-state"
)

Variables

View Source
var (
	ErrCodeJQBadQuery        = "direktiv.jq.badCommand"
	ErrCodeJQNotObject       = "direktiv.jq.notObject"
	ErrCodeMultipleErrors    = "direktiv.workflow.multipleErrors"
	ErrCodeAllBranchesFailed = "direktiv.parallel.allFailed"
)

internal errors

Functions

func GetEndpointTLS added in v0.2.1

func GetEndpointTLS(endpoint string, rr bool) (*grpc.ClientConn, error)

GetEndpointTLS creates a grpc client

func GrpcStart added in v0.2.1

func GrpcStart(server **grpc.Server, name, bind string, register func(srv *grpc.Server)) error

GrpcStart starts a grpc server

func SyncSubscribeTo added in v0.2.1

func SyncSubscribeTo(dbConnString string, topic int,
	fn func(interface{})) error

SyncSubscribeTo subscribes to direktiv interna postgres pub/sub

func WrapCatchableError

func WrapCatchableError(msg string, err error) error

Types

type CatchableError

type CatchableError struct {
	Code    string `json:"code"`
	Message string `json:"msg"`
}

func NewCatchableError

func NewCatchableError(code string, msg string, a ...interface{}) *CatchableError

func (*CatchableError) Error

func (err *CatchableError) Error() string

type CmdErrorResponse

type CmdErrorResponse struct {
	Error string    `json:"error"`
	Type  ErrorType `json:"type"`
}

CmdErrorResponse struct for responding when command has an error

type Config

type Config struct {
	FlowAPI struct {
		Bind                string
		Endpoint            string
		Exchange            string
		Sidecar             string
		Protocol            string
		KubernetesNamespace string
		Registry            struct {
			Name, User, Token string
		}
	} `toml:"flowAPI"`

	IngressAPI struct {
		Bind     string
		Endpoint string
	} `toml:"ingressAPI"`

	SecretsAPI struct {
		Bind     string
		Endpoint string
		DB       string
	} `toml:"secretsAPI"`

	Database struct {
		DB string
	}

	InstanceLogging struct {
		Driver string
	}

	Registries map[string]string
	MockupMode int
}

Config is the configuration for workflow and runner server

func ReadConfig

func ReadConfig(file string) (*Config, error)

ReadConfig reads the configuration file and overwrites with environment variables if set

type ErrorType

type ErrorType int

ErrorType types of errors direktiv commands can return

const (
	DirektivError ErrorType = iota
	// Ent Errors
	ValidationError
	NotFoundError
	NotSingularError
	NotLoadedError
	ConstraintError
)

func GetErrorType

func GetErrorType(err error) ErrorType

GetErrorType get Error Type from passed error

type InternalError

type InternalError struct {
	Err      error
	Function string
	File     string
	Line     int
}

func NewInternalError

func NewInternalError(err error) *InternalError

func NewInternalErrorWithDepth

func NewInternalErrorWithDepth(err error, depth int) *InternalError

func (*InternalError) Error

func (err *InternalError) Error() string

func (*InternalError) Unwrap

func (err *InternalError) Unwrap() error

type KubeResolver added in v0.2.1

type KubeResolver struct {
}

KubeResolver ...

func NewResolver added in v0.2.1

func NewResolver() *KubeResolver

NewResolver returns a resolve for kubernetes

func (*KubeResolver) Close added in v0.2.1

func (r *KubeResolver) Close()

Close closes the resoolver

func (*KubeResolver) ResolveNow added in v0.2.1

func (r *KubeResolver) ResolveNow(o resolver.ResolveNowOptions)

ResolveNow does nothing in our case

type KubeResolverBuilder added in v0.2.1

type KubeResolverBuilder struct {
}

KubeResolverBuilder ...

func (*KubeResolverBuilder) Build added in v0.2.1

Build ...

func (*KubeResolverBuilder) Scheme added in v0.2.1

func (b *KubeResolverBuilder) Scheme() string

Scheme returns the default scheme for this reoslver

type ServiceResponse added in v0.2.0

type ServiceResponse struct {
	ErrorCode    string      `json:"errorCode"`
	ErrorMessage string      `json:"errorMessage"`
	Data         interface{} `json:"data"`
}

ServiceResponse is the response structure for internal knative services

type SyncRequest added in v0.2.0

type SyncRequest struct {
	Cmd    int
	Sender uuid.UUID
	ID     interface{}
}

SyncRequest sync maintenance requests between instances subscribed to FlowSync

type UncatchableError

type UncatchableError struct {
	Code    string
	Message string
}

func NewUncatchableError

func NewUncatchableError(code, msg string, a ...interface{}) *UncatchableError

func (*UncatchableError) Error

func (err *UncatchableError) Error() string

type WorkflowServer

type WorkflowServer struct {
	LifeLine chan bool
	// contains filtered or unexported fields
}

WorkflowServer is a direktiv server

func NewWorkflowServer

func NewWorkflowServer(config *Config) (*WorkflowServer, error)

NewWorkflowServer creates a new workflow server

func (*WorkflowServer) Kill

func (s *WorkflowServer) Kill()

Kill kills the server

func (*WorkflowServer) Lifeline

func (s *WorkflowServer) Lifeline() chan bool

Lifeline interface impl

func (*WorkflowServer) Run

func (s *WorkflowServer) Run() error

Run starts all components of direktiv

func (*WorkflowServer) SetInstanceLogger

func (s *WorkflowServer) SetInstanceLogger(l dlog.Log)

SetInstanceLogger set logger for direktiv for firecracker instances

func (*WorkflowServer) Stop

func (s *WorkflowServer) Stop()

Stop stops the server gracefully

Jump to

Keyboard shortcuts

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