Skip to content

Commit 35a63d4

Browse files
Remove default implementations from headers. (#273)
Signed-off-by: chaoqin-li1123 <[email protected]>
1 parent 06c5d4c commit 35a63d4

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

include/proxy-wasm/context.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,17 @@ class ContextBase : public RootInterface,
237237
WasmResult log(uint32_t /* level */, std::string_view /* message */) override {
238238
return unimplemented();
239239
}
240-
uint32_t getLogLevel() override { return static_cast<uint32_t>(LogLevel::info); }
240+
uint32_t getLogLevel() override {
241+
unimplemented();
242+
return 0;
243+
}
241244
uint64_t getCurrentTimeNanoseconds() override {
242-
return std::chrono::system_clock::now().time_since_epoch().count();
245+
unimplemented();
246+
return 0;
243247
}
244248
uint64_t getMonotonicTimeNanoseconds() override {
245-
return std::chrono::steady_clock::now().time_since_epoch().count();
249+
unimplemented();
250+
return 0;
246251
}
247252
std::string_view getConfiguration() override {
248253
unimplemented();

test/utility.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ class TestContext : public ContextBase {
9898

9999
bool isLogged(std::string_view message) { return log_.find(message) != std::string::npos; }
100100

101+
uint64_t getCurrentTimeNanoseconds() override {
102+
return std::chrono::duration_cast<std::chrono::nanoseconds>(
103+
std::chrono::system_clock::now().time_since_epoch())
104+
.count();
105+
}
106+
uint64_t getMonotonicTimeNanoseconds() override {
107+
return std::chrono::duration_cast<std::chrono::nanoseconds>(
108+
std::chrono::steady_clock::now().time_since_epoch())
109+
.count();
110+
}
111+
101112
private:
102113
std::string log_;
103114
};

0 commit comments

Comments
 (0)