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

chore: rewrite document api #1178

Merged
merged 17 commits into from
Apr 11, 2023
Merged

chore: rewrite document api #1178

merged 17 commits into from
Apr 11, 2023

Conversation

derklaro
Copy link
Member

@derklaro derklaro commented Apr 9, 2023

Motivation

At the moment the document api is very limited due to the reason that practically only the json implementation is used everywhere. While there is an abstract interface for a Document that specifies most of the methods implemented in the json implementation, that interface cannot really be used for custom implementations as the exposed api never accepts the custom implementation.

Modification

The whole Document api has been rewritten and the Document interface is now used everywhere in the api, allowing to use custom document types. To make this work, this PR also contains a way to transfer the key-value pairs from one document type to another. To follow the internal structure of having one mutable type and one immutable type for everything (to make it clear when something can/should be edited, an when that shouldn't be the case) the document is now split up into mutable and immutable as well.

Result

Way cleaner document implementation with proper support for custom document types.

@derklaro derklaro added v: 4.X This pull should be included in the 4.0 release in: driver An issue/pull request releated to the driver module code t: improvement The pull request improves existing code in: common An issue/pull request releated to the common module code labels Apr 9, 2023
@derklaro derklaro added this to the Final API changes milestone Apr 9, 2023
@derklaro derklaro requested a review from 0utplay April 9, 2023 07:51
@derklaro derklaro self-assigned this Apr 9, 2023
@derklaro derklaro merged commit e44d032 into nightly Apr 11, 2023
6 of 7 checks passed
@derklaro derklaro deleted the document-api-rewrite branch April 11, 2023 15:36
derklaro added a commit that referenced this pull request Apr 17, 2023
### Motivation
At the moment the document api is very limited due to the reason that
practically only the json implementation is used everywhere. While there
is an abstract interface for a Document that specifies most of the
methods implemented in the json implementation, that interface cannot
really be used for custom implementations as the exposed api never
accepts the custom implementation.

### Modification
The whole Document api has been rewritten and the Document interface is
now used everywhere in the api, allowing to use custom document types.
To make this work, this PR also contains a way to transfer the key-value
pairs from one document type to another. To follow the internal
structure of having one mutable type and one immutable type for
everything (to make it clear when something can/should be edited, an
when that shouldn't be the case) the document is now split up into
mutable and immutable as well.

### Result
Way cleaner document implementation with proper support for custom
document types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: common An issue/pull request releated to the common module code in: driver An issue/pull request releated to the driver module code t: improvement The pull request improves existing code v: 4.X This pull should be included in the 4.0 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants