Replies: 1 comment 5 replies
-
|
I'm going to attempt to use Github Discussions for ad-hoc development updates, especially on larger features like this one. Since the last update, I've simplified the Display implementation of DocumentId:
I've pushed a new set of changes to this branch that adds a
This branch still needs a lot of cleanup, and a lot of documentation is outdated/broken doctests. Still, given that the result of Monday's explorations were |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've started a pull request which aims to offer the ability to use any arbitrary
Keyimplementing type as a document ID.This is done by introducing a
DocumentIdtype, which tries to bring a level of sanity to using a byte-based value as a document's ID. Internally, the moment a DocumentId is constructed, the source value is converted into the memcmp-able byte representation. If it requires more than 64 bytes, it currently returns aDocumentIdTooLongerror. We could removeCopyfrom Header -- it currently isn't Copy in v0.1.1, and by doing so we could allow larger document IDs using an approach liketinyvecto keep smaller IDs stack-based.Surprisingly, none of the examples changed. Even the doctests remained largely unchanged. The Commerce benchmark shows the first sets of changes that are interesting -- see that benchmark uses
u32s in its source dataset, so converting to u64 was actually wasteful. Here's an example:https://github.com/khonsulabs/bonsaidb/pull/200/files#diff-e1507ddea9cfec8164d979bfda42d4aa6077da4512e8fdd283c7dbf51c197242R261-R268
Other than the name of the function
deserialize, I'm actually pretty happy with how this works out.My current questions are:
myid: If an ID contains bytes that are all alphanumeric, the ID will be displayed as-is.#1234: If an ID is <= 8 bytes long, render it as a numerical ID with a preceding#%FFFF: If an ID is > 8 bytes long, render it as hexadecimal with a preceding%CollectionName + DocumentIdpair uniquely identifies a document within a database, andDatabaseName + CollectionName + DocumentIduniquely identifies a document within a Storage/Server. A fully qualified ID might look likeadmin.khonsulabs.users.#1is user ID 1 in the admin database. I'm not sold on how the document ID display works when combined as part of a larger "identifier". Perhaps even the string representation should have a prefix char?Headertype that allows the deserialized ID type.Beta Was this translation helpful? Give feedback.
All reactions