kobako 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +377 -0
- data/Cargo.lock +181 -154
- data/README.md +99 -459
- data/ROADMAP.md +7 -1
- data/SECURITY.md +1 -1
- data/crates/kobako-runtime/CHANGELOG.md +354 -0
- data/crates/kobako-runtime/Cargo.toml +38 -7
- data/crates/kobako-runtime/README.md +17 -8
- data/crates/kobako-runtime/src/dispatch.rs +9 -1
- data/crates/kobako-runtime/src/endpoint/buffer.rs +192 -0
- data/crates/kobako-runtime/src/endpoint/capture.rs +115 -0
- data/crates/kobako-runtime/src/endpoint/dispatch.rs +253 -0
- data/crates/kobako-runtime/src/endpoint/invoke.rs +194 -0
- data/crates/kobako-runtime/src/endpoint/memory_cap.rs +238 -0
- data/crates/kobako-runtime/src/endpoint.rs +166 -0
- data/crates/kobako-runtime/src/filesystem/bind/fid.rs +82 -0
- data/crates/kobako-runtime/src/filesystem/bind/lookup.rs +236 -0
- data/crates/kobako-runtime/src/filesystem/bind/walk.rs +249 -0
- data/crates/kobako-runtime/src/filesystem/bind.rs +2665 -0
- data/crates/kobako-runtime/src/filesystem/overlay/file.rs +89 -0
- data/crates/kobako-runtime/src/filesystem/overlay/inode.rs +106 -0
- data/crates/kobako-runtime/src/filesystem/overlay/path.rs +285 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +135 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/dir.rs +263 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/namei.rs +135 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack/readdir.rs +57 -0
- data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +301 -0
- data/crates/kobako-runtime/src/filesystem/overlay.rs +3469 -0
- data/crates/kobako-runtime/src/filesystem/path.rs +21 -0
- data/crates/kobako-runtime/src/filesystem/pipe.rs +221 -0
- data/crates/kobako-runtime/src/filesystem/rdir.rs +101 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/tmpfile.rs +32 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/whiteout.rs +85 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/xattr.rs +22 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs.rs +1985 -0
- data/crates/kobako-runtime/src/filesystem/wrap.rs +224 -0
- data/crates/kobako-runtime/src/filesystem.rs +26 -0
- data/crates/kobako-runtime/src/grant.rs +20 -0
- data/crates/kobako-runtime/src/hashtable.rs +44 -0
- data/crates/kobako-runtime/src/lib.rs +16 -1
- data/crates/kobako-runtime/src/locking/seqlock.rs +66 -0
- data/crates/kobako-runtime/src/locking.rs +218 -0
- data/crates/kobako-runtime/src/mount.rs +105 -0
- data/crates/kobako-runtime/src/profile.rs +140 -4
- data/crates/kobako-runtime/src/runtime.rs +12 -0
- data/crates/kobako-runtime/src/sched.rs +210 -0
- data/crates/kobako-runtime/src/security.rs +696 -0
- data/crates/kobako-runtime/src/snapshot.rs +20 -5
- data/crates/kobako-runtime/src/vfs/attr.rs +162 -0
- data/crates/kobako-runtime/src/vfs/cred.rs +334 -0
- data/crates/kobako-runtime/src/vfs/dentry.rs +1412 -0
- data/crates/kobako-runtime/src/vfs/errno.rs +153 -0
- data/crates/kobako-runtime/src/vfs/file.rs +1915 -0
- data/crates/kobako-runtime/src/vfs/inode.rs +429 -0
- data/crates/kobako-runtime/src/vfs/kern_path.rs +217 -0
- data/crates/kobako-runtime/src/vfs/mount.rs +59 -0
- data/crates/kobako-runtime/src/vfs/namei.rs +5708 -0
- data/crates/kobako-runtime/src/vfs/openat2.rs +116 -0
- data/crates/kobako-runtime/src/vfs/path.rs +64 -0
- data/crates/kobako-runtime/src/vfs/readdir.rs +163 -0
- data/crates/kobako-runtime/src/vfs/stat.rs +157 -0
- data/crates/kobako-runtime/src/vfs/super_block.rs +122 -0
- data/crates/kobako-runtime/src/vfs/utimes.rs +289 -0
- data/crates/kobako-runtime/src/vfs.rs +60 -0
- data/crates/kobako-runtime/src/yielder.rs +11 -6
- data/crates/kobako-runtime/tests/linux_baseline/calls.rs +171 -0
- data/crates/kobako-runtime/tests/linux_baseline/concurrent.rs +276 -0
- data/crates/kobako-runtime/tests/linux_baseline/kobako.rs +323 -0
- data/crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt +16 -0
- data/crates/kobako-runtime/tests/linux_baseline/linux.rs +449 -0
- data/crates/kobako-runtime/tests/linux_baseline/main.rs +611 -0
- data/crates/kobako-runtime/tests/linux_baseline/permissions.rs +236 -0
- data/crates/kobako-transport/CHANGELOG.md +23 -0
- data/crates/kobako-transport/Cargo.toml +3 -3
- data/crates/kobako-transport/README.md +6 -5
- data/crates/kobako-transport/src/abi.rs +1 -1
- data/crates/kobako-transport/src/envelope/bytes.rs +33 -25
- data/crates/kobako-transport/src/envelope/call.rs +5 -5
- data/crates/kobako-transport/src/envelope/compile_reply.rs +2 -2
- data/crates/kobako-transport/src/envelope/error_record.rs +3 -3
- data/crates/kobako-transport/src/envelope/fault.rs +4 -3
- data/crates/kobako-transport/src/envelope/outcome.rs +3 -3
- data/crates/kobako-transport/src/envelope/preamble.rs +24 -24
- data/crates/kobako-transport/src/envelope/reply.rs +34 -16
- data/crates/kobako-transport/src/envelope/request.rs +19 -9
- data/crates/kobako-transport/src/envelope/run.rs +1 -1
- data/crates/kobako-transport/src/envelope/unsupported.rs +2 -2
- data/crates/kobako-transport/src/envelope.rs +2 -2
- data/crates/kobako-wasmtime/CHANGELOG.md +265 -0
- data/crates/kobako-wasmtime/Cargo.toml +25 -19
- data/crates/kobako-wasmtime/README.md +13 -7
- data/crates/kobako-wasmtime/src/abi.rs +75 -49
- data/crates/kobako-wasmtime/src/ambient.rs +64 -6
- data/crates/kobako-wasmtime/src/cache.rs +188 -77
- data/crates/kobako-wasmtime/src/config.rs +77 -5
- data/crates/kobako-wasmtime/src/descriptors.rs +200 -0
- data/crates/kobako-wasmtime/src/driver.rs +70 -135
- data/crates/kobako-wasmtime/src/exports.rs +5 -16
- data/crates/kobako-wasmtime/src/guest.rs +38 -0
- data/crates/kobako-wasmtime/src/imports.rs +52 -0
- data/crates/kobako-wasmtime/src/instance_pre.rs +18 -46
- data/crates/kobako-wasmtime/src/invocation.rs +43 -74
- data/crates/kobako-wasmtime/src/lib.rs +5 -4
- data/crates/kobako-wasmtime/src/limiter.rs +6 -230
- data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +632 -0
- data/crates/kobako-wasmtime/src/preview1/differential.rs +486 -0
- data/crates/kobako-wasmtime/src/preview1/errno.rs +135 -0
- data/crates/kobako-wasmtime/src/preview1/fd.rs +1420 -0
- data/crates/kobako-wasmtime/src/preview1/memory.rs +172 -0
- data/crates/kobako-wasmtime/src/preview1/mount_view/wrap.rs +211 -0
- data/crates/kobako-wasmtime/src/preview1/mount_view.rs +3766 -0
- data/crates/kobako-wasmtime/src/preview1/path.rs +302 -0
- data/crates/kobako-wasmtime/src/preview1/poll.rs +381 -0
- data/crates/kobako-wasmtime/src/preview1/sock.rs +13 -0
- data/crates/kobako-wasmtime/src/preview1/testsuite-expected.txt +6 -0
- data/crates/kobako-wasmtime/src/preview1/testsuite.rs +157 -0
- data/crates/kobako-wasmtime/src/preview1.rs +512 -0
- data/crates/kobako-wasmtime/src/trap.rs +45 -25
- data/crates/kobako-wasmtime/src/wasi.rs +333 -0
- data/crates/kobako-wasmtime/tests/integration/compile_posture.rs +43 -0
- data/crates/kobako-wasmtime/tests/integration/guest_file.rs +1085 -0
- data/crates/kobako-wasmtime/tests/integration/main.rs +29 -0
- data/crates/kobako-wasmtime/tests/{preamble_flags.rs → integration/preamble_flags.rs} +4 -3
- data/crates/kobako-wasmtime/tests/{snippet_compile.rs → integration/snippet_compile.rs} +5 -4
- data/crates/kobako-wasmtime/tests/{support → integration/support}/mod.rs +9 -13
- data/crates/kobako-wasmtime/tests/integration/unanswered_call.rs +86 -0
- data/crates/kobako-wasmtime/tests/{unsupported_call.rs → integration/unsupported_call.rs} +2 -1
- data/crates/kobako-wasmtime/witx/typenames.witx +750 -0
- data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +441 -0
- data/data/kobako.wasm +0 -0
- data/ext/kobako/Cargo.toml +4 -2
- data/ext/kobako/src/runtime/bridge.rs +154 -81
- data/ext/kobako/src/runtime/errors.rs +1 -1
- data/ext/kobako/src/runtime/escape.rs +67 -0
- data/ext/kobako/src/runtime/filesystem/grants.rs +107 -0
- data/ext/kobako/src/runtime/filesystem/ruby.rs +708 -0
- data/ext/kobako/src/runtime/filesystem.rs +208 -0
- data/ext/kobako/src/runtime/gvl.rs +49 -8
- data/ext/kobako/src/runtime/pinned_value.rs +31 -0
- data/ext/kobako/src/runtime/snapshot.rs +127 -0
- data/ext/kobako/src/runtime.rs +125 -199
- data/lib/kobako/catalog/extensions.rb +5 -5
- data/lib/kobako/catalog/flags.rb +2 -14
- data/lib/kobako/catalog/grants.rb +30 -0
- data/lib/kobako/catalog/handles.rb +6 -6
- data/lib/kobako/catalog/mount.rb +19 -0
- data/lib/kobako/catalog/services.rb +13 -2
- data/lib/kobako/catalog/snippets.rb +11 -15
- data/lib/kobako/catalog.rb +11 -0
- data/lib/kobako/codec/decoder.rb +10 -9
- data/lib/kobako/codec/ext_types.rb +4 -6
- data/lib/kobako/codec/handle_walk.rb +4 -6
- data/lib/kobako/codec/nesting.rb +7 -7
- data/lib/kobako/codec/state.rb +19 -3
- data/lib/kobako/codec/utils.rb +1 -1
- data/lib/kobako/codec/value_budget.rb +86 -0
- data/lib/kobako/codec.rb +7 -0
- data/lib/kobako/context.rb +40 -13
- data/lib/kobako/errors.rb +15 -14
- data/lib/kobako/filesystem.rb +69 -0
- data/lib/kobako/payload/arguments.rb +2 -2
- data/lib/kobako/pool.rb +6 -6
- data/lib/kobako/sandbox.rb +55 -27
- data/lib/kobako/sandbox_options.rb +39 -13
- data/lib/kobako/snippet/{binary.rb → bytecode.rb} +2 -2
- data/lib/kobako/snippet/source.rb +1 -1
- data/lib/kobako/snippet.rb +1 -1
- data/lib/kobako/transport/block_failure.rb +35 -0
- data/lib/kobako/transport/dispatcher.rb +33 -29
- data/lib/kobako/transport/exposure.rb +7 -9
- data/lib/kobako/transport/reflection.rb +79 -23
- data/lib/kobako/transport/run.rb +5 -5
- data/lib/kobako/transport/yielder.rb +9 -31
- data/lib/kobako/transport.rb +1 -0
- data/lib/kobako/version.rb +1 -1
- data/lib/kobako.rb +35 -0
- data/release-please-config.json +1 -0
- data/sig/kobako/catalog/extensions.rbs +3 -3
- data/sig/kobako/catalog/flags.rbs +0 -4
- data/sig/kobako/catalog/grants.rbs +13 -0
- data/sig/kobako/catalog/handles.rbs +3 -3
- data/sig/kobako/catalog/mount.rbs +24 -0
- data/sig/kobako/catalog/services.rbs +5 -1
- data/sig/kobako/catalog/snippets.rbs +4 -4
- data/sig/kobako/catalog.rbs +1 -0
- data/sig/kobako/codec/decoder.rbs +1 -1
- data/sig/kobako/codec/handle_walk.rbs +1 -1
- data/sig/kobako/codec/nesting.rbs +2 -2
- data/sig/kobako/codec/state.rbs +7 -1
- data/sig/kobako/codec/utils.rbs +1 -1
- data/sig/kobako/codec/value_budget.rbs +23 -0
- data/sig/kobako/codec.rbs +3 -2
- data/sig/kobako/context.rbs +14 -6
- data/sig/kobako/errors.rbs +4 -4
- data/sig/kobako/filesystem.rbs +93 -0
- data/sig/kobako/guest_yielder.rbs +9 -0
- data/sig/kobako/payload/arguments.rbs +1 -1
- data/sig/kobako/pool.rbs +3 -3
- data/sig/kobako/runtime.rbs +21 -49
- data/sig/kobako/sandbox.rbs +9 -5
- data/sig/kobako/sandbox_options.rbs +25 -3
- data/sig/kobako/snapshot.rbs +20 -0
- data/sig/kobako/snippet/bytecode.rbs +12 -0
- data/sig/kobako/transport/block_failure.rbs +13 -0
- data/sig/kobako/transport/dispatcher.rbs +4 -4
- data/sig/kobako/transport/exposure.rbs +2 -2
- data/sig/kobako/transport/reflection.rbs +14 -1
- data/sig/kobako/transport/run.rbs +3 -3
- data/sig/kobako/transport/yielder.rbs +3 -7
- data/sig/kobako/transport.rbs +3 -3
- metadata +116 -15
- data/crates/kobako-wasmtime/src/capture.rs +0 -96
- data/crates/kobako-wasmtime/src/dispatch.rs +0 -107
- data/crates/kobako-wasmtime/src/guest_mem.rs +0 -265
- data/crates/kobako-wasmtime/src/io.rs +0 -286
- data/sig/kobako/snippet/binary.rbs +0 -12
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
module Filesystem
|
|
3
|
+
type mountable = Tmpfs | Bind | Overlay | _Readable
|
|
4
|
+
|
|
5
|
+
type access = :read | :read_write
|
|
6
|
+
|
|
7
|
+
# What a Filesystem written in Ruby answers to be mounted. One that
|
|
8
|
+
# also answers _Listable lists its directories, and one answering
|
|
9
|
+
# _Writable takes changes too; each method it lacks is refused alone.
|
|
10
|
+
interface _Readable
|
|
11
|
+
def open: (String path, Integer flags) -> _File
|
|
12
|
+
def stat: (String path) -> _Stat
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
interface _Listable
|
|
16
|
+
def children: (String path) -> Array[String]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
interface _Writable
|
|
20
|
+
def mkdir: (String path) -> void
|
|
21
|
+
def rmdir: (String path) -> void
|
|
22
|
+
def unlink: (String path) -> void
|
|
23
|
+
def rename: (String from, String to) -> void
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# A file a Filesystem written in Ruby opened; +::File+ answers it. One
|
|
27
|
+
# that also answers _WritableFile takes writes too, one answering
|
|
28
|
+
# _AppendableFile takes appends, and any file may answer _SyncableFile
|
|
29
|
+
# to flush, _ClosableFile to close, or _StatableFile to report its times
|
|
30
|
+
# and count of names.
|
|
31
|
+
interface _File
|
|
32
|
+
def pread: (Integer length, Integer offset) -> String?
|
|
33
|
+
def size: () -> Integer
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
interface _WritableFile
|
|
37
|
+
def pwrite: (String data, Integer offset) -> Integer
|
|
38
|
+
def truncate: (Integer length) -> void
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Writes all of +data+ at the end in one step, answering where the file
|
|
42
|
+
# then ends.
|
|
43
|
+
interface _AppendableFile
|
|
44
|
+
def append: (String data) -> Integer
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
interface _SyncableFile
|
|
48
|
+
def fsync: () -> void
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
interface _ClosableFile
|
|
52
|
+
def close: () -> void
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
interface _StatableFile
|
|
56
|
+
def stat: () -> _Stat
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# What a Filesystem written in Ruby's +stat+ answers, as +File::Stat+
|
|
60
|
+
# does; an +ino+ of zero names no identity. One that also answers
|
|
61
|
+
# _StatDevice names the device its +ino+ belongs to, and _StatKind says
|
|
62
|
+
# a special file is one.
|
|
63
|
+
interface _Stat
|
|
64
|
+
def directory?: () -> boolish
|
|
65
|
+
def size: () -> Integer
|
|
66
|
+
def ino: () -> Integer
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
interface _StatDevice
|
|
70
|
+
def dev: () -> Integer
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
interface _StatKind
|
|
74
|
+
def ftype: () -> String
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
class Tmpfs
|
|
78
|
+
# A bare <tt>"path" => contents</tt> arrives as keywords, which RBS
|
|
79
|
+
# cannot key by String; a Symbol keyword past +size+ and +nr_inodes+
|
|
80
|
+
# raises ArgumentError.
|
|
81
|
+
def initialize: (?Hash[String, String] files, ?size: Integer?, ?nr_inodes: Integer?, **String) -> void
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
class Bind
|
|
85
|
+
def initialize: (String path) -> void
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
class Overlay
|
|
89
|
+
def initialize: (lower: Array[mountable], ?upper: Tmpfs?) -> void
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
# Frame-scoped guest re-entry handle the ext hands the dispatch Proc as
|
|
3
|
+
# its last argument — the production conformer of
|
|
4
|
+
# +Kobako::Transport::_GuestYielder+, answering the Yield Reply already
|
|
5
|
+
# split off the Envelope.
|
|
6
|
+
class GuestYielder
|
|
7
|
+
def call: (String args_bytes) -> [Symbol, String, String?]
|
|
8
|
+
end
|
|
9
|
+
end
|
data/sig/kobako/pool.rbs
CHANGED
|
@@ -25,17 +25,17 @@ module Kobako
|
|
|
25
25
|
|
|
26
26
|
def claim_or_wait: (Float? deadline) -> [Symbol, Kobako::Sandbox?]
|
|
27
27
|
|
|
28
|
-
def await_slot
|
|
28
|
+
def await_slot: (Float? deadline) -> void
|
|
29
29
|
|
|
30
30
|
def construct_slot: () -> Kobako::Sandbox
|
|
31
31
|
|
|
32
32
|
def checkin: (Kobako::Sandbox sandbox) -> void
|
|
33
33
|
|
|
34
|
-
def release_capacity
|
|
34
|
+
def release_capacity: () -> void
|
|
35
35
|
|
|
36
36
|
def monotonic_now: () -> Float
|
|
37
37
|
|
|
38
|
-
def validate_slots
|
|
38
|
+
def validate_slots: (untyped slots) -> void
|
|
39
39
|
|
|
40
40
|
def normalize_checkout_timeout: ((Float | Integer)? checkout_timeout) -> Float?
|
|
41
41
|
end
|
data/sig/kobako/runtime.rbs
CHANGED
|
@@ -2,66 +2,38 @@ module Kobako
|
|
|
2
2
|
class Runtime
|
|
3
3
|
def self.default_path: () -> String
|
|
4
4
|
|
|
5
|
+
def self.validate_mount: (untyped at, untyped access, untyped filesystem) -> nil
|
|
6
|
+
|
|
5
7
|
def self.from_path: (
|
|
6
8
|
String path,
|
|
7
|
-
(Float | Integer)
|
|
8
|
-
Integer
|
|
9
|
-
Integer
|
|
10
|
-
Integer
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
timeout: (Float | Integer)?,
|
|
10
|
+
setup_timeout: (Float | Integer)?,
|
|
11
|
+
memory_limit: Integer?,
|
|
12
|
+
stdout_limit: Integer?,
|
|
13
|
+
stderr_limit: Integer?,
|
|
14
|
+
open_file_limit: Integer?,
|
|
15
|
+
profile: Symbol,
|
|
16
|
+
gvl: Symbol
|
|
13
17
|
) -> Runtime
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Array[
|
|
18
|
-
Array[Kobako::Catalog::
|
|
19
|
-
Array[Kobako::Catalog::
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
type setup = [
|
|
20
|
+
Array[String],
|
|
21
|
+
Array[Kobako::Catalog::Snippets::tuple],
|
|
22
|
+
Array[Kobako::Catalog::Flags::tuple],
|
|
23
|
+
Array[Kobako::Catalog::Mount::tuple]
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
def eval: (Kobako::Transport::dispatch_proc dispatch, setup setup, String source) -> Kobako::Snapshot
|
|
22
27
|
|
|
23
28
|
def run: (
|
|
24
29
|
Kobako::Transport::dispatch_proc dispatch,
|
|
25
|
-
|
|
26
|
-
Array[Kobako::Catalog::Snippets::tuple] snippets,
|
|
27
|
-
Array[Kobako::Catalog::Flags::tuple] flags,
|
|
30
|
+
setup setup,
|
|
28
31
|
String entrypoint,
|
|
29
32
|
String payload
|
|
30
|
-
) -> Kobako::
|
|
33
|
+
) -> Kobako::Snapshot
|
|
31
34
|
|
|
32
35
|
def profile: () -> Symbol
|
|
33
36
|
|
|
34
|
-
def compile: (
|
|
35
|
-
Array[String] paths,
|
|
36
|
-
Array[Kobako::Catalog::Snippets::tuple] snippets,
|
|
37
|
-
Array[Kobako::Catalog::Flags::tuple] flags
|
|
38
|
-
) -> Array[String]?
|
|
39
|
-
|
|
40
|
-
# Frame-scoped guest re-entry handle the ext hands the dispatch Proc as
|
|
41
|
-
# its last argument — the production conformer of
|
|
42
|
-
# +Kobako::Transport::_GuestYielder+, answering the Yield Reply already
|
|
43
|
-
# split off the core envelope.
|
|
44
|
-
class GuestYielder
|
|
45
|
-
def call: (String args_bytes) -> [Symbol, String, String?]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# One invocation's result — the whole Snapshot the driver produced.
|
|
49
|
-
class Snapshot
|
|
50
|
-
def outcome: () -> [String, Kobako::Outcome::panic_fields?]
|
|
51
|
-
|
|
52
|
-
def trap_error: () -> Kobako::TrapError?
|
|
53
|
-
|
|
54
|
-
def wall_time: () -> Float
|
|
55
|
-
|
|
56
|
-
def memory_peak: () -> Integer
|
|
57
|
-
|
|
58
|
-
def stdout: () -> String
|
|
59
|
-
|
|
60
|
-
def stdout_truncated?: () -> bool
|
|
61
|
-
|
|
62
|
-
def stderr: () -> String
|
|
63
|
-
|
|
64
|
-
def stderr_truncated?: () -> bool
|
|
65
|
-
end
|
|
37
|
+
def compile: (Kobako::Context::preamble preamble) -> Array[String]?
|
|
66
38
|
end
|
|
67
39
|
end
|
data/sig/kobako/sandbox.rbs
CHANGED
|
@@ -7,14 +7,16 @@ module Kobako
|
|
|
7
7
|
|
|
8
8
|
# Forwarded to @options via Forwardable#def_delegators.
|
|
9
9
|
def timeout: () -> Float?
|
|
10
|
+
def setup_timeout: () -> Float?
|
|
10
11
|
def memory_limit: () -> Integer?
|
|
11
12
|
def stdout_limit: () -> Integer?
|
|
12
13
|
def stderr_limit: () -> Integer?
|
|
14
|
+
def open_file_limit: () -> Integer?
|
|
13
15
|
def profile: () -> Symbol
|
|
14
16
|
def gvl: () -> Symbol
|
|
15
17
|
|
|
16
18
|
# Every keyword beyond wasm_path forwards verbatim to
|
|
17
|
-
# SandboxOptions.new (the
|
|
19
|
+
# SandboxOptions.new (the caps + the profile floor).
|
|
18
20
|
def initialize: (
|
|
19
21
|
?wasm_path: String?,
|
|
20
22
|
**untyped options
|
|
@@ -24,6 +26,8 @@ module Kobako
|
|
|
24
26
|
|
|
25
27
|
def install: (*untyped extensions) -> Kobako::Sandbox
|
|
26
28
|
|
|
29
|
+
def mount: (String at, Kobako::Filesystem::mountable filesystem, ?access: Kobako::Filesystem::access) ?{ (String path, Kobako::Filesystem::access access) -> boolish } -> Kobako::Sandbox
|
|
30
|
+
|
|
27
31
|
def preload: (code: String, name: Symbol | String) -> Kobako::Sandbox
|
|
28
32
|
| (binary: String) -> Kobako::Sandbox
|
|
29
33
|
|
|
@@ -35,12 +39,12 @@ module Kobako
|
|
|
35
39
|
|
|
36
40
|
private
|
|
37
41
|
|
|
38
|
-
def build_runtime
|
|
42
|
+
def build_runtime: () -> Kobako::Runtime
|
|
39
43
|
|
|
40
|
-
def
|
|
44
|
+
def preamble: (Array[Kobako::Catalog::Snippets::tuple] snippets) -> Kobako::Context::preamble
|
|
41
45
|
|
|
42
|
-
def refuse_once_invoked
|
|
46
|
+
def refuse_once_invoked: (String verb) -> void
|
|
43
47
|
|
|
44
|
-
def begin_invocation
|
|
48
|
+
def begin_invocation: () -> Kobako::Context
|
|
45
49
|
end
|
|
46
50
|
end
|
|
@@ -1,45 +1,67 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
class SandboxOptions < Data
|
|
3
3
|
DEFAULT_TIMEOUT_SECONDS: Float
|
|
4
|
+
DEFAULT_SETUP_TIMEOUT_SECONDS: Float
|
|
4
5
|
DEFAULT_MEMORY_LIMIT: Integer
|
|
5
6
|
DEFAULT_OUTPUT_LIMIT: Integer
|
|
7
|
+
DEFAULT_OPEN_FILE_LIMIT: Integer
|
|
6
8
|
DEFAULT_PROFILE: Symbol
|
|
7
9
|
PROFILES: Array[Symbol]
|
|
8
10
|
GVL_MODES: Array[Symbol]
|
|
9
11
|
DEFAULT_GVL: Symbol
|
|
12
|
+
VALUE_BYTES: Integer
|
|
10
13
|
|
|
11
14
|
attr_reader timeout: Float?
|
|
15
|
+
attr_reader setup_timeout: Float?
|
|
12
16
|
attr_reader memory_limit: Integer?
|
|
13
17
|
attr_reader stdout_limit: Integer?
|
|
14
18
|
attr_reader stderr_limit: Integer?
|
|
19
|
+
attr_reader open_file_limit: Integer?
|
|
15
20
|
attr_reader profile: Symbol
|
|
16
21
|
attr_reader gvl: Symbol
|
|
17
22
|
|
|
18
23
|
def self.new: (
|
|
19
24
|
?timeout: (Float | Integer)?,
|
|
25
|
+
?setup_timeout: (Float | Integer)?,
|
|
20
26
|
?memory_limit: Integer?,
|
|
21
27
|
?stdout_limit: Integer?,
|
|
22
28
|
?stderr_limit: Integer?,
|
|
29
|
+
?open_file_limit: Integer?,
|
|
23
30
|
?profile: Symbol,
|
|
24
31
|
?gvl: Symbol
|
|
25
32
|
) -> SandboxOptions
|
|
26
33
|
|
|
27
34
|
def initialize: (
|
|
28
35
|
?timeout: (Float | Integer)?,
|
|
36
|
+
?setup_timeout: (Float | Integer)?,
|
|
29
37
|
?memory_limit: Integer?,
|
|
30
38
|
?stdout_limit: Integer?,
|
|
31
39
|
?stderr_limit: Integer?,
|
|
40
|
+
?open_file_limit: Integer?,
|
|
32
41
|
?profile: Symbol,
|
|
33
42
|
?gvl: Symbol
|
|
34
43
|
) -> void
|
|
35
44
|
|
|
36
|
-
def
|
|
45
|
+
def to_h: () -> {
|
|
46
|
+
timeout: Float?,
|
|
47
|
+
setup_timeout: Float?,
|
|
48
|
+
memory_limit: Integer?,
|
|
49
|
+
stdout_limit: Integer?,
|
|
50
|
+
stderr_limit: Integer?,
|
|
51
|
+
open_file_limit: Integer?,
|
|
52
|
+
profile: Symbol,
|
|
53
|
+
gvl: Symbol
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def value_budget: () -> Integer?
|
|
57
|
+
|
|
58
|
+
def enforce_floor: (Symbol declared) -> void
|
|
37
59
|
|
|
38
60
|
private
|
|
39
61
|
|
|
40
|
-
def normalize_timeout: ((Float | Integer)? timeout) -> Float?
|
|
62
|
+
def normalize_timeout: ((Float | Integer)? timeout, String name) -> Float?
|
|
41
63
|
|
|
42
|
-
def
|
|
64
|
+
def normalize_limit: (Integer? limit, String name) -> Integer?
|
|
43
65
|
|
|
44
66
|
def normalize_choice: (untyped value, Array[Symbol] choices, String name) -> Symbol
|
|
45
67
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
# One invocation's result — the whole Snapshot the driver produced.
|
|
3
|
+
class Snapshot
|
|
4
|
+
def outcome: () -> [String, Kobako::Outcome::panic_fields?]
|
|
5
|
+
|
|
6
|
+
def trap_error: () -> Kobako::TrapError?
|
|
7
|
+
|
|
8
|
+
def wall_time: () -> Float
|
|
9
|
+
|
|
10
|
+
def memory_peak: () -> Integer
|
|
11
|
+
|
|
12
|
+
def stdout: () -> String
|
|
13
|
+
|
|
14
|
+
def stdout_truncated?: () -> bool
|
|
15
|
+
|
|
16
|
+
def stderr: () -> String
|
|
17
|
+
|
|
18
|
+
def stderr_truncated?: () -> bool
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -9,9 +9,9 @@ module Kobako
|
|
|
9
9
|
|
|
10
10
|
BREAK_THROW: Symbol
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
BARE_FAULTS: Hash[singleton(StandardError), String]
|
|
13
13
|
|
|
14
|
-
def self.dispatch: (Kobako::Transport::Call call, Kobako::Transport::_ServiceResolver resolver, Kobako::Transport::_HandleTable handles, Kobako::Transport::_GuestYielder guest_yielder) -> [
|
|
14
|
+
def self.dispatch: (Kobako::Transport::Call call, Kobako::Transport::_ServiceResolver resolver, Kobako::Transport::_HandleTable handles, Kobako::Transport::BlockFailure failure, Kobako::Transport::_GuestYielder guest_yielder) -> [Symbol, String, String?]
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
@@ -21,11 +21,11 @@ module Kobako
|
|
|
21
21
|
|
|
22
22
|
def self.resolve_call_args: (Kobako::Payload::Arguments arguments, Kobako::Codec::_HandleTable handles, bool carried_handle) -> [Array[untyped], Hash[Symbol, untyped]]
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.fault_of: (StandardError error, Kobako::Transport::BlockFailure failure) -> [String, String]
|
|
25
25
|
|
|
26
26
|
def self.invoke: (Kobako::Transport::Exposure exposure, String method, Array[untyped] args, Hash[Symbol, untyped] kwargs, Kobako::Transport::Yielder? yielder) -> untyped
|
|
27
27
|
|
|
28
|
-
def self.reject_unreachable
|
|
28
|
+
def self.reject_unreachable: (Kobako::Transport::Exposure exposure, Symbol name) -> void
|
|
29
29
|
|
|
30
30
|
def self.resolve_arg: (untyped value, Kobako::Codec::_HandleTable handles) -> untyped
|
|
31
31
|
|
|
@@ -31,13 +31,13 @@ module Kobako
|
|
|
31
31
|
|
|
32
32
|
def self.narrows_itself?: (untyped object, Module klass) -> bool
|
|
33
33
|
|
|
34
|
-
def self.
|
|
34
|
+
def self.resolve_default_names: (untyped object, Module klass, Hash[Module, Set[Symbol]] surfaces) -> Set[Symbol]
|
|
35
35
|
|
|
36
36
|
def self.class_names: (untyped object, Module klass) -> Set[Symbol]
|
|
37
37
|
|
|
38
38
|
def self.with_singleton: (untyped object, Set[Symbol] names) -> Set[Symbol]
|
|
39
39
|
|
|
40
|
-
def self.
|
|
40
|
+
def self.authored_names:(Module owner) -> Array[Symbol]
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Transport
|
|
3
3
|
module Reflection
|
|
4
|
-
META_OWNERS: Array[Module]
|
|
5
4
|
GADGET_OWNERS: Array[Module]
|
|
6
5
|
CALLABLE_ALLOW: Array[Symbol]
|
|
7
6
|
|
|
8
7
|
def self.refusal: (Kobako::Transport::Exposure exposure, Symbol name) -> String?
|
|
9
8
|
|
|
9
|
+
def self.authored?: (UnboundMethod method) -> bool
|
|
10
|
+
|
|
10
11
|
private
|
|
11
12
|
|
|
13
|
+
def self.ambient_copy?: (UnboundMethod method) -> bool
|
|
14
|
+
|
|
12
15
|
def self.ambient_refusal: (untyped target, Symbol name) -> String?
|
|
13
16
|
|
|
17
|
+
def self.public_method_refusal: (untyped target, Symbol name, Module klass) -> String?
|
|
18
|
+
|
|
19
|
+
def self.authored_for?: (untyped target, Symbol name, UnboundMethod method, Module klass) -> bool
|
|
20
|
+
|
|
21
|
+
def self.service_refusal: (Symbol name) -> String
|
|
22
|
+
|
|
23
|
+
def self.owner_refusal: (untyped target, Symbol name, Module owner) -> String?
|
|
24
|
+
|
|
25
|
+
def self.lookup_class: (untyped target) -> Module
|
|
26
|
+
|
|
14
27
|
def self.ambient_owner?: (Module owner, untyped target) -> bool
|
|
15
28
|
end
|
|
16
29
|
end
|
|
@@ -9,15 +9,15 @@ module Kobako
|
|
|
9
9
|
|
|
10
10
|
def initialize: (entrypoint: Symbol | String, ?args: Array[untyped], ?kwargs: Hash[untyped, untyped]) -> void
|
|
11
11
|
|
|
12
|
-
def
|
|
12
|
+
def encode_payload: (Kobako::Codec::_HandleTable handles) -> String
|
|
13
13
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
16
|
def normalize_entrypoint: (Symbol | String target) -> Symbol
|
|
17
17
|
|
|
18
|
-
def validate_args
|
|
18
|
+
def validate_args: (Array[untyped] args) -> void
|
|
19
19
|
|
|
20
|
-
def validate_kwargs
|
|
20
|
+
def validate_kwargs: (Hash[untyped, untyped] kwargs) -> void
|
|
21
21
|
|
|
22
22
|
def forged_handle_message: (String slot) -> String
|
|
23
23
|
end
|
|
@@ -4,25 +4,21 @@ module Kobako
|
|
|
4
4
|
@guest_yielder: Kobako::Transport::_GuestYielder
|
|
5
5
|
@break_tag: Symbol
|
|
6
6
|
@handles: Kobako::Codec::_HandleTable
|
|
7
|
+
@failure: Kobako::Transport::BlockFailure
|
|
7
8
|
@active: bool
|
|
8
|
-
@raised: Kobako::BlockError?
|
|
9
9
|
|
|
10
|
-
def initialize: (Kobako::Transport::_GuestYielder guest_yielder, Symbol break_tag, Kobako::Codec::_HandleTable handles) -> void
|
|
11
|
-
|
|
12
|
-
def fault_text: (Exception error) -> String?
|
|
10
|
+
def initialize: (Kobako::Transport::_GuestYielder guest_yielder, Symbol break_tag, Kobako::Codec::_HandleTable handles, Kobako::Transport::BlockFailure failure) -> void
|
|
13
11
|
|
|
14
12
|
def yield: (*untyped args) -> untyped
|
|
15
13
|
|
|
16
14
|
def to_proc: () -> Proc
|
|
17
15
|
|
|
18
|
-
def invalidate
|
|
16
|
+
def invalidate: () -> void
|
|
19
17
|
|
|
20
18
|
private
|
|
21
19
|
|
|
22
20
|
def encode_args: (Array[untyped] args) -> String
|
|
23
21
|
|
|
24
|
-
def remember: (Kobako::BlockError error) -> Kobako::BlockError
|
|
25
|
-
|
|
26
22
|
def decode_body: (String body) -> [untyped, bool]
|
|
27
23
|
|
|
28
24
|
def restore: (untyped value, bool carried_handle) -> untyped
|
data/sig/kobako/transport.rbs
CHANGED
|
@@ -3,7 +3,7 @@ module Kobako
|
|
|
3
3
|
# The guest re-entry callable a dispatch hands to a Yielder: invoked
|
|
4
4
|
# with the encoded yield args, it returns the decoded Yield Reply as an
|
|
5
5
|
# +[arm, body, klass]+ triple.
|
|
6
|
-
# The ext's Kobako::
|
|
6
|
+
# The ext's Kobako::GuestYielder is the production conformer;
|
|
7
7
|
# modelled structurally so the Transport layer needs no upward
|
|
8
8
|
# dependency on Runtime.
|
|
9
9
|
interface _GuestYielder
|
|
@@ -11,10 +11,10 @@ module Kobako
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# The per-invocation dispatch Proc, taking the routing fields the native
|
|
14
|
-
# side already decoded off the
|
|
14
|
+
# side already decoded off the Envelope and answering the arm and
|
|
15
15
|
# body it puts on the Reply. Named here so the producer (Context) and the
|
|
16
16
|
# consumer (Runtime) cannot declare it differently.
|
|
17
|
-
type dispatch_proc = ^(String | Integer, String, bool, String, _GuestYielder) -> [
|
|
17
|
+
type dispatch_proc = ^(String | Integer, String, bool, String, _GuestYielder) -> [Symbol, String, String?]
|
|
18
18
|
|
|
19
19
|
# What a dispatch resolves constant-path targets against. The
|
|
20
20
|
# invocation's Kobako::Context is the production conformer, so its
|