pub trait Context {
Show 41 methods
// Provided methods
fn get_current_time(&self) -> SystemTime { ... }
fn get_property(&self, path: Vec<&str>) -> Option<Bytes> { ... }
fn set_property(&self, path: Vec<&str>, value: Option<&[u8]>) { ... }
fn get_shared_data(&self, key: &str) -> (Option<Bytes>, Option<u32>) { ... }
fn set_shared_data(
&self,
key: &str,
value: Option<&[u8]>,
cas: Option<u32>,
) -> Result<(), Status> { ... }
fn register_shared_queue(&self, name: &str) -> u32 { ... }
fn resolve_shared_queue(&self, vm_id: &str, name: &str) -> Option<u32> { ... }
fn dequeue_shared_queue(
&self,
queue_id: u32,
) -> Result<Option<Bytes>, Status> { ... }
fn enqueue_shared_queue(
&self,
queue_id: u32,
value: Option<&[u8]>,
) -> Result<(), Status> { ... }
fn dispatch_http_call(
&self,
upstream: &str,
headers: Vec<(&str, &str)>,
body: Option<&[u8]>,
trailers: Vec<(&str, &str)>,
timeout: Duration,
) -> Result<u32, Status> { ... }
fn on_http_call_response(
&mut self,
_token_id: u32,
_num_headers: usize,
_body_size: usize,
_num_trailers: usize,
) { ... }
fn get_http_call_response_headers(&self) -> Vec<(String, String)> { ... }
fn get_http_call_response_headers_bytes(&self) -> Vec<(String, Bytes)> { ... }
fn get_http_call_response_header(&self, name: &str) -> Option<String> { ... }
fn get_http_call_response_header_bytes(&self, name: &str) -> Option<Bytes> { ... }
fn get_http_call_response_body(
&self,
start: usize,
max_size: usize,
) -> Option<Bytes> { ... }
fn get_http_call_response_trailers(&self) -> Vec<(String, String)> { ... }
fn get_http_call_response_trailers_bytes(&self) -> Vec<(String, Bytes)> { ... }
fn get_http_call_response_trailer(&self, name: &str) -> Option<String> { ... }
fn get_http_call_response_trailer_bytes(&self, name: &str) -> Option<Bytes> { ... }
fn dispatch_grpc_call(
&self,
upstream_name: &str,
service_name: &str,
method_name: &str,
initial_metadata: Vec<(&str, &[u8])>,
message: Option<&[u8]>,
timeout: Duration,
) -> Result<u32, Status> { ... }
fn on_grpc_call_response(
&mut self,
_token_id: u32,
_status_code: u32,
_response_size: usize,
) { ... }
fn get_grpc_call_response_body(
&self,
start: usize,
max_size: usize,
) -> Option<Bytes> { ... }
fn cancel_grpc_call(&self, token_id: u32) { ... }
fn open_grpc_stream(
&self,
cluster_name: &str,
service_name: &str,
method_name: &str,
initial_metadata: Vec<(&str, &[u8])>,
) -> Result<u32, Status> { ... }
fn on_grpc_stream_initial_metadata(
&mut self,
_token_id: u32,
_num_elements: u32,
) { ... }
fn get_grpc_stream_initial_metadata(&self) -> Vec<(String, Bytes)> { ... }
fn get_grpc_stream_initial_metadata_value(
&self,
name: &str,
) -> Option<Bytes> { ... }
fn send_grpc_stream_message(
&self,
token_id: u32,
message: Option<&[u8]>,
end_stream: bool,
) { ... }
fn on_grpc_stream_message(&mut self, _token_id: u32, _message_size: usize) { ... }
fn get_grpc_stream_message(
&mut self,
start: usize,
max_size: usize,
) -> Option<Bytes> { ... }
fn on_grpc_stream_trailing_metadata(
&mut self,
_token_id: u32,
_num_elements: u32,
) { ... }
fn get_grpc_stream_trailing_metadata(&self) -> Vec<(String, Bytes)> { ... }
fn get_grpc_stream_trailing_metadata_value(
&self,
name: &str,
) -> Option<Bytes> { ... }
fn cancel_grpc_stream(&self, token_id: u32) { ... }
fn close_grpc_stream(&self, token_id: u32) { ... }
fn on_grpc_stream_close(&mut self, _token_id: u32, _status_code: u32) { ... }
fn get_grpc_status(&self) -> (u32, Option<String>) { ... }
fn call_foreign_function(
&self,
function_name: &str,
arguments: Option<&[u8]>,
) -> Result<Option<Bytes>, Status> { ... }
fn on_done(&mut self) -> bool { ... }
fn done(&self) { ... }
}