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

Pushdown automaton Decoder and Decode* traits; log feature #117

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

tony-iqlusion
Copy link
Member

@tony-iqlusion tony-iqlusion commented Apr 16, 2020

Adds a new veriform::decoder::Decoder type implemented as a proper stack-driven pushdown automaton which keeps state across nested messages.

The primary use case of a stateful decoder automaton is computing content hashes of messages even in the presence of unknown fields.

Additionally adds a new set of Decode* traits which:

  • Are generic around their return type and use it to infer the wire type
  • Accept a stateful Decoder type which exists for the duration of processing a message structure, allowing it to compute content hashes of messages as they're decoded

Finally, this commit also adds a log feature with some basic tracing of how messages are decoded, which can help assist in debugging the decoder.

Mea culpa for not splitting these things into separate domain-specific commits, but this PR in particular has been difficult to wrangle.

@codecov-io
Copy link

codecov-io commented Apr 16, 2020

Codecov Report

Merging #117 into develop will decrease coverage by 3.21%.
The diff coverage is 35.48%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #117      +/-   ##
===========================================
- Coverage    72.22%   69.00%   -3.22%     
===========================================
  Files           17       19       +2     
  Lines          738      842     +104     
===========================================
+ Hits           533      581      +48     
- Misses         205      261      +56     
Impacted Files Coverage Δ
rust/src/builtins/timestamp.rs 0.00% <0.00%> (ø)
rust/src/builtins/uuid.rs 0.00% <0.00%> (ø)
rust/src/decoder/sequence.rs 69.53% <0.00%> (-0.55%) ⬇️
rust/src/decoder/sequence/iter.rs 0.00% <0.00%> (ø)
rust/src/encoder.rs 69.04% <ø> (ø)
rust/src/field/wire_type.rs 76.47% <0.00%> (ø)
rust/src/message.rs 0.00% <ø> (ø)
rust/src/decoder/message.rs 80.82% <25.00%> (+2.18%) ⬆️
rust/src/decoder.rs 48.86% <48.86%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0d7c3a...f126e46. Read the comment docs.

@tony-iqlusion tony-iqlusion changed the title [WIP] New Decode* traits and Decoder type Pushdown automaton decoder and Decode* traits Apr 22, 2020
@tony-iqlusion tony-iqlusion changed the title Pushdown automaton decoder and Decode* traits Pushdown automaton Decoder and Decode* traits Apr 22, 2020
@tarcieri tarcieri force-pushed the new-decoder branch 2 times, most recently from 0873411 to a685d8a Compare April 22, 2020 21:37
Adds a new `veriform::decoder::Decoder` type implemented as a proper
stack-driven pushdown automaton which keeps state across nested
messages.

The primary use case of a stateful decoder automaton is computing
content hashes of messages even in the presence of unknown fields.

Additionally adds a new set of `Decode*` traits which:

- Are generic around their return type and use it to infer the wire type
- Accept a stateful `Decoder` type which exists for the duration of
  processing a message structure, allowing it to compute content hashes
  of messages as they're decoded

Finally, this commit also adds a `log` feature with some basic tracing
of how messages are decoded, which can help assist in debugging the
decoder.

Mea culpa for not splitting these things into separate domain-specific
commits, but this PR in particular has been difficult to wrangle.
@tony-iqlusion tony-iqlusion changed the title Pushdown automaton Decoder and Decode* traits Pushdown automaton Decoder and Decode* traits; log feature Apr 22, 2020
@tony-iqlusion tony-iqlusion merged commit 5d01b36 into develop Apr 22, 2020
@tony-iqlusion tony-iqlusion deleted the new-decoder branch April 22, 2020 21:46
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
tarcieri pushed a commit to iqlusioninc/armistice that referenced this pull request Apr 22, 2020
Updates the handwritten decoder fields to use the new pushdown
automaton-based `Decoder` API which landed in:
iqlusioninc/veriform#117
@tony-iqlusion tony-iqlusion mentioned this pull request May 21, 2020
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