Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use drive discovery key for drive ids #294

Merged

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Oct 2, 2023

Closes #272

Stacked on #290

This PR:

  • updates BlobStore to use discovery keys instead of public keys for drive ids
  • renames the driveId field of the BlobId type to driveDiscoveryId, to align with the issue's desire to update the observation attachment reference.

I initially thought we may want to rename driveId used in the blobs-related code to driveDiscoveryId but then realized that we may not want that. If we want to revert the naming, just a matter of reverting the last commit on this PR.

@achou11 achou11 changed the title use drive discovery id for blobs use drive discovery key for drive ids Oct 2, 2023
implementation now just updates what the driveId represents
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Not sure about the naming question. Internally, it makes sense that it is called driveDiscoveryId, since that describes what it is, but for the API consumer, I think driveId makes sense, because for the API consumer it is just "ID that identities the drive the blob is stored on", and we don't expose any other ID to the API consumer.

In summary, I think maybe call it driveId where the API consumer sees it, even though that makes it a little confusing when reading the internals - just make sure to add comments.

@achou11
Copy link
Member Author

achou11 commented Oct 3, 2023

yeah all of that came to mind as I was implementing.

One question I have then is should the return value of BlobApi.create() contain a field called driveId or driveDiscoveryId? Your suggestion seems to suggest the former, but my understanding is that the latter would be more convenient because you could directly use the return value as the value for an observation attachment (which uses driveDiscoveryId based on the schema change)

EDIT: leaning towards driveId despite the minor inconvenience when it comes to observation creation/update, as the blob API shouldn't necessarily be strictly tied to the schema def of a particular datatype

@achou11
Copy link
Member Author

achou11 commented Oct 3, 2023

Decided to basically revert the renaming entirely, without attempting to strategically update naming for internals. Just became confusing and I think for now the comments are helpful enough. Can revisit if it really does become super confusing

@achou11 achou11 merged commit 3f5ea44 into chore/update-mapeo-schema-3.0.0-next.10 Oct 3, 2023
@achou11 achou11 deleted the 272/drive-discovery-id branch October 3, 2023 17:58
tomasciccola added a commit that referenced this pull request Oct 4, 2023
* update dep

* update project database

* update client database

* fix errors caused by coreDiscoveryId naming

* fix errors caused by deleted field

* use drive discovery key for drive ids (#294)

* add `Icon` table and dataType, regenerate drizzle

* update `mapeo-schema` to `next.11`

* add `icon` to datastore's config namespace

* merge fix

---------

Co-authored-by: Andrew Chou <andrewchou@fastmail.com>
Co-authored-by: Tomás Ciccola <tciccola@digital-democracy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants