@@ -220,9 +220,9 @@ bool Fastly::env_get(JSContext *cx, unsigned argc, JS::Value *vp) {
220220 return true ;
221221}
222222
223- bool runtime_get_vcpu_time (JSContext *cx, unsigned argc, JS::Value *vp) {
223+ bool compute_get_vcpu_time (JSContext *cx, unsigned argc, JS::Value *vp) {
224224 JS::CallArgs args = CallArgsFromVp (argc, vp);
225- auto res = host_api::Runtime ::get_vcpu_ms ();
225+ auto res = host_api::Compute ::get_vcpu_ms ();
226226 if (auto *err = res.to_err ()) {
227227 HANDLE_ERROR (cx, *err);
228228 return false ;
@@ -231,7 +231,7 @@ bool runtime_get_vcpu_time(JSContext *cx, unsigned argc, JS::Value *vp) {
231231 return true ;
232232}
233233
234- bool runtime_purge_surrogate_key (JSContext *cx, unsigned argc, JS::Value *vp) {
234+ bool compute_purge_surrogate_key (JSContext *cx, unsigned argc, JS::Value *vp) {
235235 JS::CallArgs args = CallArgsFromVp (argc, vp);
236236 if (!args.requireAtLeast (cx, " purgeSurrogateKey" , 1 )) {
237237 return false ;
@@ -246,7 +246,7 @@ bool runtime_purge_surrogate_key(JSContext *cx, unsigned argc, JS::Value *vp) {
246246 if (soft_val.isBoolean ()) {
247247 soft = soft_val.toBoolean ();
248248 }
249- auto purge_res = host_api::Runtime ::purge_surrogate_key (surrogate_key_chars, soft);
249+ auto purge_res = host_api::Compute ::purge_surrogate_key (surrogate_key_chars, soft);
250250 if (auto *err = purge_res.to_err ()) {
251251 HANDLE_ERROR (cx, *err);
252252 return false ;
@@ -449,34 +449,34 @@ bool install(api::Engine *engine) {
449449 return false ;
450450 }
451451
452- // fastly:runtime
453- RootedObject runtime_builtin (engine->cx (), JS_NewObject (engine->cx (), nullptr ));
454- auto runtime_purge_surrogate_key_fn =
455- JS_NewFunction (engine->cx (), &runtime_purge_surrogate_key , 1 , 0 , " purgeSurrogateKey" );
456- RootedObject runtime_purge_surrogate_key_obj (
457- engine->cx (), JS_GetFunctionObject (runtime_purge_surrogate_key_fn ));
458- RootedValue runtime_purge_surrogate_key_val (engine->cx (),
459- ObjectValue (*runtime_purge_surrogate_key_obj ));
452+ // fastly:compute
453+ RootedObject compute_builtin (engine->cx (), JS_NewObject (engine->cx (), nullptr ));
454+ auto compute_purge_surrogate_key_fn =
455+ JS_NewFunction (engine->cx (), &compute_purge_surrogate_key , 1 , 0 , " purgeSurrogateKey" );
456+ RootedObject compute_purge_surrogate_key_obj (
457+ engine->cx (), JS_GetFunctionObject (compute_purge_surrogate_key_fn ));
458+ RootedValue compute_purge_surrogate_key_val (engine->cx (),
459+ ObjectValue (*compute_purge_surrogate_key_obj ));
460460
461- if (!JS_SetProperty (engine->cx (), runtime_builtin , " purgeSurrogateKey" ,
462- runtime_purge_surrogate_key_val )) {
461+ if (!JS_SetProperty (engine->cx (), compute_builtin , " purgeSurrogateKey" ,
462+ compute_purge_surrogate_key_val )) {
463463 return false ;
464464 }
465- if (!JS_SetProperty (engine->cx (), fastly, " purgeSurrogateKey" , runtime_purge_surrogate_key_val )) {
465+ if (!JS_SetProperty (engine->cx (), fastly, " purgeSurrogateKey" , compute_purge_surrogate_key_val )) {
466466 return false ;
467467 }
468- auto runtime_vcpu_time_get =
469- JS_NewFunction (engine->cx (), &runtime_get_vcpu_time , 0 , 0 , " vCpuTime" );
470- RootedObject runtime_vcpu_time_get_obj (engine->cx (), JS_GetFunctionObject (runtime_vcpu_time_get ));
471- RootedValue runtime_vcpu_time_get_val (engine->cx (), ObjectValue (*runtime_vcpu_time_get_obj ));
472- if (!JS_SetProperty (engine->cx (), runtime_builtin , " vCpuTime" , runtime_vcpu_time_get_val )) {
468+ auto compute_vcpu_time_get =
469+ JS_NewFunction (engine->cx (), &compute_get_vcpu_time , 0 , 0 , " vCpuTime" );
470+ RootedObject compute_vcpu_time_get_obj (engine->cx (), JS_GetFunctionObject (compute_vcpu_time_get ));
471+ RootedValue compute_vcpu_time_get_val (engine->cx (), ObjectValue (*compute_vcpu_time_get_obj ));
472+ if (!JS_SetProperty (engine->cx (), compute_builtin , " vCpuTime" , compute_vcpu_time_get_val )) {
473473 return false ;
474474 }
475- if (!JS_SetProperty (engine->cx (), fastly, " vCpuTime" , runtime_vcpu_time_get_val )) {
475+ if (!JS_SetProperty (engine->cx (), fastly, " vCpuTime" , compute_vcpu_time_get_val )) {
476476 return false ;
477477 }
478- RootedValue runtime_builtin_val (engine->cx (), JS::ObjectValue (*runtime_builtin ));
479- if (!engine->define_builtin_module (" fastly:runtime " , runtime_builtin_val )) {
478+ RootedValue compute_builtin_val (engine->cx (), JS::ObjectValue (*compute_builtin ));
479+ if (!engine->define_builtin_module (" fastly:compute " , compute_builtin_val )) {
480480 return false ;
481481 }
482482
0 commit comments