FTN6: FutoIn Invoker Concept Version: 0.1 Copyright: 2014 FutoIn Project (http://futoin.org) Authors: Andrey Galkin
This specification IS NOT mandatory. It is just a reference model. Any implementation IS ALLOWED to provide own architecture with drawback of breaking easy migration from one to another.
There must be a centralized connection and credentials manager (CCM) object. It should be possible to create multiple independent instances of such type.
Each connection end-point should have a unique associative name in scope of single CCM object. Connection end-points can be statically and/or dynamically registered/configured. More advanced implementation may use centralized service to resolve/retrieve connection end-points and related credentials on demand.
Invoker code retrieves FutoIn interface references from CCM object and invokes FutoIn interface function through special "call" method, passing function name and associative parameter map. Invocation result is returned as a map of result values.
There should be a common FutoIn exception type from which Expected and Unexpected FutoIn exception types must inherit as defined in FTN3.
By design, most Executor implementation also implement Invoker design as it is required for separation of concerns on Service/RPC level, but not single project level.
Some of interface names can be reserved for internal semantics, like runtime resolving service interface.
All names starting with hash "#" symbol are reserved for internal purpose in Invoker implementation concept.
There should be a Simple CCM, which is lightweight and designed for small memory footprint and/or high performance cases. Advanced CCM interface should inherit from the Simple one.
Advanced CCM implementation must implement a special native dummy interface, even if there is no difference with Simple one, so native link/resolve error is generated, if Simple CCM implementation is provided to Client code, which expects Advanced CCM.
Advanced CCM implementation can retrieve FutoIn interface definitions and enforce additional checks, including compile and/or run-time specialized native interface building.
In such process, FutoIn interface functions must become native interface members with every function parameter becoming native member's formal parameter. If multiple values can be returned natively, result values are mapped to those. Otherwise, map of result values is returned. If there are no result values then native member returns nothing and should complete as soon as request message is scheduled to be sent without waiting for reply.
Note: Simple CCM is not expected to parse interfaces. Therefore, all request messages must have "forcersp" flag and Simple CCM must expect response for every call.
FutoIn implementations are allowed to optimize calls within single process in implementation-defined way, keeping the same behavior between remote and local calls.
Local calls must never execute if there are Invoker frames on execution stack. It means, Invoker function must return before Executor runs or Executor must run in a different thread. Yes, it may have performance issues.
Reference Invoker concept is built around FTN12 Async API
The idea behind is that each component/library/etc. assumes that end product registers interfaces, their endpoints and possibly provides other information during initialization phase or prior to using the specific component.
Example:
// Init
AsyncSteps as;
ccm.register( as, "some_id', "some.iface:1.3", "https://..." )
ccm.alias( "some_id', "componentA.ifaceA" )
ccm.alias( "some_id', "componentB.ifaceB" )
as.add( ComponentA.init )
as.add( ComponentB.init )
as.add( startService )
// start actual execution
as.execute();
// in Component A (note minor version less than registered)
ComponentA.init()
{
ccm.assertIface( "componentA.iface", "some.iface:1.0" )
iface = ccm.iface( "componentA.iface" )
iface.someFunc()
}
// in Component B (note different minor version)
ComponentB.init()
{
ccm.assertIface( "componentB.iface", "some.iface:1.1" )
iface = ccm.iface( "componentB.iface" )
iface.someFunc()
}
ifacever must be represented as FutoIn interface identifier and version, separated by colon ":" Example: "futoin.master.service:1.0", "futoin.master.service:2.1".
Invoker implementation must ensure that major versions match and registered minor version is not less than requested minor version.
This interface is designed only if access to Derived Key is expected.
See FTN6 Interface Executor Concept
See FTN12 Async API
=END OF SPEC=