-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
developmentStandard developmentStandard developmentdiscussionRequires discussionRequires discussionenhancementNew feature or requestNew feature or requestepicBig issue with multiple subissuesBig issue with multiple subissuesr&d:polykey:core activity 3Peer to Peer Federated HierarchyPeer to Peer Federated Hierarchy
Description
Specification
The current GenericIdTypes
module is slightly out of place within the larger architecture of the js-polykey
codebase. We should find some time to review this, and refactor its required implementation to more suitable areas of the codebase. It was originally introduced in order to facilitate usage of the js-id
module within Polykey.
Additional context
- relevant comment on this here Introducing vault sharing and the restrictions of pulling and cloning with vault permissions #266 (comment) (more generally talking about
js-id
too) - discussion originally from here https://vimeo.com/manage/videos/652339635 5:00 - 17:30 - originally introduced here c5f22e5
- No longer preserve vault ID on
cloneVault
#253 - vault id usage in EFS and when cloning
Tasks
- Add some of the encoding wrappers into the
IdInternal
class, this requires a new PR injs-id
. IncludetoMultibase
andtoUUID
andtoBuffer
as instance methods, and thefromString
,fromMultibase
,fromUUID
, andfromBuffer
as static methods (these represent alternatives of creating theIdInternal
). Make sure that these functions returnId
as the type and notIdInternal
. - Create a new PR for addressing the NodeId changes that fixes Refactor
NodeId
as a proxy/singleton instance #254 and relates to Review js-id usage for NodeId, VaultId, NotificationId, PermId, ClaimId, Gestalts andGenericIdTypes.ts
#299 (this requires more work to be done, not just node id). - This PR will focus on applying the new
NodeId
which is an opaque alias ofId
(which itself is an alias ofIdInternal & number
). - All the areas which is currently using
NodeId
is expecting an encoded string. These will need to be changed to expect a sort oftype NodeIdEncoded = string;
, you still need anodesUtils.encodeNodeId
. - The encoding functions and decoding functions of
NodeId
should be insidenodes/utils.ts
. This should be similar to how I'm doing it forVaultId
. An alternative might be to create class extension or generics, but this seems complicated. - Raw usage of the
NodeId
will mostly occur inside the nodes domain, in particular theNodeGraph
can use theUint8Array
directly. Note that thejs-db
currently doesn't yet allow direct usage of theId
, because it requires aBuffer
type. However there is an issue UsebufferWrap
to supportArrayBuffer
,Uint8Array
andBuffer
js-db#3 to allow it to eventually takeId
, so for now, just useidUtils.toBuffer
andidUtils.fromBuffer
when interacting with the DB. - Once this PR is merged into master, rebase Introducing vault sharing and the restrictions of pulling and cloning with vault permissions #266 and Extracting Node Connection Management out of
NodeManager
toNodeConnectionManager
#310 on top to benefit from it. - Then the
GenericIdTypes.ts
can be removed once all other areas of code stop using it.
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard developmentdiscussionRequires discussionRequires discussionenhancementNew feature or requestNew feature or requestepicBig issue with multiple subissuesBig issue with multiple subissuesr&d:polykey:core activity 3Peer to Peer Federated HierarchyPeer to Peer Federated Hierarchy