Documentation ¶
Index ¶
- Constants
- Variables
- func GetVersion() string
- func NewDefaultState(ctx *Context) data.Map
- func NewError(service, action string, err error) error
- func Run(context *Context, request, result interface{}) error
- func RunWithoutLogging(context *Context, request, result interface{}) error
- func Services(mgr interface{}) map[string]Service
- type AbstractService
- func (s *AbstractService) Actions() []string
- func (s *AbstractService) Begin(context *Context, value interface{}) msg.Event
- func (s *AbstractService) End(context *Context) func(startEvent msg.Event, value interface{}) msg.Event
- func (s *AbstractService) GetHostname(target *location.Resource) (string, int)
- func (s *AbstractService) ID() string
- func (s *AbstractService) Info() string
- func (s *AbstractService) Mutex() *sync.RWMutex
- func (s *AbstractService) Register(routes ...*Route)
- func (s *AbstractService) Route(action string) (*Route, error)
- func (s *AbstractService) Run(context *Context, request interface{}) (response *ServiceResponse)
- func (s *AbstractService) RunInBackground(context *Context, handler func() error) (err error)
- func (s *AbstractService) Sleep(context *Context, sleepTimeMs int)
- func (s *AbstractService) State() data.Map
- type ActionInfo
- type Context
- func (c *Context) AsRequest(serviceName, action string, source map[string]interface{}) (request interface{}, err error)
- func (c *Context) Background() context.Context
- func (c *Context) Clone() *Context
- func (c *Context) Close()
- func (c *Context) Deffer(functions ...func()) []func()
- func (c *Context) Expand(text string) string
- func (c *Context) ExpandResource(resource *location.Resource) (*location.Resource, error)
- func (c *Context) IsClosed() bool
- func (c *Context) IsLoggingEnabled() bool
- func (c *Context) MakeAsyncSafe() *msg.Events
- func (c *Context) Manager() (Manager, error)
- func (c *Context) NewRequest(serviceName, action string, rawRequest map[string]interface{}) (result interface{}, err error)
- func (c *Context) Publish(value interface{}) msg.Event
- func (s *Context) PublishAndRestore(values map[string]interface{}) func()
- func (c *Context) PublishWithStartEvent(value interface{}, init msg.Event) msg.Event
- func (c *Context) Service(name string) (Service, error)
- func (c *Context) SetListener(listener msg.Listener)
- func (c *Context) SetLogging(flag bool)
- func (c *Context) SetState(state data.Map)
- func (c *Context) State() data.Map
- type Error
- type Informer
- type Initializer
- type Manager
- type NopRequest
- type Route
- type Service
- type ServiceProvider
- type ServiceRegistry
- type ServiceResponse
- type UdfProvider
- type UseCase
- type Validator
Constants ¶
const AppName = "endly"
AppName represents endly application name
const EndlyPanic = "ENDLY_PANIC"
EndlyPanic env key name to skip recover in case of panic, export ENDLY_PANIC=true
const Namespace = "github.com/viant/endly/"
Namespace represents endly namespace
Variables ¶
var PredefinedUdfs = make(map[string]func(source interface{}, state data.Map) (interface{}, error))
PredefinedUdfs represents a udf registry
var Registry = ®istry
Registry global service provider registry
var UdfRegistryProvider = make(map[string]func(args ...interface{}) (func(source interface{}, state data.Map) (interface{}, error), error))
UdfRegistryProvider represents udf registry provider (i.e. to register parameterized udf dynamically)
Functions ¶
func NewDefaultState ¶
func Run ¶
Run runs action for supplied context request and response. Response has to be pointer or nil
func RunWithoutLogging ¶ added in v0.31.0
RunWithoutLogging runs action with logging disabled for supplied context request and response. Response has to be pointer or nil
Types ¶
type AbstractService ¶
AbstractService represenst an abstract service.
func NewAbstractService ¶
func NewAbstractService(id string) *AbstractService
NewAbstractService creates a new abstract service.
func (*AbstractService) Actions ¶
func (s *AbstractService) Actions() []string
Actions returns service actions
func (*AbstractService) Begin ¶
func (s *AbstractService) Begin(context *Context, value interface{}) msg.Event
Begin add starting event
func (*AbstractService) End ¶
func (s *AbstractService) End(context *Context) func(startEvent msg.Event, value interface{}) msg.Event
End adds finishing event.
func (*AbstractService) GetHostname ¶ added in v0.70.1
func (s *AbstractService) GetHostname(target *location.Resource) (string, int)
GetHostname return host and ssh port
func (*AbstractService) Info ¶ added in v0.74.2
func (s *AbstractService) Info() string
func (*AbstractService) Mutex ¶
func (s *AbstractService) Mutex() *sync.RWMutex
Mutex returns a mutex.
func (*AbstractService) Register ¶
func (s *AbstractService) Register(routes ...*Route)
Register register action routes
func (*AbstractService) Route ¶
func (s *AbstractService) Route(action string) (*Route, error)
Route returns a service action route for supplied action
func (*AbstractService) Run ¶
func (s *AbstractService) Run(context *Context, request interface{}) (response *ServiceResponse)
Run returns a service action for supplied action
func (*AbstractService) RunInBackground ¶ added in v0.29.0
func (s *AbstractService) RunInBackground(context *Context, handler func() error) (err error)
func (*AbstractService) Sleep ¶
func (s *AbstractService) Sleep(context *Context, sleepTimeMs int)
Sleep sleeps for provided time in ms
func (*AbstractService) State ¶
func (s *AbstractService) State() data.Map
State returns this service state map.
type ActionInfo ¶
ActionInfo represent an action info
type Context ¶
type Context struct { SessionID string CLIEnabled bool HasLogger bool AsyncUnsafeKeys map[interface{}]bool Secrets *secret.Service Wait *sync.WaitGroup Listener msg.Listener Source *location.Resource Debugger *debug.Debugger Logging *bool toolbox.Context // contains filtered or unexported fields }
Context represents a workflow session context/state
func (*Context) AsRequest ¶
func (c *Context) AsRequest(serviceName, action string, source map[string]interface{}) (request interface{}, err error)
AsRequest converts a source map into request for provided service and action.
func (*Context) Background ¶ added in v0.43.0
func (*Context) Close ¶
func (c *Context) Close()
Close closes this context, it executes all deferred function and set closed flag.
func (*Context) Deffer ¶
func (c *Context) Deffer(functions ...func()) []func()
Deffer add function to be executed if context closes. If returns currently registered functions.
func (*Context) ExpandResource ¶
ExpandResource substitutes any $ expression with the key value from the state map if it is present.
func (*Context) IsLoggingEnabled ¶ added in v0.26.0
IsLoggingEnabled returns tru if logging is enabled
func (*Context) MakeAsyncSafe ¶
func (*Context) NewRequest ¶
func (c *Context) NewRequest(serviceName, action string, rawRequest map[string]interface{}) (result interface{}, err error)
NewRequest creates a new request for service and action
func (*Context) Publish ¶
Publish publishes event to listeners, it updates current run details like activity workflow name etc ...
func (*Context) PublishAndRestore ¶
PublishAndRestore sets supplied value and returns func restoring original values
func (*Context) PublishWithStartEvent ¶
PublishWithStartEvent publishes event to listeners, it updates current run details like activity workflow name etc ...
func (*Context) SetListener ¶
SetListener sets context event Listener
func (*Context) SetLogging ¶ added in v0.30.2
SetLogging set logging on and off
type Error ¶
type Error struct { Path []string // contains filtered or unexported fields }
Error represents an workflow execution error
type Informer ¶ added in v0.74.2
type Informer interface {
Info() string
}
AbstractService represenst an abstract service.
type Initializer ¶
type Initializer interface {
Init() error
}
Initializer represents generic initializer
type Manager ¶
type Manager interface { //Name returns an application SessionID Name() string //Version returns an application version Version() string //Service return a workflow service for provided SessionID, request, or error Service(input interface{}) (Service, error) //Register register service in this manager Register(service Service) //NewContext returns new workflow context. NewContext(context toolbox.Context) *Context //Run run requests Run(context *Context, request interface{}) (interface{}, error) }
Manager represents a endly service manager
type NopRequest ¶
type NopRequest struct {
In interface{}
}
NopRequest represent no operation to be deprecated
type Route ¶
type Route struct { Action string RequestInfo *ActionInfo ResponseInfo *ActionInfo RequestProvider func() interface{} ResponseProvider func() interface{} Handler func(context *Context, request interface{}) (interface{}, error) OnRawRequest func(context *Context, rawRequest map[string]interface{}) error //when specified it is called each time action literal is used when match }
Route represents service action route
type Service ¶
type Service interface { //service id ID() string //service state map State() data.Map //Run service action for supported request types. Run(context *Context, request interface{}) *ServiceResponse //Route returns service action route Route(action string) (*Route, error) Mutex() *sync.RWMutex Actions() []string }
Service represents an endly service
type ServiceProvider ¶
type ServiceProvider func() Service
ServiceProvider represents a service provider
type ServiceRegistry ¶
type ServiceRegistry []ServiceProvider
ServiceRegistry represents a service registry
func (*ServiceRegistry) Register ¶
func (r *ServiceRegistry) Register(serviceProvider ServiceProvider) error
Register register service provider.
type ServiceResponse ¶
ServiceResponse service response
type UdfProvider ¶
Directories ¶
Path | Synopsis |
---|---|
example
|
|
etl/transformer
Module
|
|
ui/sso
Module
|
|
ws/reporter
Module
|
|
internal
|
|
project
Package project package project defines project model
|
Package project package project defines project model |
service
|
|
system/storage
Package storage implements storage operation
|
Package storage implements storage operation |
test/proto
Package gmetric is a generated protocol buffer package.
|
Package gmetric is a generated protocol buffer package. |