direktiv

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Overview

* * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * modified DNS resolver for direktiv

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"
	// TLSCA cert CA
	TLSCA = "/etc/certs/direktiv/ca.crt"
)
View Source
const (
	DirektivActionIDHeader    = "Direktiv-ActionID"
	DirektivInstanceIDHeader  = "Direktiv-InstanceID"
	DirektivExchangeKeyHeader = "Direktiv-ExchangeKey"
	DirektivPingAddrHeader    = "Direktiv-PingAddr"
	DirektivDeadlineHeader    = "Direktiv-Deadline"
	DirektivTimeoutHeader     = "Direktiv-Timeout"
	DirektivStepHeader        = "Direktiv-Step"
	DirektivResponseHeader    = "Direktiv-Response"
	DirektivNamespaceHeader   = "Direktiv-Namespace"
	DirektivSourceHeader      = "Direktiv-Source"
	DirektivFileHeader        = "Direktiv-Files"

	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 (
	CancelIsolate = iota
	CancelSubflow
	CancelTimer
	CancelInstanceTimers
	AddCron
)

direktiv pub/sub items

View Source
const ApiSync = "apisync"
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

View Source
var EnableSRVLookups = false

EnableSRVLookups controls whether the DNS resolver attempts to fetch gRPCLB addresses from SRV records. Must not be changed after init time.

Functions

func AddGlobalGRPCDialOption added in v0.2.3

func AddGlobalGRPCDialOption(opt grpc.DialOption)

func AddGlobalGRPCServerOption added in v0.2.3

func AddGlobalGRPCServerOption(opt grpc.ServerOption)

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 InstanceMemory added in v0.2.3

func InstanceMemory(rec *ent.WorkflowInstance) ([]byte, error)

func NewBuilder added in v0.3.4

func NewBuilder() resolver.Builder

NewBuilder creates a dnsBuilder which is used to factory DNS resolvers.

func NewInternalError

func NewInternalError(err error) error

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
		MaxScale int
	} `toml:"flowAPI"`

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

	Database struct {
		DB string
	}

	InstanceLogging struct {
		Driver string
	}

	VariablesStorage struct {
		Driver string
	}

	Isolates struct {
		CleanupPods int
	} `toml:"isolates"`
}

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 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 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) GetConfig added in v0.3.4

func (s *WorkflowServer) GetConfig() Config

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) SetVariableStorage added in v0.2.3

func (s *WorkflowServer) SetVariableStorage(vs varstore.VarStorage)

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