Skip to content

Remove codec library classes #1160

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

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Sep 13, 2023

The CodecLibrary class was introduced as it was necessary when working with lazy BSON codecs. Since those have been removed from the 1.17 release, it does not make sense to introduce the library either, as there's no direct need for it. In fact, in most frameworks (e.g. Laravel, Symfony), each codec would rely on a service locator to receive codecs it needs for data types or embedded documents as a constructor dependency. Until we have a clear need for such functionality, it's best to not introduce code so we are not bound by any BC promises.

@alcaeus alcaeus requested a review from GromNaN September 13, 2023 07:15
@alcaeus alcaeus self-assigned this Sep 13, 2023
@GromNaN
Copy link
Member

GromNaN commented Sep 13, 2023

The architecture document needs to be updated.

## Codec Libraries
The `CodecLibrary` class is able to combine several `Decoder`, `Encoder`, and `Codec` instances into a single codec.
When decoding or encoding a value, the library will use the first instance that supports the value. This allows for
easier composition of codecs. A `Decoder`, `Encoder`, or `Codec` implementation may choose to implement the
`KnowsCodecLibrary` interface. In this case, when the codec is added to a library, the library is injected into the
instance using the `attachCodecLibrary` method. This allows the codec to use the library to decode or encode values.

@GromNaN GromNaN merged commit e043d43 into mongodb:master Sep 13, 2023
@alcaeus alcaeus deleted the remove-codec-library branch June 27, 2024 11:40
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