Skip to content

Move get_log_level to ABI version 0.2.1 #50

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
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/proxy-wasm/wasm_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ enum class Cloneable {
InstantiatedModule // VMs can be cloned from an instantiated module.
};

enum class AbiVersion { ProxyWasm_0_1_0, ProxyWasm_0_2_0, Unknown };
enum class AbiVersion { ProxyWasm_0_1_0, ProxyWasm_0_2_0, ProxyWasm_0_2_1, Unknown };

class NullPlugin;

Expand Down
2 changes: 1 addition & 1 deletion src/null/null_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool NullVm::load(const std::string &name, bool /* allow_precompiled */) {
return true;
}

AbiVersion NullVm::getAbiVersion() { return AbiVersion::ProxyWasm_0_2_0; }
AbiVersion NullVm::getAbiVersion() { return AbiVersion::ProxyWasm_0_2_1; }

bool NullVm::link(std::string_view /* name */) { return true; }

Expand Down
2 changes: 2 additions & 0 deletions src/v8/v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ AbiVersion V8::getAbiVersion() {
return AbiVersion::ProxyWasm_0_1_0;
} else if (name == "proxy_abi_version_0_2_0") {
return AbiVersion::ProxyWasm_0_2_0;
} else if (name == "proxy_abi_version_0_2_1") {
return AbiVersion::ProxyWasm_0_2_1;
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void WasmBase::registerCallbacks() {
&ConvertFunctionWordToUint32<decltype(exports::_fn), \
exports::_fn>::convertFunctionWordToUint32);
_REGISTER_PROXY(log);
_REGISTER_PROXY(get_log_level);

_REGISTER_PROXY(get_status);

Expand Down Expand Up @@ -198,6 +197,10 @@ void WasmBase::registerCallbacks() {
} else if (abiVersion() == AbiVersion::ProxyWasm_0_2_0) {
_REGISTER_PROXY(continue_stream);
_REGISTER_PROXY(close_stream);
} else if (abiVersion() == AbiVersion::ProxyWasm_0_2_1) {
_REGISTER_PROXY(continue_stream);
_REGISTER_PROXY(close_stream);
_REGISTER_PROXY(get_log_level);
}
#undef _REGISTER_PROXY
}
Copy link
Member

Choose a reason for hiding this comment

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

There are also _GET_PROXY callbacks below that are guarded by the ABI version.

Expand Down Expand Up @@ -247,7 +250,8 @@ void WasmBase::getFunctions() {
if (abiVersion() == AbiVersion::ProxyWasm_0_1_0) {
_GET_PROXY_ABI(on_request_headers, _abi_01);
_GET_PROXY_ABI(on_response_headers, _abi_01);
} else if (abiVersion() == AbiVersion::ProxyWasm_0_2_0) {
} else if (abiVersion() == AbiVersion::ProxyWasm_0_2_0 ||
abiVersion() == AbiVersion::ProxyWasm_0_2_1) {
_GET_PROXY_ABI(on_request_headers, _abi_02);
_GET_PROXY_ABI(on_response_headers, _abi_02);
_GET_PROXY(on_foreign_function);
Expand Down