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

Alyapunov/cleanup and impovement #93

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

alyapunov
Copy link
Contributor

mpp: implement container adapter

Previously encode/decode expected the first argument (cont) to
be tnt::Buffer of something with the same API.

This commit introduces contaier adapter, so it is allowed now to
encode to standard contiguous container (std::vector etc) and
encode/decode just by pointer to data.

Fix decode headers while we are here.

Fix README.md.

Make some other simplifications and improvements.

There were 3 assert that assured that read and write data are of
non-zero size. Actually there were no harm in it. More important
is that in mpp code writing and reading of zero-size strings must
be a valid case.

So just remove asserts and add a test of ecoding/descoding of an
empty string.
They are unused after switch to new codec.
Originally there were two families: compact and bitmask. In order
not to be confused compact was placed in 'compact' namespace.

Since family bitmask was removed in the previous commit, there's
no more need in compact namespace.
It was completely outdated in the part about decoding.
Previously encode/decode expected the first argument (cont) to
be tnt::Buffer of something with the same API.

This commit introduces contaier adapter, so it is allowed now to
encode to standard contiguous container (std::vector etc) and
encode/decode just by pointer to data.

Fix decode headers while we are here.
@alyapunov alyapunov force-pushed the alyapunov/cleanup-and-impovement branch from 492ecfd to a4574ef Compare July 16, 2024 15:08
@alyapunov
Copy link
Contributor Author

alyapunov commented Jul 17, 2024

I can't catch what to do with failing and hung testing jobs.

@CuriousGeorgiy CuriousGeorgiy removed their assignment Jul 31, 2024
Resolver is a class that was designed for one purpose: find a
reference to subobject in the list of arguments by integer path
to that subobject. It also can transform objects which have
decoding rules to that rules and also dereference pointers to
members (which are usually used in decoding rules).

The previous resolver had at a problem: it did not transform an
object to its decoding  rule if the object was produced by
dereferencing pointer to member.

Also there were circumstances when result of resolving was
unwrapped - that means that specificators like as_map were lost.

The patch fixes the problems and also seems to simplify resolver.
Now resolver always returns completely transformed result.

More comments are added.

Add a test that would fail without the fix.
Simplify the test a bit.
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.

3 participants