mirror of
https://github.com/fluencelabs/fluid
synced 2025-06-17 07:11:21 +00:00
rename lots of things
This commit is contained in:
22
backend-assemblyscript/step2-database-only/assembly/index.ts
Normal file
22
backend-assemblyscript/step2-database-only/assembly/index.ts
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
import {handler} from "./main";
|
||||
import {loggedStringHandler} from "../node_modules/assemblyscript-sdk/assembly/index";
|
||||
import {log} from "../node_modules/assemblyscript-sdk/assembly/logger";
|
||||
|
||||
// VM wrapper will put requests to memory through this function
|
||||
export function allocate(size: usize) :i32 {
|
||||
return __alloc(size, 0);
|
||||
}
|
||||
|
||||
// VM wrapper will deallocate response from memory after handling it
|
||||
export function deallocate(ptr: i32, size: usize): void {
|
||||
__free(ptr);
|
||||
}
|
||||
|
||||
// VM wrapper calls this function with a pointer on request in memory.
|
||||
// Returns pointer on a response.
|
||||
export function invoke(ptr: i32, size: i32): i32 {
|
||||
// this function will parse a request as a string and return result string as a pointer in memory
|
||||
// you can look on other functions in 'assemblyscript-sdk' library to username own types of requests and responses
|
||||
return loggedStringHandler(ptr, size, handler, log);
|
||||
}
|
Reference in New Issue
Block a user