pdk_proxy_wasm_stub/
lib.rs

1// Copyright (c) 2025, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5//! # Proxy-Wasm Stub
6//!
7//! This crate provides a stub implementation of the Proxy-Wasm framework.
8//! It allows to depend on and compile the Proxy-Wasm Rust SDK for non-`wasm32` platforms.
9
10/// Re-implementation of most of the function and types of <https://github.com/proxy-wasm/proxy-wasm-rust-sdk>
11/// without any extern function, so that they are able to compile in Windows ((<https://github.com/rust-lang/rust/issues/86125>)
12// For crate-type="cdylib".
13#[cfg(not(wasi_exec_model_reactor))]
14#[macro_export]
15macro_rules! main {
16    ($code:block) => {
17        #[cfg(target_os = "wasi")]
18        extern "C" {
19            fn __wasm_call_ctors();
20        }
21
22        #[no_mangle]
23        pub extern "C" fn _initialize() {
24            #[cfg(target_os = "wasi")]
25            unsafe {
26                __wasm_call_ctors();
27            }
28
29            $code;
30        }
31    };
32}
33
34/// Sets the log level.
35pub fn set_log_level(_level: types::LogLevel) {
36    unimplemented!("Not implemented for current target")
37}
38
39/// Sets the root context.
40pub fn set_root_context(_callback: types::NewRootContext) {
41    unimplemented!("Not implemented for current target")
42}
43
44/// Sets the stream context.
45pub fn set_stream_context(_callback: types::NewStreamContext) {
46    unimplemented!("Not implemented for current target")
47}
48
49/// Sets the HTTP context.
50pub fn set_http_context(_callback: types::NewHttpContext) {
51    unimplemented!("Not implemented for current target")
52}
53
54/// Traits.
55pub mod traits {
56    use std::time::{Duration, SystemTime};
57
58    use crate::types::{Action, Bytes, ContextType, Status};
59
60    /// Trait for the context.
61    pub trait Context {
62        fn get_current_time(&self) -> SystemTime {
63            unimplemented!("Not implemented for current target")
64        }
65
66        fn get_property(&self, _path: Vec<&str>) -> Option<Bytes> {
67            unimplemented!("Not implemented for current target")
68        }
69
70        fn set_property(&self, _path: Vec<&str>, _value: Option<&[u8]>) {
71            unimplemented!("Not implemented for current target")
72        }
73
74        fn get_shared_data(&self, _key: &str) -> (Option<Bytes>, Option<u32>) {
75            unimplemented!("Not implemented for current target")
76        }
77
78        fn set_shared_data(
79            &self,
80            _key: &str,
81            _value: Option<&[u8]>,
82            _cas: Option<u32>,
83        ) -> Result<(), Status> {
84            unimplemented!("Not implemented for current target")
85        }
86
87        fn register_shared_queue(&self, _name: &str) -> u32 {
88            unimplemented!("Not implemented for current target")
89        }
90
91        fn resolve_shared_queue(&self, _vm_id: &str, _name: &str) -> Option<u32> {
92            unimplemented!("Not implemented for current target")
93        }
94
95        fn dequeue_shared_queue(&self, _queue_id: u32) -> Result<Option<Bytes>, Status> {
96            unimplemented!("Not implemented for current target")
97        }
98
99        fn enqueue_shared_queue(
100            &self,
101            _queue_id: u32,
102            _value: Option<&[u8]>,
103        ) -> Result<(), Status> {
104            unimplemented!("Not implemented for current target")
105        }
106
107        fn dispatch_http_call(
108            &self,
109            _upstream: &str,
110            _headers: Vec<(&str, &str)>,
111            _body: Option<&[u8]>,
112            _trailers: Vec<(&str, &str)>,
113            _timeout: Duration,
114        ) -> Result<u32, Status> {
115            unimplemented!("Not implemented for current target")
116        }
117
118        fn on_http_call_response(
119            &mut self,
120            _token_id: u32,
121            _num_headers: usize,
122            _body_size: usize,
123            _num_trailers: usize,
124        ) {
125            unimplemented!("Not implemented for current target")
126        }
127
128        fn get_http_call_response_headers(&self) -> Vec<(String, String)> {
129            unimplemented!("Not implemented for current target")
130        }
131
132        fn get_http_call_response_headers_bytes(&self) -> Vec<(String, Bytes)> {
133            unimplemented!("Not implemented for current target")
134        }
135
136        fn get_http_call_response_header(&self, _name: &str) -> Option<String> {
137            unimplemented!("Not implemented for current target")
138        }
139
140        fn get_http_call_response_header_bytes(&self, _name: &str) -> Option<Bytes> {
141            unimplemented!("Not implemented for current target")
142        }
143
144        fn get_http_call_response_body(&self, _start: usize, _max_size: usize) -> Option<Bytes> {
145            unimplemented!("Not implemented for current target")
146        }
147
148        fn get_http_call_response_trailers(&self) -> Vec<(String, String)> {
149            unimplemented!("Not implemented for current target")
150        }
151
152        fn get_http_call_response_trailers_bytes(&self) -> Vec<(String, Bytes)> {
153            unimplemented!("Not implemented for current target")
154        }
155
156        fn get_http_call_response_trailer(&self, _name: &str) -> Option<String> {
157            unimplemented!("Not implemented for current target")
158        }
159
160        fn get_http_call_response_trailer_bytes(&self, _name: &str) -> Option<Bytes> {
161            unimplemented!("Not implemented for current target")
162        }
163
164        fn dispatch_grpc_call(
165            &self,
166            _upstream_name: &str,
167            _service_name: &str,
168            _method_name: &str,
169            _initial_metadata: Vec<(&str, &[u8])>,
170            _message: Option<&[u8]>,
171            _timeout: Duration,
172        ) -> Result<u32, Status> {
173            unimplemented!("Not implemented for current target")
174        }
175
176        fn on_grpc_call_response(
177            &mut self,
178            _token_id: u32,
179            _status_code: u32,
180            _response_size: usize,
181        ) {
182            unimplemented!("Not implemented for current target")
183        }
184
185        fn get_grpc_call_response_body(&self, _start: usize, _max_size: usize) -> Option<Bytes> {
186            unimplemented!("Not implemented for current target")
187        }
188
189        fn cancel_grpc_call(&self, _token_id: u32) {
190            unimplemented!("Not implemented for current target")
191        }
192
193        fn open_grpc_stream(
194            &self,
195            _cluster_name: &str,
196            _service_name: &str,
197            _method_name: &str,
198            _initial_metadata: Vec<(&str, &[u8])>,
199        ) -> Result<u32, Status> {
200            unimplemented!("Not implemented for current target")
201        }
202
203        fn on_grpc_stream_initial_metadata(&mut self, _token_id: u32, _num_elements: u32) {
204            unimplemented!("Not implemented for current target")
205        }
206
207        fn get_grpc_stream_initial_metadata(&self) -> Vec<(String, Bytes)> {
208            unimplemented!("Not implemented for current target")
209        }
210
211        fn get_grpc_stream_initial_metadata_value(&self, _name: &str) -> Option<Bytes> {
212            unimplemented!("Not implemented for current target")
213        }
214
215        fn send_grpc_stream_message(
216            &self,
217            _token_id: u32,
218            _message: Option<&[u8]>,
219            _end_stream: bool,
220        ) {
221            unimplemented!("Not implemented for current target")
222        }
223
224        fn on_grpc_stream_message(&mut self, _token_id: u32, _message_size: usize) {
225            unimplemented!("Not implemented for current target")
226        }
227
228        fn get_grpc_stream_message(&mut self, _start: usize, _max_size: usize) -> Option<Bytes> {
229            unimplemented!("Not implemented for current target")
230        }
231
232        fn on_grpc_stream_trailing_metadata(&mut self, _token_id: u32, _num_elements: u32) {
233            unimplemented!("Not implemented for current target")
234        }
235
236        fn get_grpc_stream_trailing_metadata(&self) -> Vec<(String, Bytes)> {
237            unimplemented!("Not implemented for current target")
238        }
239
240        fn get_grpc_stream_trailing_metadata_value(&self, _name: &str) -> Option<Bytes> {
241            unimplemented!("Not implemented for current target")
242        }
243
244        fn cancel_grpc_stream(&self, _token_id: u32) {
245            unimplemented!("Not implemented for current target")
246        }
247
248        fn close_grpc_stream(&self, _token_id: u32) {
249            unimplemented!("Not implemented for current target")
250        }
251
252        fn on_grpc_stream_close(&mut self, _token_id: u32, _status_code: u32) {
253            unimplemented!("Not implemented for current target")
254        }
255
256        fn get_grpc_status(&self) -> (u32, Option<String>) {
257            unimplemented!("Not implemented for current target")
258        }
259
260        fn call_foreign_function(
261            &self,
262            _function_name: &str,
263            _arguments: Option<&[u8]>,
264        ) -> Result<Option<Bytes>, Status> {
265            unimplemented!("Not implemented for current target")
266        }
267
268        fn on_done(&mut self) -> bool {
269            unimplemented!("Not implemented for current target")
270        }
271
272        fn done(&self) {
273            unimplemented!("Not implemented for current target")
274        }
275    }
276
277    /// Trait for the root context.
278    pub trait RootContext: Context {
279        fn on_vm_start(&mut self, _vm_configuration_size: usize) -> bool {
280            unimplemented!("Not implemented for current target")
281        }
282
283        fn get_vm_configuration(&self) -> Option<Bytes> {
284            unimplemented!("Not implemented for current target")
285        }
286
287        fn on_configure(&mut self, _plugin_configuration_size: usize) -> bool {
288            unimplemented!("Not implemented for current target")
289        }
290
291        fn get_plugin_configuration(&self) -> Option<Bytes> {
292            unimplemented!("Not implemented for current target")
293        }
294
295        fn set_tick_period(&self, _period: Duration) {
296            unimplemented!("Not implemented for current target")
297        }
298
299        fn on_tick(&mut self) {
300            unimplemented!("Not implemented for current target")
301        }
302
303        fn on_queue_ready(&mut self, _queue_id: u32) {
304            unimplemented!("Not implemented for current target")
305        }
306
307        fn on_log(&mut self) {
308            unimplemented!("Not implemented for current target")
309        }
310
311        fn create_http_context(&self, _context_id: u32) -> Option<Box<dyn HttpContext>> {
312            unimplemented!("Not implemented for current target")
313        }
314
315        fn create_stream_context(&self, _context_id: u32) -> Option<Box<dyn StreamContext>> {
316            unimplemented!("Not implemented for current target")
317        }
318
319        fn get_type(&self) -> Option<ContextType> {
320            unimplemented!("Not implemented for current target")
321        }
322    }
323
324    /// Trait for the stream context.
325    pub trait StreamContext: Context {}
326
327    /// Trait for the HTTP context.
328    pub trait HttpContext: Context {
329        fn on_http_request_headers(&mut self, _num_headers: usize, _end_of_stream: bool) -> Action {
330            unimplemented!("Not implemented for current target")
331        }
332
333        fn get_http_request_headers(&self) -> Vec<(String, String)> {
334            unimplemented!("Not implemented for current target")
335        }
336
337        fn get_http_request_headers_bytes(&self) -> Vec<(String, Bytes)> {
338            unimplemented!("Not implemented for current target")
339        }
340
341        fn set_http_request_headers(&self, _headers: Vec<(&str, &str)>) {
342            unimplemented!("Not implemented for current target")
343        }
344
345        fn set_http_request_headers_bytes(&self, _headers: Vec<(&str, &[u8])>) {
346            unimplemented!("Not implemented for current target")
347        }
348
349        fn get_http_request_header(&self, _name: &str) -> Option<String> {
350            unimplemented!("Not implemented for current target")
351        }
352
353        fn get_http_request_header_bytes(&self, _name: &str) -> Option<Bytes> {
354            unimplemented!("Not implemented for current target")
355        }
356
357        fn set_http_request_header(&self, _name: &str, _value: Option<&str>) {
358            unimplemented!("Not implemented for current target")
359        }
360
361        fn set_http_request_header_bytes(&self, _name: &str, _value: Option<&[u8]>) {
362            unimplemented!("Not implemented for current target")
363        }
364
365        fn add_http_request_header(&self, _name: &str, _value: &str) {
366            unimplemented!("Not implemented for current target")
367        }
368
369        fn add_http_request_header_bytes(&self, _name: &str, _value: &[u8]) {
370            unimplemented!("Not implemented for current target")
371        }
372
373        fn on_http_request_body(&mut self, _body_size: usize, _end_of_stream: bool) -> Action {
374            unimplemented!("Not implemented for current target")
375        }
376
377        fn get_http_request_body(&self, _start: usize, _max_size: usize) -> Option<Bytes> {
378            unimplemented!("Not implemented for current target")
379        }
380
381        fn set_http_request_body(&self, _start: usize, _size: usize, _value: &[u8]) {
382            unimplemented!("Not implemented for current target")
383        }
384
385        fn on_http_request_trailers(&mut self, _num_trailers: usize) -> Action {
386            unimplemented!("Not implemented for current target")
387        }
388
389        fn get_http_request_trailers(&self) -> Vec<(String, String)> {
390            unimplemented!("Not implemented for current target")
391        }
392
393        fn get_http_request_trailers_bytes(&self) -> Vec<(String, Bytes)> {
394            unimplemented!("Not implemented for current target")
395        }
396
397        fn set_http_request_trailers(&self, _trailers: Vec<(&str, &str)>) {
398            unimplemented!("Not implemented for current target")
399        }
400
401        fn set_http_request_trailers_bytes(&self, _trailers: Vec<(&str, &[u8])>) {
402            unimplemented!("Not implemented for current target")
403        }
404
405        fn get_http_request_trailer(&self, _name: &str) -> Option<String> {
406            unimplemented!("Not implemented for current target")
407        }
408
409        fn get_http_request_trailer_bytes(&self, _name: &str) -> Option<Bytes> {
410            unimplemented!("Not implemented for current target")
411        }
412
413        fn set_http_request_trailer(&self, _name: &str, _value: Option<&str>) {
414            unimplemented!("Not implemented for current target")
415        }
416
417        fn set_http_request_trailer_bytes(&self, _name: &str, _value: Option<&[u8]>) {
418            unimplemented!("Not implemented for current target")
419        }
420
421        fn add_http_request_trailer(&self, _name: &str, _value: &str) {
422            unimplemented!("Not implemented for current target")
423        }
424
425        fn add_http_request_trailer_bytes(&self, _name: &str, _value: &[u8]) {
426            unimplemented!("Not implemented for current target")
427        }
428
429        fn resume_http_request(&self) {
430            unimplemented!("Not implemented for current target")
431        }
432
433        fn reset_http_request(&self) {
434            unimplemented!("Not implemented for current target")
435        }
436
437        fn on_http_response_headers(
438            &mut self,
439            _num_headers: usize,
440            _end_of_stream: bool,
441        ) -> Action {
442            unimplemented!("Not implemented for current target")
443        }
444
445        fn get_http_response_headers(&self) -> Vec<(String, String)> {
446            unimplemented!("Not implemented for current target")
447        }
448
449        fn get_http_response_headers_bytes(&self) -> Vec<(String, Bytes)> {
450            unimplemented!("Not implemented for current target")
451        }
452
453        fn set_http_response_headers(&self, _headers: Vec<(&str, &str)>) {
454            unimplemented!("Not implemented for current target")
455        }
456
457        fn set_http_response_headers_bytes(&self, _headers: Vec<(&str, &[u8])>) {
458            unimplemented!("Not implemented for current target")
459        }
460
461        fn get_http_response_header(&self, _name: &str) -> Option<String> {
462            unimplemented!("Not implemented for current target")
463        }
464
465        fn get_http_response_header_bytes(&self, _name: &str) -> Option<Bytes> {
466            unimplemented!("Not implemented for current target")
467        }
468
469        fn set_http_response_header(&self, _name: &str, _value: Option<&str>) {
470            unimplemented!("Not implemented for current target")
471        }
472
473        fn set_http_response_header_bytes(&self, _name: &str, _value: Option<&[u8]>) {
474            unimplemented!("Not implemented for current target")
475        }
476
477        fn add_http_response_header(&self, _name: &str, _value: &str) {
478            unimplemented!("Not implemented for current target")
479        }
480
481        fn add_http_response_header_bytes(&self, _name: &str, _value: &[u8]) {
482            unimplemented!("Not implemented for current target")
483        }
484
485        fn on_http_response_body(&mut self, _body_size: usize, _end_of_stream: bool) -> Action {
486            unimplemented!("Not implemented for current target")
487        }
488
489        fn get_http_response_body(&self, _start: usize, _max_size: usize) -> Option<Bytes> {
490            unimplemented!("Not implemented for current target")
491        }
492
493        fn set_http_response_body(&self, _start: usize, _size: usize, _value: &[u8]) {
494            unimplemented!("Not implemented for current target")
495        }
496
497        fn on_http_response_trailers(&mut self, _num_trailers: usize) -> Action {
498            unimplemented!("Not implemented for current target")
499        }
500
501        fn get_http_response_trailers(&self) -> Vec<(String, String)> {
502            unimplemented!("Not implemented for current target")
503        }
504
505        fn get_http_response_trailers_bytes(&self) -> Vec<(String, Bytes)> {
506            unimplemented!("Not implemented for current target")
507        }
508
509        fn set_http_response_trailers(&self, _trailers: Vec<(&str, &str)>) {
510            unimplemented!("Not implemented for current target")
511        }
512
513        fn set_http_response_trailers_bytes(&self, _trailers: Vec<(&str, &[u8])>) {
514            unimplemented!("Not implemented for current target")
515        }
516
517        fn get_http_response_trailer(&self, _name: &str) -> Option<String> {
518            unimplemented!("Not implemented for current target")
519        }
520
521        fn get_http_response_trailer_bytes(&self, _name: &str) -> Option<Bytes> {
522            unimplemented!("Not implemented for current target")
523        }
524
525        fn set_http_response_trailer(&self, _name: &str, _value: Option<&str>) {
526            unimplemented!("Not implemented for current target")
527        }
528
529        fn set_http_response_trailer_bytes(&self, _name: &str, _value: Option<&[u8]>) {
530            unimplemented!("Not implemented for current target")
531        }
532
533        fn add_http_response_trailer(&self, _name: &str, _value: &str) {
534            unimplemented!("Not implemented for current target")
535        }
536
537        fn add_http_response_trailer_bytes(&self, _name: &str, _value: &[u8]) {
538            unimplemented!("Not implemented for current target")
539        }
540
541        fn resume_http_response(&self) {
542            unimplemented!("Not implemented for current target")
543        }
544
545        fn reset_http_response(&self) {
546            unimplemented!("Not implemented for current target")
547        }
548
549        fn send_http_response(
550            &self,
551            _status_code: u32,
552            _headers: Vec<(&str, &str)>,
553            _body: Option<&[u8]>,
554        ) {
555            unimplemented!("Not implemented for current target")
556        }
557
558        fn on_log(&mut self) {
559            unimplemented!("Not implemented for current target")
560        }
561    }
562}
563
564/// Types.
565pub mod types {
566    use crate::traits::{HttpContext, RootContext, StreamContext};
567
568    /// Type for the new root context.
569    pub type NewRootContext = fn(context_id: u32) -> Box<dyn RootContext>;
570    /// Type for the new stream context.
571    pub type NewStreamContext = fn(context_id: u32, root_context_id: u32) -> Box<dyn StreamContext>;
572    /// Type for the new HTTP context.
573    pub type NewHttpContext = fn(context_id: u32, root_context_id: u32) -> Box<dyn HttpContext>;
574
575    /// Metric type.
576    #[repr(u32)]
577    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
578    #[non_exhaustive]
579    pub enum MetricType {
580        Counter = 0,
581        Gauge = 1,
582        Histogram = 2,
583    }
584
585    /// Action type.
586    #[repr(u32)]
587    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
588    #[non_exhaustive]
589    pub enum Action {
590        Continue = 0,
591        Pause = 1,
592    }
593
594    /// Buffer type.
595    #[repr(u32)]
596    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
597    #[non_exhaustive]
598    pub enum BufferType {
599        HttpRequestBody = 0,
600        HttpResponseBody = 1,
601        DownstreamData = 2,
602        UpstreamData = 3,
603        HttpCallResponseBody = 4,
604        GrpcReceiveBuffer = 5,
605        VmConfiguration = 6,
606        PluginConfiguration = 7,
607    }
608
609    /// Bytes type.
610    pub type Bytes = Vec<u8>;
611
612    /// Map type.
613    #[repr(u32)]
614    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
615    #[non_exhaustive]
616    pub enum MapType {
617        HttpRequestHeaders = 0,
618        HttpRequestTrailers = 1,
619        HttpResponseHeaders = 2,
620        HttpResponseTrailers = 3,
621        GrpcReceiveInitialMetadata = 4,
622        GrpcReceiveTrailingMetadata = 5,
623        HttpCallResponseHeaders = 6,
624        HttpCallResponseTrailers = 7,
625    }
626
627    /// Status type.
628    #[repr(u32)]
629    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
630    #[non_exhaustive]
631    pub enum Status {
632        Ok = 0,
633        NotFound = 1,
634        BadArgument = 2,
635        ParseFailure = 4,
636        Empty = 7,
637        CasMismatch = 8,
638        InternalFailure = 10,
639    }
640
641    /// Log level type.
642    #[repr(u32)]
643    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
644    pub enum LogLevel {
645        Trace = 0,
646        Debug = 1,
647        Info = 2,
648        Warn = 3,
649        Error = 4,
650        Critical = 5,
651    }
652
653    /// Context type.
654    #[repr(u32)]
655    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
656    #[non_exhaustive]
657    pub enum ContextType {
658        HttpContext = 0,
659        StreamContext = 1,
660    }
661}
662
663/// Host calls.
664pub mod hostcalls {
665    use std::time::{Duration, SystemTime};
666
667    use crate::types::{BufferType, Bytes, LogLevel, MapType, MetricType, Status};
668
669    /// Logs a message.
670    pub fn log(_level: LogLevel, _message: &str) -> Result<(), Status> {
671        unimplemented!("Not implemented for current target")
672    }
673
674    /// Gets the log level.
675    pub fn get_log_level() -> Result<LogLevel, Status> {
676        unimplemented!("Not implemented for current target")
677    }
678
679    /// Gets the current time.
680    pub fn get_current_time() -> Result<SystemTime, Status> {
681        unimplemented!("Not implemented for current target")
682    }
683
684    /// Sets the tick period.
685    pub fn set_tick_period(_period: Duration) -> Result<(), Status> {
686        unimplemented!("Not implemented for current target")
687    }
688
689    /// Gets the buffer.
690    pub fn get_buffer(
691        _buffer_type: BufferType,
692        _start: usize,
693        _max_size: usize,
694    ) -> Result<Option<Bytes>, Status> {
695        unimplemented!("Not implemented for current target")
696    }
697
698    /// Sets the buffer.
699    pub fn set_buffer(
700        _buffer_type: BufferType,
701        _start: usize,
702        _size: usize,
703        _value: &[u8],
704    ) -> Result<(), Status> {
705        unimplemented!("Not implemented for current target")
706    }
707
708    /// Gets the map.
709    pub fn get_map(_map_type: MapType) -> Result<Vec<(String, String)>, Status> {
710        unimplemented!("Not implemented for current target")
711    }
712
713    /// Gets the map bytes.
714    pub fn get_map_bytes(_map_type: MapType) -> Result<Vec<(String, Bytes)>, Status> {
715        unimplemented!("Not implemented for current target")
716    }
717
718    /// Sets the map.
719    pub fn set_map(_map_type: MapType, _map: Vec<(&str, &str)>) -> Result<(), Status> {
720        unimplemented!("Not implemented for current target")
721    }
722
723    /// Sets the map bytes.
724    pub fn set_map_bytes(_map_type: MapType, _map: Vec<(&str, &[u8])>) -> Result<(), Status> {
725        unimplemented!("Not implemented for current target")
726    }
727
728    /// Gets the map value.
729    pub fn get_map_value(_map_type: MapType, _key: &str) -> Result<Option<String>, Status> {
730        unimplemented!("Not implemented for current target")
731    }
732
733    /// Gets the map value bytes.
734    pub fn get_map_value_bytes(_map_type: MapType, _key: &str) -> Result<Option<Bytes>, Status> {
735        unimplemented!("Not implemented for current target")
736    }
737
738    /// Sets the map value.
739    pub fn set_map_value(
740        _map_type: MapType,
741        _key: &str,
742        _value: Option<&str>,
743    ) -> Result<(), Status> {
744        unimplemented!("Not implemented for current target")
745    }
746
747    /// Sets the map value bytes.
748    pub fn set_map_value_bytes(
749        _map_type: MapType,
750        _key: &str,
751        _value: Option<&[u8]>,
752    ) -> Result<(), Status> {
753        unimplemented!("Not implemented for current target")
754    }
755
756    /// Adds a map value.
757    pub fn add_map_value(_map_type: MapType, _key: &str, _value: &str) -> Result<(), Status> {
758        unimplemented!("Not implemented for current target")
759    }
760
761    /// Adds a map value bytes.
762    pub fn add_map_value_bytes(
763        _map_type: MapType,
764        _key: &str,
765        _value: &[u8],
766    ) -> Result<(), Status> {
767        unimplemented!("Not implemented for current target")
768    }
769
770    /// Gets the property.
771    pub fn get_property(_path: Vec<&str>) -> Result<Option<Bytes>, Status> {
772        unimplemented!("Not implemented for current target")
773    }
774
775    /// Sets the property.
776    pub fn set_property(_path: Vec<&str>, _value: Option<&[u8]>) -> Result<(), Status> {
777        unimplemented!("Not implemented for current target")
778    }
779
780    /// Gets the shared data.
781    pub fn get_shared_data(_key: &str) -> Result<(Option<Bytes>, Option<u32>), Status> {
782        unimplemented!("Not implemented for current target")
783    }
784
785    /// Sets the shared data.
786    pub fn set_shared_data(
787        _key: &str,
788        _value: Option<&[u8]>,
789        _cas: Option<u32>,
790    ) -> Result<(), Status> {
791        unimplemented!("Not implemented for current target")
792    }
793
794    /// Registers a shared queue.
795    pub fn register_shared_queue(_name: &str) -> Result<u32, Status> {
796        unimplemented!("Not implemented for current target")
797    }
798
799    /// Resolves a shared queue.
800    pub fn resolve_shared_queue(_vm_id: &str, _name: &str) -> Result<Option<u32>, Status> {
801        unimplemented!("Not implemented for current target")
802    }
803
804    /// Dequeues a shared queue.
805    pub fn dequeue_shared_queue(_queue_id: u32) -> Result<Option<Bytes>, Status> {
806        unimplemented!("Not implemented for current target")
807    }
808
809    /// Enqueues a shared queue.
810    pub fn enqueue_shared_queue(_queue_id: u32, _value: Option<&[u8]>) -> Result<(), Status> {
811        unimplemented!("Not implemented for current target")
812    }
813
814    /// Resumes the downstream.
815    pub fn resume_downstream() -> Result<(), Status> {
816        unimplemented!("Not implemented for current target")
817    }
818
819    /// Resumes the upstream.
820    pub fn resume_upstream() -> Result<(), Status> {
821        unimplemented!("Not implemented for current target")
822    }
823
824    /// Resumes the HTTP request.
825    pub fn resume_http_request() -> Result<(), Status> {
826        unimplemented!("Not implemented for current target")
827    }
828
829    /// Resumes the HTTP response.
830    pub fn resume_http_response() -> Result<(), Status> {
831        unimplemented!("Not implemented for current target")
832    }
833
834    /// Closes the downstream.
835    pub fn close_downstream() -> Result<(), Status> {
836        unimplemented!("Not implemented for current target")
837    }
838
839    /// Closes the upstream.
840    pub fn close_upstream() -> Result<(), Status> {
841        unimplemented!("Not implemented for current target")
842    }
843
844    /// Resets the HTTP request.
845    pub fn reset_http_request() -> Result<(), Status> {
846        unimplemented!("Not implemented for current target")
847    }
848
849    /// Resets the HTTP response.
850    pub fn reset_http_response() -> Result<(), Status> {
851        unimplemented!("Not implemented for current target")
852    }
853
854    /// Sends the HTTP response.
855    pub fn send_http_response(
856        _status_code: u32,
857        _headers: Vec<(&str, &str)>,
858        _body: Option<&[u8]>,
859    ) -> Result<(), Status> {
860        unimplemented!("Not implemented for current target")
861    }
862
863    /// Dispatches an HTTP call.
864    pub fn dispatch_http_call(
865        _upstream: &str,
866        _headers: Vec<(&str, &str)>,
867        _body: Option<&[u8]>,
868        _trailers: Vec<(&str, &str)>,
869        _timeout: Duration,
870    ) -> Result<u32, Status> {
871        unimplemented!("Not implemented for current target")
872    }
873
874    /// Dispatches a gRPC call.
875    pub fn dispatch_grpc_call(
876        _upstream_name: &str,
877        _service_name: &str,
878        _method_name: &str,
879        _initial_metadata: Vec<(&str, &[u8])>,
880        _message: Option<&[u8]>,
881        _timeout: Duration,
882    ) -> Result<u32, Status> {
883        unimplemented!("Not implemented for current target")
884    }
885
886    /// Opens a gRPC stream.
887    pub fn open_grpc_stream(
888        _upstream_name: &str,
889        _service_name: &str,
890        _method_name: &str,
891        _initial_metadata: Vec<(&str, &[u8])>,
892    ) -> Result<u32, Status> {
893        unimplemented!("Not implemented for current target")
894    }
895
896    /// Sends a gRPC stream message.
897    pub fn send_grpc_stream_message(
898        _token: u32,
899        _message: Option<&[u8]>,
900        _end_stream: bool,
901    ) -> Result<(), Status> {
902        unimplemented!("Not implemented for current target")
903    }
904
905    /// Cancels a gRPC call.
906    pub fn cancel_grpc_call(_token_id: u32) -> Result<(), Status> {
907        unimplemented!("Not implemented for current target")
908    }
909
910    /// Cancels a gRPC stream.
911    pub fn cancel_grpc_stream(_token_id: u32) -> Result<(), Status> {
912        unimplemented!("Not implemented for current target")
913    }
914
915    /// Closes a gRPC stream.
916    pub fn close_grpc_stream(_token_id: u32) -> Result<(), Status> {
917        unimplemented!("Not implemented for current target")
918    }
919
920    /// Gets the gRPC status.
921    pub fn get_grpc_status() -> Result<(u32, Option<String>), Status> {
922        unimplemented!("Not implemented for current target")
923    }
924
925    /// Sets the effective context.
926    pub fn set_effective_context(_context_id: u32) -> Result<(), Status> {
927        unimplemented!("Not implemented for current target")
928    }
929
930    /// Calls a foreign function.
931    pub fn call_foreign_function(
932        _function_name: &str,
933        _arguments: Option<&[u8]>,
934    ) -> Result<Option<Bytes>, Status> {
935        unimplemented!("Not implemented for current target")
936    }
937
938    /// Indicates done state.
939    pub fn done() -> Result<(), Status> {
940        unimplemented!("Not implemented for current target")
941    }
942
943    /// Defines a metric.
944    pub fn define_metric(_metric_type: MetricType, _name: &str) -> Result<u32, Status> {
945        unimplemented!("Not implemented for current target")
946    }
947
948    /// Gets the metric.
949    pub fn get_metric(_metric_id: u32) -> Result<u64, Status> {
950        unimplemented!("Not implemented for current target")
951    }
952
953    /// Records a metric.
954    pub fn record_metric(_metric_id: u32, _value: u64) -> Result<(), Status> {
955        unimplemented!("Not implemented for current target")
956    }
957
958    /// Increments a metric.
959    pub fn increment_metric(_metric_id: u32, _offset: i64) -> Result<(), Status> {
960        unimplemented!("Not implemented for current target")
961    }
962}