Documentation
¶
Index ¶
- Constants
- Variables
- func GetVersion() string
- func NewDefaultState() data.Map
- func NewError(service, action string, err error) error
- func Run(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) GetHostAndSSHPort(target *url.Resource) (string, int)
- func (s *AbstractService) ID() 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) 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) 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 *url.Resource) (*url.Resource, error)
- func (c *Context) IsClosed() bool
- func (c *Context) MakeAsyncSafe() *msg.Events
- func (c *Context) Manager() (Manager, error)
- func (c *Context) NewRequest(serviceName, action string) (interface{}, 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) SetState(state data.Map)
- func (c *Context) State() data.Map
- type Error
- 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 Namespace = "github.com/viant/endly/"
Namespace represents endly namespace
Variables ¶
var Registry = ®istry
Registry global service provider registry
var UdfRegistry = make(map[string]func(source interface{}, state data.Map) (interface{}, error))
UdfRegistry represents a udf 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 ¶
NewDefaultState returns a new default state. It comes with the following registered keys:
- rand - random int64
- date - current date formatted as yyyy-MM-dd
- time - current time formatted as yyyy-MM-dd hh:mm:ss
- ts - current timestamp formatted as yyyyMMddhhmmSSS
- timestamp.XXX - timestamp in ms where XXX is time diff expression i.e 3DaysAgo, tomorrow, hourAhead
- unix.XXX - timestamp in sec where XXX is time diff expression i.e 3DaysAgo, tomorrow, hourAhead
- tzTime.XXX - RFC3339 formatted time where XXX is time diff expression i.e 3DaysAgo, tomorrow, hourAhead
- tmpDir - temp directory
- uuid.next - generate unique id
- uuid.Get - returns previously generated unique id, or generate new *.env.XXX where XXX is the ID of the env variable to return
- all UFD registry functions
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) GetHostAndSSHPort ¶
func (s *AbstractService) GetHostAndSSHPort(target *url.Resource) (string, int)
GetHostAndSSHPort return host and ssh port
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) 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 *url.Resource
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) 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) MakeAsyncSafe ¶
func (*Context) NewRequest ¶
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
type Error ¶
type Error struct {
Path []string
// contains filtered or unexported fields
}
Error represents an workflow execution error
type Initializer ¶
type Initializer interface {
Init() error
}
Initializer represents generic initializer
type Manager ¶
type Manager interface {
//Name returns an application ID
Name() string
//Version returns an application version
Version() string
//Service return a workflow service for provided ID, 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)
}
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 |
|---|---|
|
cloud
|
|
|
deployment
|
|
|
example
|
|
|
rt/elogger/app
command
|
|
|
etl/transformer
module
|
|
|
ui/sso
module
|
|
|
ws/reporter
module
|
|
|
app
command
|
|
|
template/app/go/web
command
|
|
|
template/app/go/webdb/app
command
|
|
|
notify
|
|
|
system
|
|
|
test
|
|
|
proto
Package gmetric is a generated protocol buffer package.
|
Package gmetric is a generated protocol buffer package. |
|
testing
|
|
