You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This spec is less well-baked compared to the GestaltGraph because this is my initial review of the discovery domain.
The discovery domain depends on:
NodeManager for connecting to nodes and asking about their sigchain
TaskManager to run background tasks
GestaltGraph to update the links they discover
KeyRing to know if we are finding our own NodeId.
Sigchain to add its own sigchain into the GestaltGraph
There are several major changes here required:
GestaltId instead of GestaltKey
The GestaltGraph now uses GestaltId, it does not expose the GestaltKey, all operations must now use the GestaltId when interacting with the Sigchain.
Querying the Sigchain of remote node
When connecting to the remote node in order to discover their sigchain, it must be understood as a stream of claims. Rather than one giant claim array. This means instead of calling NodeManager.requestChainData, it should be using the NCM and connecting to it.
We know that the NCM is a supervisor over node connection pools. It should be the primary way by which downstream domains attempt contact to other nodes and to call them.
The NM by contrast can also use the NCM and expose a variety of high-level functionality over the nodes. However in this case, the only user of NodeManager.requestChainData is the Discovery and it makes more sense for the Discovery to directly operate the NodeConnection and its encapsulated GRPC client.
Therefore the Discovery should be relying on the NodeConnectionManager and not the NodeManager.
On the GRPC service handler, the nodesChainDataGet should be changed to a server stream. This stream will yield SignedClaim.
On the other side, when querying the own Sigchain, it should not just call Sigchain.getClaims, but get only the "latest" (and unrevoked) claim per node ID or identity ID. To do this, the Sigchain will need some sort of indexing to keep track of this (#327).
Processing own Node
With respect to #319, it should be processing its own sigchain immediately on start and adding such data to the GestaltGraph.
The Sigchain can be mutated by itself during the claiming process for node to node and node to identity. This claiming process cannot be initiated by the Sigchain.
This part is currently a bit confusing.
For node to node claims, this all starts in NodeManager.claimNode, which itself ends up calling the Sigchain.
But for node to identity claims, this is done by the GRPC handler identitiesClaim which orchestrates operations between the Sigchain and Provider.
We need to clarify on a few things here:
Should the Discovery be responsible for managing the node's own Sigchain and putting its data into the GestaltGraph?
How should the Discovery crawl its GestaltGraph and does it also try to discover its own vertex?
We decided long ago, that GRPC handlers (service layer) should be thin wrappers around domain models (business layer) doing the bulk of the business logic. This means claiming an identity should be in the identities domain just like claiming a node is in the nodes domain.
The Sigchain is not aware of the GestaltGraph and the GestaltGraph is not aware of the Sigchain. This is good, because we can do object composition here. Given that any claiming process will involve the Sigchain, should the GestaltGraph also be updated by the claiming process?
Here's one possible answer to the question:
Here you can see that claiming an identity or a node is what ends up updating the GestaltGraph. It's not a reactive thing, because claiming updates both our own Sigchain and our own gestalt in the GestaltGraph.
The claimNode and claimIdentity are now part of the domain models. In the case of claimIdentity, this needs to be part of the Provider. In fact, as an abstract class, we would expect that these dependencies to be injected into the Provider for it to be used during the claiming process. This may not be entirely good design if we expect provider plugins. In the case of plugins, we have 2 choices, we are either calling into it, or it is calling into us. If we give it the Sigchain and GestaltGraph, we are giving it quite a lot of power, thus allowing it to call into us, is like providing an entire scripting environment. A safer model is that we call into it. In that case, it would be part of the IdentitiesManager.
Note that the diagram above renames IdentitiesManager as ProviderManager atm because it doesn't do anything except manager Provider. But if the claiming process is a "don't call us, we'll call you", then it can be left as IdentitiesManager.
Finally Discovery does not actually need access to the Sigchain nor to the KeyRing. The discovery does not need discover its own node, because any changes to its own node's gestalt would be reflected immediately during the claimNode and claimIdentity operations. The discovery only needs to discover the node's own neighbours, which can it do by querying the gestalt graph and prioritising based on TTLs (which are yet to be implemented). There are still some questions as to how does the discovery become aware about the new nodes in the gestalt? This can either be push-based or pull-based. I believe right now it is pull-based, which means there's a timer-based polling onto the GestaltGraph and we have talked about making the Discovery reactive to the GestaltGraph.
Deliberate Operations for Discovery
It needs to be reviewed how exactly users can directly tell the Discovery to start its discovery process against a given NodeId or ProviderIdentityId.
2. Discovery logic needs to refactored and cleaned up
3. Streaming claims when connecting to remote nodes and identities.
4. Don't process your own node, It should be added to the GestaltGraph when claims are made. This is done for both claim node and claim identity.
5. claimNode needs to be a part of the nodes domain along with the handler logic for it. The logic behind this needs to be refactored to use the new claims/token changes.
6. Likewise the claimIdentity logic and handler needs to be apart of the IdentityManager or Provider.
7. Existing tests need to be updated and coverted to using fast check.
8. New test needs to be created to do a more complex model based testing using all of the available Discovery commands.
9. Index claim read, when requesting claims we can request only the claims newer that the provided Id.
10. Notifications needs to be updated to make use of the new tokens. \
Specification
This spec is less well-baked compared to the
GestaltGraphbecause this is my initial review of the discovery domain.The discovery domain depends on:
NodeManagerfor connecting to nodes and asking about their sigchainTaskManagerto run background tasksGestaltGraphto update the links they discoverKeyRingto know if we are finding our ownNodeId.Sigchainto add its own sigchain into theGestaltGraphThere are several major changes here required:
GestaltIdinstead ofGestaltKeyThe
GestaltGraphnow usesGestaltId, it does not expose theGestaltKey, all operations must now use theGestaltIdwhen interacting with theSigchain.Querying the
Sigchainof remote nodeWhen connecting to the remote node in order to discover their sigchain, it must be understood as a stream of claims. Rather than one giant claim array. This means instead of calling
NodeManager.requestChainData, it should be using the NCM and connecting to it.We know that the
NCMis a supervisor over node connection pools. It should be the primary way by which downstream domains attempt contact to other nodes and to call them.The
NMby contrast can also use theNCMand expose a variety of high-level functionality over thenodes. However in this case, the only user ofNodeManager.requestChainDatais theDiscoveryand it makes more sense for theDiscoveryto directly operate theNodeConnectionand its encapsulated GRPC client.Therefore the
Discoveryshould be relying on theNodeConnectionManagerand not theNodeManager.On the GRPC service handler, the
nodesChainDataGetshould be changed to a server stream. This stream will yieldSignedClaim.On the other side, when querying the own
Sigchain, it should not just callSigchain.getClaims, but get only the "latest" (and unrevoked) claim per node ID or identity ID. To do this, theSigchainwill need some sort of indexing to keep track of this (#327).Processing own Node
With respect to #319, it should be processing its own sigchain immediately on start and adding such data to the
GestaltGraph.The
Sigchaincan be mutated by itself during the claiming process for node to node and node to identity. This claiming process cannot be initiated by theSigchain.This part is currently a bit confusing.
For node to node claims, this all starts in
NodeManager.claimNode, which itself ends up calling theSigchain.But for node to identity claims, this is done by the GRPC handler
identitiesClaimwhich orchestrates operations between theSigchainandProvider.We need to clarify on a few things here:
Discoverybe responsible for managing the node's ownSigchainand putting its data into theGestaltGraph?Discoverycrawl itsGestaltGraphand does it also try to discover its own vertex?identitiesdomain just like claiming a node is in thenodesdomain.Sigchainis not aware of theGestaltGraphand theGestaltGraphis not aware of theSigchain. This is good, because we can do object composition here. Given that any claiming process will involve theSigchain, should theGestaltGraphalso be updated by the claiming process?Here's one possible answer to the question:
Here you can see that claiming an identity or a node is what ends up updating the
GestaltGraph. It's not a reactive thing, because claiming updates both our ownSigchainand our own gestalt in theGestaltGraph.The
claimNodeandclaimIdentityare now part of the domain models. In the case ofclaimIdentity, this needs to be part of theProvider. In fact, as an abstract class, we would expect that these dependencies to be injected into theProviderfor it to be used during the claiming process. This may not be entirely good design if we expect provider plugins. In the case of plugins, we have 2 choices, we are either calling into it, or it is calling into us. If we give it theSigchainandGestaltGraph, we are giving it quite a lot of power, thus allowing it to call into us, is like providing an entire scripting environment. A safer model is that we call into it. In that case, it would be part of theIdentitiesManager.Note that the diagram above renames
IdentitiesManagerasProviderManageratm because it doesn't do anything except managerProvider. But if the claiming process is a "don't call us, we'll call you", then it can be left asIdentitiesManager.Finally
Discoverydoes not actually need access to theSigchainnor to theKeyRing. The discovery does not need discover its own node, because any changes to its own node's gestalt would be reflected immediately during theclaimNodeandclaimIdentityoperations. The discovery only needs to discover the node's own neighbours, which can it do by querying the gestalt graph and prioritising based on TTLs (which are yet to be implemented). There are still some questions as to how does the discovery become aware about the new nodes in the gestalt? This can either be push-based or pull-based. I believe right now it is pull-based, which means there's a timer-based polling onto theGestaltGraphand we have talked about making theDiscoveryreactive to theGestaltGraph.Deliberate Operations for
DiscoveryIt needs to be reviewed how exactly users can directly tell the
Discoveryto start its discovery process against a givenNodeIdorProviderIdentityId.GestaltLinkNode for doubly signed claims
See: #493 (comment)
Notifications for Claiming Nodes
See: #493 (comment)
Additional context
tokensdomain and specialise tokens for Sigchain, Notifications, Identities and Sessions #481Discoveryprocess #462Tasks
GestaltKeyusage withGestaltId.GestaltGraphwhen claims are made. This is done for both claim node and claim identity.claimNodeneeds to be a part of the nodes domain along with the handler logic for it. The logic behind this needs to be refactored to use the new claims/token changes.claimIdentitylogic and handler needs to be apart of theIdentityManagerorProvider.