mirror of
https://github.com/fluencelabs/redis
synced 2025-05-09 17:32:15 +00:00
improve build scripts
This commit is contained in:
parent
9dd65dedad
commit
55e1ec7de6
@ -4,9 +4,11 @@ RUN apt-get update \
|
||||
&& apt-get install -y ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
make
|
||||
make \
|
||||
cargo
|
||||
|
||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-10/wasi-sdk-10.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
||||
RUN cargo install fcli
|
||||
|
||||
VOLUME /code
|
||||
WORKDIR /code
|
||||
|
1
Makefile
1
Makefile
@ -7,6 +7,7 @@ default: all
|
||||
|
||||
wasm:
|
||||
cd src && $(MAKE) -f Makefile_wasm && mv redis.wasm ../
|
||||
~/.cargo/bin/fce embed -i redis.wasm -o redis.wasm -w redis.wit
|
||||
|
||||
install:
|
||||
cd src && $(MAKE) $@
|
||||
|
44
redis.wit
Normal file
44
redis.wit
Normal file
@ -0,0 +1,44 @@
|
||||
;; Fluence Redis fork Wasm Interface Types
|
||||
|
||||
;; allocate
|
||||
(@interface type (func (param i32) (result i32))) ;; 0
|
||||
|
||||
;; deallocate
|
||||
(@interface type (func (param i32 i32))) ;; 1
|
||||
|
||||
;; invoke
|
||||
(@interface type (func (param string) (result string))) ;; 2
|
||||
|
||||
;; get_result_ptr/get_result_size
|
||||
(@interface type (func (result i32))) ;; 3
|
||||
|
||||
;; set_result_ptr/set_result_size
|
||||
(@interface type (func (param i32))) ;; 4
|
||||
|
||||
|
||||
(@interface export "allocate" (func 0)) ;; 0
|
||||
(@interface export "deallocate" (func 1)) ;; 1
|
||||
(@interface export "invoke" (func 2)) ;; 2
|
||||
(@interface export "get_result_size" (func 3)) ;; 3
|
||||
(@interface export "get_result_ptr" (func 3)) ;; 4
|
||||
(@interface export "set_result_size" (func 4)) ;; 5
|
||||
(@interface export "set_result_ptr" (func 4)) ;; 6
|
||||
|
||||
;; adapter for export invoke function
|
||||
(@interface func (type 2)
|
||||
arg.get 0
|
||||
string.size
|
||||
call-core 0 ;; call allocate
|
||||
arg.get 0
|
||||
string.lower_memory
|
||||
call-core 2 ;; call invoke
|
||||
call-core 4 ;; call get_result_size
|
||||
call-core 3 ;; call get_result_ptr
|
||||
string.lift_memory
|
||||
call-core 4 ;; call get_result_size
|
||||
call-core 3 ;; call get_result_ptr
|
||||
call-core 1 ;; call deallocate
|
||||
)
|
||||
|
||||
;; Implementations
|
||||
(@interface implement (func 2) (func 2))
|
Loading…
x
Reference in New Issue
Block a user