Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Fix ABI: all data is pulled by the code in the VM.#274

Merged
jplevyak merged 11 commits intoenvoyproxy:masterfrom
jplevyak:wasm-data
Nov 7, 2019
Merged

Fix ABI: all data is pulled by the code in the VM.#274
jplevyak merged 11 commits intoenvoyproxy:masterfrom
jplevyak:wasm-data

Conversation

@jplevyak
Copy link
Copy Markdown
Contributor

Signed-off-by: John Plevyak jplevyak@gmail.com

Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

It seems that this change passes only number of body bytes in the function calls, but not any other values that would be similarly useful, IMHO (i.e. number of headers, trailers, status message length, status code). Is there any particular reason for this choice?

virtual void onHttpCallResponse(uint32_t token, std::unique_ptr<WasmData> header_pairs,
std::unique_ptr<WasmData> body,
std::unique_ptr<WasmData> trailer_pairs);
virtual void onHttpCallResponse(uint32_t token, size_t body_size);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like a weird choice, why are we only passing body size, but not number of headers / trailers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because the call to get the body requires the length requested, so it would require an extra call to get the length of the buffer before getting the whole body.

return std::make_unique<WasmData>(value_ptr, value_size);
}

inline std::pair<uint32_t, WasmDataPtr> getStatus() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this at least indicate what the status this is about? We're ending up with a lot of functions that are way too generic, IMHO.

This seems to be used only in onGrpcClose and onHttpCallResponse. Could this be named getCalloutStatus or something like that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And for generic WasmResult != Ok. It would be nice to have an addition details message available for debugging.

I see this more googl3 Status which is completely generic. It has error namespaces, perhaps you would be interested in adding that? e.g. GrpcErrors, HttpErrors, WasmErrors ?

@jplevyak jplevyak requested a review from PiotrSikora October 27, 2019 17:45
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
@jplevyak
Copy link
Copy Markdown
Contributor Author

Updated WRT comments. PTAL

// A unique name for a filters/services in a VM for use in identifiying the filter/service if
// multiple filters/services are handled by the same vm_id and root_id and for logging/debugging.
// If left blank the plugin will be assigned an integer name corresponding to when it registers
// with the VM (i.e. the first plugin to register with the VM will be "0").
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why? Is it only to identify them? UUID might be better, then, and it's already used for that purpose in Envoy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed it. This is purely user-facing so if they don't add one then they done need it.

std::unique_ptr<WasmData> trailer_pairs)>;
using GrpcSimpleCallCallback =
std::function<void(GrpcStatus status, std::unique_ptr<WasmData> message)>;
std::function<void(uint32_t, size_t, uint32_t)>; // headers, body_size, trailers
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

headers / trailers - is that a number of items or total length when serialized?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

number

virtual void onFailure(GrpcStatus status, std::unique_ptr<WasmData> error_message) = 0;
virtual void onCreateInitialMetadata(uint32_t /* headers */) {}
virtual void onSuccess(size_t body_size) = 0;
virtual void onFailure(GrpcStatus status) = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this include status_message_size?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could. My feeling however is that this is an exceptional situation and if you have an error and need to the details, then an extra call will not kill you.

Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
@jplevyak jplevyak requested a review from PiotrSikora November 6, 2019 23:36
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants