@wasm-oj/server 0.2.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.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/THIRD_PARTY_NOTICES.md +302 -0
- package/crates/runtime-core/Cargo.lock +5099 -0
- package/crates/runtime-core/Cargo.toml +66 -0
- package/crates/runtime-core/README.md +47 -0
- package/crates/runtime-core/src/bin/wasm-oj-compiler.rs +418 -0
- package/crates/runtime-core/src/bin/wasm-oj-runner.rs +294 -0
- package/crates/runtime-core/src/capabilities.rs +118 -0
- package/crates/runtime-core/src/compiler.rs +658 -0
- package/crates/runtime-core/src/contract.rs +5 -0
- package/crates/runtime-core/src/deterministic.rs +1051 -0
- package/crates/runtime-core/src/error.rs +58 -0
- package/crates/runtime-core/src/filesystem.rs +547 -0
- package/crates/runtime-core/src/filesystem_quota.rs +167 -0
- package/crates/runtime-core/src/go_compiler_session.rs +297 -0
- package/crates/runtime-core/src/interactive.rs +1019 -0
- package/crates/runtime-core/src/judge_package.rs +1539 -0
- package/crates/runtime-core/src/lib.rs +98 -0
- package/crates/runtime-core/src/memory.rs +84 -0
- package/crates/runtime-core/src/meter.rs +549 -0
- package/crates/runtime-core/src/module_imports.rs +149 -0
- package/crates/runtime-core/src/module_policy.rs +714 -0
- package/crates/runtime-core/src/output.rs +204 -0
- package/crates/runtime-core/src/run/mod.rs +208 -0
- package/crates/runtime-core/src/run/native.rs +260 -0
- package/crates/runtime-core/src/run/web.rs +229 -0
- package/crates/runtime-core/src/run/web_runtime.rs +109 -0
- package/crates/runtime-core/src/types.rs +268 -0
- package/crates/runtime-core/src/web.rs +83 -0
- package/dist/chunks/go-toolchain-Dbt-lp2L.js +426 -0
- package/dist/chunks/java-toolchain-DajoRCHu.js +44 -0
- package/dist/chunks/python-toolchain-Dx834o2A.js +4 -0
- package/dist/chunks/rust-toolchain-CJ3sMxPE.js +252 -0
- package/dist/chunks/toolchains-C6KuA1yM.js +224 -0
- package/dist/go-stage.mjs +193 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.js +4393 -0
- package/dist/java-stage.mjs +111 -0
- package/dist/python-stage.mjs +90 -0
- package/dist/rustc-stage.mjs +301 -0
- package/dist/server-build-stage.mjs +2564 -0
- package/dist/server-runner-stage.mjs +155 -0
- package/licenses/fflate-MIT.txt +21 -0
- package/licenses/runtime-core-dependencies.html +6253 -0
- package/licenses/runtime-core-dependencies.json +3041 -0
- package/licenses/wasmer-sdk-MIT.txt +21 -0
- package/licenses/wasmer-sdk-dependencies.html +6901 -0
- package/licenses/wasmer-sdk-dependencies.json +3013 -0
- package/package.json +70 -0
- package/rust-toolchain.toml +5 -0
- package/testdata/wojjdg02-v2-text.hex +1 -0
- package/vendor/shared-buffer/Cargo.toml +22 -0
- package/vendor/shared-buffer/LICENSE_APACHE.md +176 -0
- package/vendor/shared-buffer/LICENSE_MIT.md +25 -0
- package/vendor/shared-buffer/README.md +34 -0
- package/vendor/shared-buffer/src/lib.rs +58 -0
- package/vendor/shared-buffer/src/mmap.rs +250 -0
- package/vendor/shared-buffer/src/owned.rs +389 -0
- package/vendor/virtual-fs/Cargo.toml +181 -0
- package/vendor/virtual-fs/LICENSE +25 -0
- package/vendor/virtual-fs/src/arc_box_file.rs +142 -0
- package/vendor/virtual-fs/src/arc_file.rs +182 -0
- package/vendor/virtual-fs/src/arc_fs.rs +68 -0
- package/vendor/virtual-fs/src/buffer_file.rs +103 -0
- package/vendor/virtual-fs/src/builder.rs +232 -0
- package/vendor/virtual-fs/src/combine_file.rs +101 -0
- package/vendor/virtual-fs/src/cow_file.rs +345 -0
- package/vendor/virtual-fs/src/dual_write_file.rs +113 -0
- package/vendor/virtual-fs/src/empty_fs.rs +81 -0
- package/vendor/virtual-fs/src/filesystems.rs +108 -0
- package/vendor/virtual-fs/src/host_fs.rs +1390 -0
- package/vendor/virtual-fs/src/lib.rs +782 -0
- package/vendor/virtual-fs/src/limiter.rs +252 -0
- package/vendor/virtual-fs/src/mem_fs/file.rs +1799 -0
- package/vendor/virtual-fs/src/mem_fs/file_opener.rs +941 -0
- package/vendor/virtual-fs/src/mem_fs/filesystem.rs +2134 -0
- package/vendor/virtual-fs/src/mem_fs/mod.rs +245 -0
- package/vendor/virtual-fs/src/mem_fs/offloaded_file.rs +474 -0
- package/vendor/virtual-fs/src/mem_fs/stdio.rs +318 -0
- package/vendor/virtual-fs/src/mount_fs.rs +2225 -0
- package/vendor/virtual-fs/src/null_file.rs +87 -0
- package/vendor/virtual-fs/src/ops.rs +364 -0
- package/vendor/virtual-fs/src/overlay_fs.rs +2216 -0
- package/vendor/virtual-fs/src/passthru_fs.rs +119 -0
- package/vendor/virtual-fs/src/pipe.rs +603 -0
- package/vendor/virtual-fs/src/random_file.rs +88 -0
- package/vendor/virtual-fs/src/special_file.rs +108 -0
- package/vendor/virtual-fs/src/static_file.rs +133 -0
- package/vendor/virtual-fs/src/static_fs.rs +460 -0
- package/vendor/virtual-fs/src/tmp_fs.rs +95 -0
- package/vendor/virtual-fs/src/trace_fs.rs +258 -0
- package/vendor/virtual-fs/src/webc_volume_fs.rs +829 -0
- package/vendor/virtual-fs/src/zero_file.rs +90 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//! Used for /dev/zero - infinitely returns zero
|
|
2
|
+
//! which is useful for commands like `dd if=/dev/zero of=bigfile.img size=1G`
|
|
3
|
+
|
|
4
|
+
use std::{
|
|
5
|
+
io::{self, IoSlice, SeekFrom},
|
|
6
|
+
iter,
|
|
7
|
+
pin::Pin,
|
|
8
|
+
task::{Context, Poll},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite};
|
|
12
|
+
|
|
13
|
+
use crate::VirtualFile;
|
|
14
|
+
|
|
15
|
+
#[derive(Debug, Default)]
|
|
16
|
+
pub struct ZeroFile {}
|
|
17
|
+
|
|
18
|
+
impl AsyncSeek for ZeroFile {
|
|
19
|
+
fn start_seek(self: Pin<&mut Self>, _position: SeekFrom) -> io::Result<()> {
|
|
20
|
+
Ok(())
|
|
21
|
+
}
|
|
22
|
+
fn poll_complete(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<u64>> {
|
|
23
|
+
Poll::Ready(Ok(0))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl AsyncWrite for ZeroFile {
|
|
28
|
+
fn poll_write(
|
|
29
|
+
self: Pin<&mut Self>,
|
|
30
|
+
_cx: &mut Context<'_>,
|
|
31
|
+
buf: &[u8],
|
|
32
|
+
) -> Poll<io::Result<usize>> {
|
|
33
|
+
Poll::Ready(Ok(buf.len()))
|
|
34
|
+
}
|
|
35
|
+
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
|
36
|
+
Poll::Ready(Ok(()))
|
|
37
|
+
}
|
|
38
|
+
fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
|
39
|
+
Poll::Ready(Ok(()))
|
|
40
|
+
}
|
|
41
|
+
fn poll_write_vectored(
|
|
42
|
+
self: Pin<&mut Self>,
|
|
43
|
+
_cx: &mut Context<'_>,
|
|
44
|
+
bufs: &[IoSlice<'_>],
|
|
45
|
+
) -> Poll<io::Result<usize>> {
|
|
46
|
+
Poll::Ready(Ok(bufs.len()))
|
|
47
|
+
}
|
|
48
|
+
fn is_write_vectored(&self) -> bool {
|
|
49
|
+
false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl AsyncRead for ZeroFile {
|
|
54
|
+
fn poll_read(
|
|
55
|
+
self: Pin<&mut Self>,
|
|
56
|
+
_cx: &mut Context<'_>,
|
|
57
|
+
buf: &mut tokio::io::ReadBuf<'_>,
|
|
58
|
+
) -> Poll<io::Result<()>> {
|
|
59
|
+
let zeros: Vec<u8> = iter::repeat_n(0, buf.remaining()).collect();
|
|
60
|
+
buf.put_slice(&zeros[..]);
|
|
61
|
+
Poll::Ready(Ok(()))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
impl VirtualFile for ZeroFile {
|
|
66
|
+
fn last_accessed(&self) -> u64 {
|
|
67
|
+
0
|
|
68
|
+
}
|
|
69
|
+
fn last_modified(&self) -> u64 {
|
|
70
|
+
0
|
|
71
|
+
}
|
|
72
|
+
fn created_time(&self) -> u64 {
|
|
73
|
+
0
|
|
74
|
+
}
|
|
75
|
+
fn size(&self) -> u64 {
|
|
76
|
+
0
|
|
77
|
+
}
|
|
78
|
+
fn set_len(&mut self, _new_size: u64) -> crate::Result<()> {
|
|
79
|
+
Ok(())
|
|
80
|
+
}
|
|
81
|
+
fn unlink(&mut self) -> crate::Result<()> {
|
|
82
|
+
Ok(())
|
|
83
|
+
}
|
|
84
|
+
fn poll_read_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<usize>> {
|
|
85
|
+
Poll::Ready(Ok(0))
|
|
86
|
+
}
|
|
87
|
+
fn poll_write_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<io::Result<usize>> {
|
|
88
|
+
Poll::Ready(Ok(0))
|
|
89
|
+
}
|
|
90
|
+
}
|