Skip to content

Commit

Permalink
Add Azle implementation of collections
Browse files Browse the repository at this point in the history
  • Loading branch information
dansteren committed Oct 13, 2023
1 parent 08b9574 commit 788ff7e
Show file tree
Hide file tree
Showing 12 changed files with 1,275 additions and 2 deletions.
7 changes: 5 additions & 2 deletions collections/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include ../*.mk

.PHONY: all motoko rust build perf
.PHONY: all motoko rust azle build perf
all: build perf

motoko:
Expand All @@ -9,7 +9,10 @@ motoko:
rust:
$(call build,rust)

build: motoko rust
azle:
$(call build,azle)

build: motoko rust azle

perf:
$(call perf,collections,perf.sh)
7 changes: 7 additions & 0 deletions collections/azle/collection.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
service: () -> {
batch_get: (nat32) -> ();
batch_put: (nat32) -> ();
batch_remove: (nat32) -> ();
generate: (nat32) -> ();
get_mem: () -> (record {nat; nat; nat}) query;
}
36 changes: 36 additions & 0 deletions collections/azle/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"canisters": {
"hashmap": {
"type": "custom",
"main": "src/hashmap.ts",
"candid": "collection.did",
"build": "npx azle hashmap",
"wasm": ".azle/hashmap/hashmap.wasm",
"gzip": false
},
"btreemap": {
"type": "custom",
"main": "src/btreemap.ts",
"candid": "collection.did",
"build": "npx azle btreemap",
"wasm": ".azle/btreemap/btreemap.wasm",
"gzip": false
},
"heap": {
"type": "custom",
"main": "src/heap.ts",
"candid": "collection.did",
"build": "npx azle heap",
"wasm": ".azle/heap/heap.wasm",
"gzip": false
},
"vector": {
"type": "custom",
"main": "src/vector.ts",
"candid": "collection.did",
"build": "npx azle vector",
"wasm": ".azle/vector/vector.wasm",
"gzip": false
}
}
}
Loading

0 comments on commit 788ff7e

Please sign in to comment.