...
Personally, I (Lorenz) think this is not necessary but if possible we should keep the design flexible enough to allow for a future extension.
Design v1
Brainstorming
- As is currently the case each VirtualHost should have its own registry.
- Both Sessions and Links are abstract immaterial concepts. The concrete objects are the SessionEndpoints and the LinkEndpoints.
For Sessions we already only have one object (called Session_1_0 to be aligned to the legacy protocols but this really is the SessionEndpoint).
We should do the same for Link/-Endpoints and get rid of one of them. Currently the responsibilities are very unclear and there seems to be no value. - The implementation of the registry should be hidden behind an API so for example we do not care whether sending links and receiving links are maintained in the same data structure or in separate data structures.
- We should ensure we discard the LinkEndpoint upon Detach(close=true), Detach(error), or Session#End(). Also it needs to be dissociated from the Terminus.
- Given the remote container id and the link name a lookup should return a Terminus. If the terminus is currently associated with a LinkEndpoint it should be reachable from the Terminus; if not we should be able to recreate a LinkEndpoint (and thus a Link) dynamically from the Terminus.
- Persistence of Termini and persistence of deliveryState/unsettled state should be separated. Persistence of unsettled state is out of scope for this.
- A unsettledStore should support different levels of capability in alignment with the TerminusDurability.
For example a Memory VH should not advertise any TerminusDurability, a JSON VirtualHost might be able to persist the configuration but not the settled state, while a BDB VH might support all three terminus durability modes.
For now we do not provide TerminusDurability=2 - This is another example of where we should differentiate between ConfigurableObjects and PersistentObjects which seems to be orthogonal concepts. LinkRegistry should be Persistent but not Configurable.
- Therefore, to not further make bad things worse separate out into distinct store? Same type as ConfigStore?
JSON:
Code Block language text { "version" : "1.0", "links" : { localContainerId1 : { "sending" : { remoteContainerId1 : { linkName1 : { "source" : { /* source attributes */ } }, linkName2 : { "source" : { /* source attributes */ } }, ... }, remoteContainerId2 : { linkName1 : { "source" : { /* source attributes */ } }, ... }, ... } "receiving" : { remoteContainerId1 : { linkName1 : { "target" : { /* target attributes */ } }, ... }, ... } }, localContainerId2 : { "sending" : { ... }, "receiving" : { ... } }, ... } }
- BDB (needs to be versioned):
- key: (sourceContainerId, targetContainerId, linkName)
- value: (SourceDef, TargetDef)
where one of the two MAY be null
- JDBC (needs to be versioned)
- COLUMNS: (sourceContainerId, targetContainerId, linkName, SourceDef, TargetDef)
where either SourceDef xor TargetDef MAY be null
- COLUMNS: (sourceContainerId, targetContainerId, linkName, SourceDef, TargetDef)
...
- LinkRegistry.putSendingLinkIfAbsent(String localContainerId, String remoteContrainerId, String linkName, Source source, Target target) -> Pair<Source, Target>
- LinkRegistry.putReceivingLinkIfAbsent(String localContainerId, String remoteContrainerId, String linkName, Source source, Target target) -> Pair<Source, Target>
- LinkRegistry.getSendvingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.getReceivingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.removeSendingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.removeReceivingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
...
Problems
...
- Link stealing hard
- association between Source, Target, and LinkEndpoint not explicit (no Link object)
Design v2
In stead of a LinkRegistry we introduce a LinkManager with expanded responsibilities.
...
- Link attachLink(Session_1_0 s, Attach a)
- void detachLink(Link l, Detach d)
Problems
This design was abandond because it is further away from the spec. v3 tries to remedy this.
...
Design
...
v3
As in the other designs the Terminus will hold persistent state (e.g., Map<delivery-tag, unsettled state>).
...