Skip to content

Commit

Permalink
feat: add kv get ext, fix runtime termination
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Nov 7, 2024
1 parent 766744b commit d143f31
Show file tree
Hide file tree
Showing 31 changed files with 635 additions and 276 deletions.
53 changes: 28 additions & 25 deletions packages/infra/client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions packages/infra/client/isolate-v8-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ serde_json = "1.0.111"
signal-hook = "0.3.17"
tokio = { version = "1.36.0", features = [ "full" ] }
tokio-tungstenite = "0.23.1"
tracing = "0.1"
tracing-logfmt = "0.3"
tracing-subscriber = { version = "0.3", default-features = false, features = [
"ansi",
"fmt",
"json",
] }
twox-hash = "1.6.3"
uuid = { version = "1.6.1", features = ["v4"] }

runner-protocol = { path = "../runner-protocol", package = "pegboard-runner-protocol" }

[dependencies.deno_runtime]
# path = "../../../../../deno/runtime"
# path = "../../../../../../deno/runtime"
git = "https://github.com/rivet-gg/deno"
rev = "bd98563214c532c8dae97d918edb501fe1c72dbc"
rev = "1f423e6d87792cb761cf0167c7bad5b8553f32a1"
package = "deno_runtime"

[dev-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions packages/infra/client/isolate-v8-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ WORKDIR /app
COPY packages/infra/client/runner-protocol/ runner-protocol/
COPY packages/infra/client/isolate-v8-runner/Cargo.toml isolate-v8-runner/Cargo.toml
COPY packages/infra/client/isolate-v8-runner/src/ isolate-v8-runner/src/
COPY packages/infra/client/isolate-v8-runner/js/ isolate-v8-runner/js/

# Installs shared libs
RUN apt-get update && apt-get install -y libclang-dev
RUN curl -Lo /tmp/fdb-clients.deb https://github.com/apple/foundationdb/releases/download/7.3.55/foundationdb-clients_7.3.55-1_amd64.deb && dpkg -i /tmp/fdb-clients.deb

RUN \
--mount=type=cache,target=/root/.cargo/git \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
!packages/infra/client/runner-protocol
!packages/infra/client/isolate-v8-runner/Cargo.toml
!packages/infra/client/isolate-v8-runner/src
!packages/infra/client/isolate-v8-runner/js
11 changes: 11 additions & 0 deletions packages/infra/client/isolate-v8-runner/js/40_rivet_kv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { op_rivet_kv_get, op_rivet_kv_get_batch } from "ext:core/ops";

async function get(key, options) {
return (await op_rivet_kv_get(key, options)) ?? undefined;
}

async function getBatch(keys, options) {
return (await op_rivet_kv_get_batch(keys, options)) ?? undefined;
}

export { get, getBatch };
10 changes: 10 additions & 0 deletions packages/infra/client/isolate-v8-runner/js/90_rivet_ns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as kv from "ext:rivet_kv/40_rivet_kv.js";

const rivetNs = {
kv: {
get: kv.get,
getBatch: kv.getBatch,
},
};

export { rivetNs };
5 changes: 5 additions & 0 deletions packages/infra/client/isolate-v8-runner/js/99_rivet_main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { core, primordials } from "ext:core/mod.js";
import { rivetNs } from "ext:rivet_runtime/90_rivet_ns.js";
const { ObjectDefineProperty } = primordials;

ObjectDefineProperty(globalThis, "Rivet", core.propReadOnly(rivetNs));
Loading

0 comments on commit d143f31

Please sign in to comment.