IEchoNodeManager Interface
The IEchoNodeManager interface is a helper interface to manage the nodes registered in the local database. It's also used to register the self node.
You can get the IEchoNodeManager interface form the TEcho object using the TEcho.GetNodeManager method:
NodeManager := Echo.GetNodeManager;
This interface has methods that receive and return object instances (like TEchoNode objects). The interface manages such instances, meaning that you don't need to destroy them. But note that once the interface reference count reaches zero and then destroyed, all the objects it manages are also destroyed. Pay attention to that when reusing objects returned by the interface.
Methods
Name | Description |
---|---|
function SelfNode: TEchoNode; | Retrieves the TEchoNode object representing the self node. If no self node is registered, nil is returned. The TEchoNode object is destroyed when the node manager is destroyed. |
procedure DefineSelfNode(const NodeId: string); | Defines an existing node entry as the self node for the database. The node must be already created and the NodeId parameter must contain the id of the node. |
function CreateNode(const Id: string): TEchoNode; | Creates a new node entry in the local database, with the specified Id. The newly created TEchoNode object with that id, representing the node entry, is returned. The node entry is just created in the local database and doesn't imply a communication with a remote node. You will rarely use this method besides for the purpose of creating the self node. For other node entries, you should register remote nodes using the IEchoRemoteNode interface. If a node with that Id already exists, an exception will be raised. The TEchoNode object is destroyed when the node manager is destroyed. |