Skip to content

api: custom packer and unpacker factories #268

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

Conversation

DifferentialOrange
Copy link
Member

@DifferentialOrange DifferentialOrange commented Nov 30, 2022

After this patch, user may pass packer_factory and unpacker_factory options to a connection. They will be used instead of the default ones. packer_factory is expected to be a function with the only one parameter: connection object, which returns a new msgpack.Packer object. unpacker_factory is expected to be a function with the only one parameter: connection object, which returns a new msgpack.Unpacker object. packer_factory supersedes encoding option. unpacker_factory supersedes encoding and use_list options. User may implement encoding and use_list support in its custom packer or unpacker if they wish so. User may refer to request submodule packer_factory and response submodule unpacker_factory as an example (these factories are used by default.)

Closes #154, #190, #191

@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-191-custom-packer-unpacker branch 3 times, most recently from d158728 to f59e532 Compare December 1, 2022 07:54
After this patch, user may pass `packer_factory` and `unpacker_factory`
options to a connection. They will be used instead of the default ones.
`packer_factory` is expected to be a function with the only one
parameter: connection object, which returns a new msgpack.Packer object.
`unpacker_factory` is expected to be a function with the only one
parameter: connection object, which returns a new msgpack.Unpacker
object. `packer_factory` supersedes `encoding` option.
`unpacker_factory` supersedes `encoding` and `use_list` options. User
may implement `encoding` and `use_list` support in its custom packer or
unpacker if they wish so. User may refer to request submodule
`packer_factory` and response submodule `unpacker_factory` as an example
(these factories are used by default.)

Closes #145, #190, #191
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-191-custom-packer-unpacker branch from f59e532 to 51db95b Compare December 1, 2022 08:09
@DifferentialOrange DifferentialOrange marked this pull request as ready for review December 1, 2022 08:18
Copy link
Contributor

@GRISHNOV GRISHNOV left a comment

Choose a reason for hiding this comment

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

Hi! LGTM

@DifferentialOrange DifferentialOrange merged commit 1154b3d into master Dec 1, 2022
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/gh-191-custom-packer-unpacker branch December 1, 2022 13:00
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