-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Upstreaming of proxy-wasm Part 1. #10262
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
Changes from all commits
972166c
8b5efdc
65bd8ae
b21914e
3204e82
3a25b41
7548daf
3518e10
c9bfb2e
b6f1ce6
7832462
489f8f8
b21857a
bbc7922
6f29c2a
b3a3072
e85d273
167c344
06581c7
4119e6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| cc_library( | ||
| name = "include", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that |
||
| hdrs = [ | ||
| "include/proxy-wasm/compat.h", | ||
| "include/proxy-wasm/context.h", | ||
| "include/proxy-wasm/exports.h", | ||
| "include/proxy-wasm/null.h", | ||
| "include/proxy-wasm/null_plugin.h", | ||
| "include/proxy-wasm/null_vm.h", | ||
| "include/proxy-wasm/null_vm_plugin.h", | ||
| "include/proxy-wasm/v8.h", | ||
| "include/proxy-wasm/wasm.h", | ||
| "include/proxy-wasm/wasm_api_impl.h", | ||
| "include/proxy-wasm/wasm_vm.h", | ||
| "include/proxy-wasm/word.h", | ||
| ], | ||
| copts = ["-std=c++14"], | ||
| deps = [ | ||
| "@proxy_wasm_cpp_sdk//:common_lib", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "lib", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| srcs = [ | ||
| "src/base64.cc", | ||
| "src/base64.h", | ||
| "src/context.cc", | ||
| "src/exports.cc", | ||
| "src/foreign.cc", | ||
| "src/null/null.cc", | ||
| "src/null/null_plugin.cc", | ||
| "src/null/null_vm.cc", | ||
| "src/v8/v8.cc", | ||
| "src/wasm.cc", | ||
| ], | ||
| copts = ["-std=c++14"], | ||
| deps = [ | ||
| ":include", | ||
| "//external:abseil_flat_hash_map", | ||
| "//external:abseil_optional", | ||
| "//external:abseil_strings", | ||
| "//external:protobuf", | ||
| "//external:wee8", | ||
| "//external:zlib", | ||
| "@boringssl//:ssl", | ||
| "@proxy_wasm_cpp_sdk//:api_lib", | ||
| "@proxy_wasm_cpp_sdk//:common_lib", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| cc_library( | ||
| name = "api_lib", | ||
| hdrs = ["proxy_wasm_api.h"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "common_lib", | ||
| hdrs = [ | ||
| "proxy_wasm_common.h", | ||
| "proxy_wasm_enums.h", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,23 +15,25 @@ | |
| // Configuration and Status | ||
|
|
||
| /** | ||
| * Called from the VM to get any configuration. Valid only when in proxy_on_start() (where it will | ||
| * return a VM configuration), proxy_on_configure() (where it will return a plugin configuration) or | ||
| * in proxy_validate_configuration() (where it will return a VM configuration before | ||
| * proxy_on_start() has been called and a plugin configuration after). | ||
| * Called from the VM to get bytes from a buffer (e.g. a vm or plugin configuration). | ||
| * @param start is the offset of the first byte to retrieve. | ||
| * @param length is the number of the bytes to retrieve. If start + length exceeds the number of | ||
| * bytes available then configuration_size will be set to the number of bytes returned. | ||
| * @param configuration_ptr a pointer to a location which will be filled with either nullptr (if no | ||
| * configuration is available) or a pointer to a allocated block containing the configuration | ||
| * @param ptr a pointer to a location which will be filled with either nullptr (if no | ||
| * data is available) or a pointer to a allocated block containing the configuration | ||
| * bytes. | ||
| * @param configuration_size a pointer to a location containing the size (or zero) of any returned | ||
| * configuration byte block. | ||
| * @return a WasmResult: OK, InvalidMemoryAccess. Note: if OK is returned *configuration_ptr may | ||
| * @param size a pointer to a location containing the size (or zero) of any returned | ||
| * byte block. | ||
| * @return a WasmResult: OK, InvalidArgument, InvalidMemoryAccess. Note: if OK is returned *ptr may | ||
| * be nullptr. | ||
| */ | ||
| extern "C" WasmResult proxy_get_configuration((uint32_t start, uint32_t length, | ||
| const char** configuration_ptr, size_t* configuration_size); | ||
| enum class WasmBufferType : int32_t { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that |
||
| VmConfiguration = 0, | ||
| PluginConfiguration = 1, | ||
| MAX = 2, | ||
| }; | ||
| extern "C" WasmResult proxy_get_buffer_bytes(WasmBufferType type, uint32_t start, uint32_t length, | ||
| const char** ptr, size_t* size); | ||
|
|
||
| // Logging | ||
| // | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -837,6 +837,7 @@ class StatNameSet { | |
| using StringStatNameMap = absl::flat_hash_map<std::string, Stats::StatName>; | ||
| StringStatNameMap builtin_stat_names_; | ||
| }; | ||
| using StatNameSetSharedPtr = std::shared_ptr<Stats::StatNameSet>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect this is not a great pattern for using StatNameSet; I'm inclined not to institutionalize it by centralizing a shortcut for it. But it's worth exploring what your data model is. Is the StatNameSet shared across all threads, all VMs?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The VMs are running the same code and there are many of them (e.g 60 on a large system), so the replication would be large without sharing.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed on envoyproxy/envoy-wasm#452 we have a new solution and are testing this now. I will upstream that change assuming it works out. Let's not let that hold up this review. |
||
|
|
||
| } // namespace Stats | ||
| } // namespace Envoy | ||
Uh oh!
There was an error while loading. Please reload this page.