-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 3Peer to Peer Federated HierarchyPeer to Peer Federated Hierarchy
Description
Specification
The Sigchain API requires some rework as discovered here: #310 (comment)
- The
ChainDataandChainDataEncodedtypes are record POJOs, which are not the right data type we should be returning to callers. Record POJOs do not preserve order, and when returning chain data, we would want to have the ability to iterate over the data, and it should be in the same order as the chain data (as ordered by the claim id). - When fetching a collection of resources in JS, always return an
Array. Record POJOs are not ordered. Alternatively to preserve both order and index access, aMapcan be used. HOWEVER,Arrayand POJOs are pure data. TheMapandSetare not. This is why by convention, we only useMapas a persistent rich construct, and when exchanging data between systems, we use arrays and POJOs. - This means we need
Sigchain.getChainandSigchain.getChainEncoded. Both methods should be returning the typeArray<Claim>andArray<ClaimEncoded>respectively. The encoded version is the base64ed JWT, but usually in our own application we would be working off theClaimstructure. At the same time there should be obvious conversion functions fromClaimtoClaimEncodedand back. - These 2 functions should expose
seekandlimitparameters to enable cursor pagination. Note thatseekneeds to be type of the seek key. The seek key ofSigchainis theClaimId. Which we know to be based onIdSortablewhich itself uses timestamps internally. Both parameters are optional. One should be able to synthetically construct aClaimIdto represent a point in time cursor as well. This is a secondary priority, do this after the main design works. - For indexed access, we would not expect the user to acquire a collection, and then query their collection. Instead we would expect the user to directly call a
getClaimwhich you can pass theClaimIdto acquire theClaimitself. If they want an encoded version, we can exposegetClaimEncoded. - The
ChainDataandChainDataEncodedmay no longer be necessary as types. Just useArray<Claim>andArray<ClaimEncoded>. However it is essential that one can iterate over these 2 arrays, and be able to use extractors/transformers/converters to be able to acquire theClaimId. This means theClaimIdmust always be acquirable given aClaimorClaimEncoded, ideally efficiently. - Remote users that call over GRPC, they should be able to pass pagination parameters in and acquire a collection of claims, they can then process it the way they want and do indexed access if so.
- We should endeavour to always be using
ClaimIdinternally in our application andClaimIdStringonly when using them as POJO keys. TheClaimIdEncodedis purely used for external reference. And theClaimshould be usingClaimId, andClaimEncodedcan useClaimIdEncodedsince you have to have JSON anyway. Make sure to use the reviver and replacer pattern as we do inside theStatusclass.
Additional context
- Extracting Node Connection Management out of
NodeManagertoNodeConnectionManager#310 (comment) - Discussion about SigchainClaimId,ClaimIdString,ClaimIdEncoded - GRPC API Review Changes #275 - GRPC API review and pagination concerns
- Growing the Gestalt Graph and Implementing Social Discovery #320 - The discovery system has been refactored significantly, and will be impacted by changes to the
Sigchain
Tasks
- ...
- ...
- ...
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 3Peer to Peer Federated HierarchyPeer to Peer Federated Hierarchy