-
Notifications
You must be signed in to change notification settings - Fork 366
fireflyAPI distributed API
Distributed mainly encapsulates communication methods among service processes. The call to interface of child nodes and root nodes processes all returns deferred objects. You can read the “Deferred object” part in Twisted about the using of deferred objects.
Child object corresponds with a service process object that connects this server process. We call it child node object.
Obtain name of child node
type method
//cwd firefly/ distributed / child.py
Params getName()
Return name of node
set child node channel
type method
//cwd firefly/ distributed / child.py
Params setTransport(transport)
Transport: agent channel instance, instance type
Callback the interface of child node
type method
//cwd firefly/ distributed / child.py
Params allbackChild(*args,*kw)
Import parameter args, to callChild , return the deferred object that waits callchild returning result.
Child node management base class
Obtain node instance according to node id
type method
//cwd firefly/ distributed / manager.py
Params getChildById(childId)
childId: node id, int type
Return node instance
Obtain node instance according to node name
type method
//cwd firefly/ distributed / manager.py
Params getChildByName(childname)
Return node instance
Add a child node
type method
//cwd firefly/ distributed / manager.py
Params addChild(child)
Child: node instance, instance type
Add node to manager as { node id: node instance }format, if node is existed, return explanatory note.
Delete a node
type method
//cwd firefly/ distributed / manager.py
Params dropChild(child)
Child: node instance, instance type
Delete node from manager
delete a node according to node ID
type method
//cwd firefly/ distributed / manager.py
Params dropChildByID(childId)
childId: node id, int type
Delete the node in node manager according to the node id
Call interface of child node
type method
//cwd firefly/ distributed / manager.py
Params callChild(childId,*args,**kw)
childId: child node id
Obtain child node instance according to node id, call the interface of child node ,return the deferred object.
Call interface of child node according to node name
type method
//cwd firefly/ distributed / manager.py
Params callChildByName(childname,*args,**kw)
Childname: child node name
Obtain child node instance according to node name, call the interface of child node ,return the deferred object.
Realize remote call object in child node service process. You can call the interface method in root node process via this object.
Set node name
type method
//cwd firefly/ distributed / node.py
Params setName(name)
Name: node name, str type
Set node name as ‘name’
obtain node name
type method
//cwd firefly/ distributed / node.py
Params getName()
Return string of node name
Initialize remote call object and connects root node
type method
//cwd firefly/ distributed / node.py
Params connect(addr)
Addr: remote connection’s address, tuple type. (host name, port number) example: ((‘localhost’,8888)
Set service object, this service object manages the interface methods that are available to call by root node.
type method
//cwd firefly/ distributed / node.py
Params addServiceChannel(service)
Service: service class in //cwd firefly/ utils/ services.py
Send agent channel objects to remote server
type method
//cwd firefly/ distributed / node.py
Params takeProxy()
Remote call the interface methods in root node
type method
//cwd firefly/ distributed / node.py
Params callRemote(commandId,*args,**kw)
commandId: command number, int type
Remote call the method (command number: commandId) in root node
Agent channel
Add a service channel
type method
//cwd firefly/ distributed / reference.py
Params addService(service)
Service: service channel instance, instance type
Send data in an agent way
type method
//cwd firefly/ distributed / reference.py
Params remote_callChild(command,*arg,**kw)
PB: protocol, root node object.
Set service object, this service object manages the interface methods that are available to call by root node.
type method
//cwd firefly/ distributed / root.py
Params addServiceChannel(service)
Service: service object instance, instance type
Set agent channel
type method
//cwd firefly/ distributed / root.py
Params remote_takeProxy(name,transport)
Name: child node name id as well as child node name
Transport: agent channel instance, instance type
Instantiate child node, add child node to node manager and set node agent channel as transport.
Remote call methods
type method
//cwd firefly/ distributed / root.py
Params remote_callTarget(command,*args,**kw)
Command: command number, int type
Remote call method (command number: command) in root node
Delete child node records
type method
//cwd firefly/ distributed / root.py
Params dropChild(*args,**kw)
Delete child nodes in node manager
Delete child node records according to ID
type method
//cwd firefly/ distributed / root.py
Params dropChildByID(childId)
ChildId: child node id
Call the interface of child node
type method
//cwd firefly/ distributed / root.py
Params callChild(key,*args,**kw)
Key: child node id
Obtain child node instance via child node id, call the interface of child node and return deferred objects.
Call the interface of child node
type method
//cwd firefly/ distributed / root.py
Params callChildByName(childname,*args,**kw)
Childname: child node name
Obtain child node instance via child node name, call the interface of child node and return deferred objects.