apigear-io / objectlink-core-cpp

A object link protocol for C++ 14
MIT License
0 stars 3 forks source link

refactor server side - delivery branch #24

Closed dorotaphanSiili closed 1 year ago

dorotaphanSiili commented 1 year ago

Classes extracted to separate files:

IClientNode IRemoteNode RemoteRegistry IObjectSource Remote Registry: Align interface to have only necessary methods and similar to those from client registry Add description for classes and methods Change storing (also passing and returning) nodes and object sources to weak_ptr - this way operating on objects returned by registry is safe for threads Add mutex to guard the collection of entries ( source and nodes for it) Add simple tests - no tests with threading

RemoteNode:

clean up interface and make it similar to client node add factory method that returns shared_ptr to RemoteNode instead of having public constructor. The node needs to be put in registry as a weak_ptr and it should be created as shared_ptr. Since it is itself the one who puts and removes from registry it needs to do shared_from_this. Because of that it cannot clean the registry in destructor anymore (in case some sources were unlinked for it). It has to be done from outside. The question is then if maybe it shouldn't be the one who adds to registry self. Maybe it should be done from outside, but would require passing information about linking and unlinking to owner of this class. remove broadcasting signals and properties changed to all other nodes that are used by source which asked this node to send such information (the node should not care about other nodes) removed not used and duplicated source and sink implementations for test purposes

To do:

registry thread safe test https://github.com/apigear-io/objectlink-core-cpp/issues/21 ISSUE what if mutex can't be locked in expected time https://github.com/apigear-io/objectlink-core-cpp/issues/22