-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathcompute_runtime.rs
More file actions
53 lines (41 loc) · 1.18 KB
/
compute_runtime.rs
File metadata and controls
53 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::component::bindings::fastly::compute::compute_runtime;
use crate::linking::ComponentCtx;
use std::sync::atomic::Ordering;
impl compute_runtime::Host for ComponentCtx {
fn get_vcpu_ms(&mut self) -> u64 {
self.session().active_cpu_time_us.load(Ordering::SeqCst) / 1000
}
fn get_heap_mib(&mut self) -> compute_runtime::MemoryMib {
self.session().get_heap_usage_mib()
}
fn get_sandbox_id(&mut self) -> String {
format!("{:032x}", self.session().session_id())
}
fn get_hostname(&mut self) -> String {
"localhost".to_owned()
}
fn get_pop(&mut self) -> String {
"XXX".to_owned()
}
fn get_region(&mut self) -> String {
"Somewhere".to_owned()
}
fn get_cache_generation(&mut self) -> u64 {
0
}
fn get_customer_id(&mut self) -> String {
"0000000000000000000000".to_owned()
}
fn get_is_staging(&mut self) -> bool {
false
}
fn get_service_id(&mut self) -> String {
"0000000000000000000000".to_owned()
}
fn get_service_version(&mut self) -> u64 {
0
}
fn get_namespace_id(&mut self) -> String {
"".to_owned()
}
}