Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
213885a9
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
213885a9
编写于
10月 17, 2018
作者:
R
Ryan Dahl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimization: Reuse ArrayBuffer during serialization.
上级
4e2e185d
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
115 addition
and
57 deletion
+115
-57
BUILD.gn
BUILD.gn
+1
-0
js/copy_file.ts
js/copy_file.ts
+2
-2
js/dir.ts
js/dir.ts
+3
-3
js/dispatch.ts
js/dispatch.ts
+4
-3
js/fetch.ts
js/fetch.ts
+2
-2
js/files.ts
js/files.ts
+5
-5
js/flatbuffers.ts
js/flatbuffers.ts
+55
-0
js/main.ts
js/main.ts
+2
-2
js/make_temp_dir.ts
js/make_temp_dir.ts
+2
-2
js/metrics.ts
js/metrics.ts
+2
-2
js/mkdir.ts
js/mkdir.ts
+2
-2
js/net.ts
js/net.ts
+5
-5
js/os.ts
js/os.ts
+6
-6
js/read_dir.ts
js/read_dir.ts
+2
-2
js/read_file.ts
js/read_file.ts
+2
-2
js/read_link.ts
js/read_link.ts
+2
-2
js/remove.ts
js/remove.ts
+2
-2
js/rename.ts
js/rename.ts
+2
-2
js/stat.ts
js/stat.ts
+2
-2
js/symlink.ts
js/symlink.ts
+2
-2
js/timers.ts
js/timers.ts
+2
-2
js/truncate.ts
js/truncate.ts
+2
-2
js/write_file.ts
js/write_file.ts
+2
-2
src/ops.rs
src/ops.rs
+2
-2
tools/http_server.py
tools/http_server.py
+2
-1
未找到文件。
BUILD.gn
浏览文件 @
213885a9
...
...
@@ -79,6 +79,7 @@ ts_sources = [
"js/fetch.ts",
"js/file_info.ts",
"js/files.ts",
"js/flatbuffers.ts",
"js/global_eval.ts",
"js/globals.ts",
"js/io.ts",
...
...
js/copy_file.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Copies the contents of a file to another by name synchronously.
...
...
@@ -36,7 +36,7 @@ function req(
from
:
string
,
to
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
from_
=
builder
.
createString
(
from
);
const
to_
=
builder
.
createString
(
to
);
msg
.
CopyFile
.
startCopyFile
(
builder
);
...
...
js/dir.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
assert
}
from
"
./util
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
sendSync
}
from
"
./dispatch
"
;
/**
...
...
@@ -12,7 +12,7 @@ import { sendSync } from "./dispatch";
* throws NotFound exception if directory not available
*/
export
function
cwd
():
string
{
const
builder
=
new
flatbuffers
.
Builder
(
0
);
const
builder
=
flatbuffers
.
createBuilder
(
);
msg
.
Cwd
.
startCwd
(
builder
);
const
inner
=
msg
.
Cwd
.
endCwd
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Cwd
,
inner
);
...
...
@@ -28,7 +28,7 @@ export function cwd(): string {
* throws NotFound exception if directory not available
*/
export
function
chdir
(
directory
:
string
):
void
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
directory_
=
builder
.
createString
(
directory
);
msg
.
Chdir
.
startChdir
(
builder
);
msg
.
Chdir
.
addDirectory
(
builder
,
directory_
);
...
...
js/dispatch.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
{
libdeno
}
from
"
./libdeno
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
msg
from
"
gen/msg_generated
"
;
import
*
as
errors
from
"
./errors
"
;
import
*
as
util
from
"
./util
"
;
...
...
@@ -86,6 +86,7 @@ function sendInternal(
msg
.
Base
.
addSync
(
builder
,
sync
);
msg
.
Base
.
addCmdId
(
builder
,
cmdId
);
builder
.
finish
(
msg
.
Base
.
endBase
(
builder
));
return
[
cmdId
,
libdeno
.
send
(
builder
.
asUint8Array
(),
data
)];
const
res
=
libdeno
.
send
(
builder
.
asUint8Array
(),
data
);
builder
.
inUse
=
false
;
return
[
cmdId
,
res
];
}
js/fetch.ts
浏览文件 @
213885a9
...
...
@@ -7,7 +7,7 @@ import {
typedArrayToArrayBuffer
,
notImplemented
}
from
"
./util
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
sendAsync
}
from
"
./dispatch
"
;
import
*
as
msg
from
"
gen/msg_generated
"
;
import
*
as
domTypes
from
"
./dom_types
"
;
...
...
@@ -187,7 +187,7 @@ export async function fetch(
log
(
"
dispatch FETCH_REQ
"
,
url
);
// Send FetchReq message
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
url_
=
builder
.
createString
(
url
);
msg
.
FetchReq
.
startFetchReq
(
builder
);
msg
.
FetchReq
.
addUrl
(
builder
,
url_
);
...
...
js/files.ts
浏览文件 @
213885a9
...
...
@@ -4,7 +4,7 @@ import { Reader, Writer, Closer, ReadResult } from "./io";
import
*
as
dispatch
from
"
./dispatch
"
;
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
assert
}
from
"
./util
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
/** The Deno abstraction for reading and writing files. */
export
class
File
implements
Reader
,
Writer
,
Closer
{
...
...
@@ -51,7 +51,7 @@ export async function open(
filename
:
string
,
mode
:
OpenMode
=
"
r
"
):
Promise
<
File
>
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
filename_
=
builder
.
createString
(
filename
);
msg
.
Open
.
startOpen
(
builder
);
msg
.
Open
.
addFilename
(
builder
,
filename_
);
...
...
@@ -73,7 +73,7 @@ export async function read(
rid
:
number
,
p
:
ArrayBufferView
):
Promise
<
ReadResult
>
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Read
.
startRead
(
builder
);
msg
.
Read
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Read
.
endRead
(
builder
);
...
...
@@ -90,7 +90,7 @@ export async function read(
* Resolves with the number of bytes written.
*/
export
async
function
write
(
rid
:
number
,
p
:
ArrayBufferView
):
Promise
<
number
>
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Write
.
startWrite
(
builder
);
msg
.
Write
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Write
.
endWrite
(
builder
);
...
...
@@ -104,7 +104,7 @@ export async function write(rid: number, p: ArrayBufferView): Promise<number> {
/** Close the file ID. */
export
function
close
(
rid
:
number
):
void
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Close
.
startClose
(
builder
);
msg
.
Close
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Close
.
endClose
(
builder
);
...
...
js/flatbuffers.ts
0 → 100644
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
util
from
"
./util
"
;
// Re-export some types.
export
type
Offset
=
flatbuffers
.
Offset
;
export
class
ByteBuffer
extends
flatbuffers
.
ByteBuffer
{}
export
interface
Builder
extends
flatbuffers
.
Builder
{
inUse
:
boolean
;
}
const
globalBuilder
=
new
flatbuffers
.
Builder
()
as
Builder
;
globalBuilder
.
inUse
=
false
;
// This is a wrapper around the real Builder .
// The purpose is to reuse a single ArrayBuffer for every message.
// We can do this because the "control" messages sent to the privileged
// side are guarenteed to be used during the call to libdeno.send().
export
function
createBuilder
():
Builder
{
// tslint:disable-next-line:no-any
const
gb
=
globalBuilder
as
any
;
util
.
assert
(
!
gb
.
inUse
);
let
bb
=
globalBuilder
.
dataBuffer
();
// Only create a new backing ArrayBuffer if the previous one had grown very
// large in capacity. This should only happen rarely.
if
(
bb
.
capacity
()
>
1024
)
{
util
.
log
(
`realloc flatbuffer ArrayBuffer because it was
${
bb
.
capacity
()}
`
);
bb
=
ByteBuffer
.
allocate
(
1024
);
}
gb
.
bb
=
bb
;
// Remaining space in the ByteBuffer.
gb
.
space
=
globalBuilder
.
dataBuffer
().
capacity
();
// Minimum alignment encountered so far.
gb
.
minalign
=
1
;
// The vtable for the current table.
gb
.
vtable
=
null
;
// The amount of fields we're actually using.
gb
.
vtable_in_use
=
0
;
// Whether we are currently serializing a table.
gb
.
isNested
=
false
;
// Starting offset of the current struct/table.
gb
.
object_start
=
0
;
// List of offsets of all vtables.
gb
.
vtables
=
[];
// For the current vector being built.
gb
.
vector_num_elems
=
0
;
// False omits default values from the serialized data
gb
.
force_defaults
=
false
;
gb
.
inUse
=
true
;
return
gb
as
Builder
;
}
js/main.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
assert
,
log
,
setLogDebug
}
from
"
./util
"
;
import
*
as
os
from
"
./os
"
;
...
...
@@ -11,7 +11,7 @@ import { promiseErrorExaminer, promiseRejectHandler } from "./promise_util";
import
{
version
}
from
"
typescript
"
;
function
sendStart
():
msg
.
StartRes
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Start
.
startStart
(
builder
);
const
startOffset
=
msg
.
Start
.
endStart
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Start
,
startOffset
);
...
...
js/make_temp_dir.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
import
{
assert
}
from
"
./util
"
;
...
...
@@ -43,7 +43,7 @@ function req({
prefix
,
suffix
}:
MakeTempDirOptions
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
fbDir
=
dir
==
null
?
-
1
:
builder
.
createString
(
dir
);
const
fbPrefix
=
prefix
==
null
?
-
1
:
builder
.
createString
(
prefix
);
const
fbSuffix
=
suffix
==
null
?
-
1
:
builder
.
createString
(
suffix
);
...
...
js/metrics.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
assert
}
from
"
./util
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
...
...
@@ -18,7 +18,7 @@ export function metrics(): Metrics {
}
function
req
():
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Metrics
.
startMetrics
(
builder
);
const
inner
=
msg
.
Metrics
.
endMetrics
(
builder
);
return
[
builder
,
msg
.
Any
.
Metrics
,
inner
];
...
...
js/mkdir.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Creates a new directory with the specified path and permission
...
...
@@ -26,7 +26,7 @@ function req(
path
:
string
,
mode
:
number
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
Mkdir
.
startMkdir
(
builder
);
msg
.
Mkdir
.
addPath
(
builder
,
path_
);
...
...
js/net.ts
浏览文件 @
213885a9
...
...
@@ -4,7 +4,7 @@ import { ReadResult, Reader, Writer, Closer } from "./io";
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
assert
,
notImplemented
}
from
"
./util
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
read
,
write
,
close
}
from
"
./files
"
;
export
type
Network
=
"
tcp
"
;
...
...
@@ -32,7 +32,7 @@ class ListenerImpl implements Listener {
constructor
(
readonly
rid
:
number
)
{}
async
accept
():
Promise
<
Conn
>
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Accept
.
startAccept
(
builder
);
msg
.
Accept
.
addRid
(
builder
,
this
.
rid
);
const
inner
=
msg
.
Accept
.
endAccept
(
builder
);
...
...
@@ -111,7 +111,7 @@ enum ShutdownMode {
}
function
shutdown
(
rid
:
number
,
how
:
ShutdownMode
)
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Shutdown
.
startShutdown
(
builder
);
msg
.
Shutdown
.
addRid
(
builder
,
rid
);
msg
.
Shutdown
.
addHow
(
builder
,
how
);
...
...
@@ -136,7 +136,7 @@ function shutdown(rid: number, how: ShutdownMode) {
* See `dial()` for a description of the network and address parameters.
*/
export
function
listen
(
network
:
Network
,
address
:
string
):
Listener
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
network_
=
builder
.
createString
(
network
);
const
address_
=
builder
.
createString
(
address
);
msg
.
Listen
.
startListen
(
builder
);
...
...
@@ -179,7 +179,7 @@ export function listen(network: Network, address: string): Listener {
* dial("tcp", ":80")
*/
export
async
function
dial
(
network
:
Network
,
address
:
string
):
Promise
<
Conn
>
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
network_
=
builder
.
createString
(
network
);
const
address_
=
builder
.
createString
(
address
);
msg
.
Dial
.
startDial
(
builder
);
...
...
js/os.ts
浏览文件 @
213885a9
...
...
@@ -3,12 +3,12 @@ import { ModuleInfo } from "./types";
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
assert
}
from
"
./util
"
;
import
*
as
util
from
"
./util
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
sendSync
}
from
"
./dispatch
"
;
/** Exit the Deno process with optional exit code. */
export
function
exit
(
exitCode
=
0
):
never
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Exit
.
startExit
(
builder
);
msg
.
Exit
.
addCode
(
builder
,
exitCode
);
const
inner
=
msg
.
Exit
.
endExit
(
builder
);
...
...
@@ -23,7 +23,7 @@ export function codeFetch(
):
ModuleInfo
{
util
.
log
(
"
os.ts codeFetch
"
,
moduleSpecifier
,
containingFile
);
// Send CodeFetch message
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
moduleSpecifier_
=
builder
.
createString
(
moduleSpecifier
);
const
containingFile_
=
builder
.
createString
(
containingFile
);
msg
.
CodeFetch
.
startCodeFetch
(
builder
);
...
...
@@ -53,7 +53,7 @@ export function codeCache(
outputCode
:
string
):
void
{
util
.
log
(
"
os.ts codeCache
"
,
filename
,
sourceCode
,
outputCode
);
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
filename_
=
builder
.
createString
(
filename
);
const
sourceCode_
=
builder
.
createString
(
sourceCode
);
const
outputCode_
=
builder
.
createString
(
outputCode
);
...
...
@@ -84,7 +84,7 @@ function createEnv(_inner: msg.EnvironRes): { [index: string]: string } {
}
function
setEnv
(
key
:
string
,
value
:
string
):
void
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
_key
=
builder
.
createString
(
key
);
const
_value
=
builder
.
createString
(
value
);
msg
.
SetEnv
.
startSetEnv
(
builder
);
...
...
@@ -113,7 +113,7 @@ export function env(): { [index: string]: string } {
command: msg.Command.ENV,
});
*/
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
Environ
.
startEnviron
(
builder
);
const
inner
=
msg
.
Environ
.
endEnviron
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Environ
,
inner
)
!
;
...
...
js/read_dir.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
import
{
FileInfo
,
FileInfoImpl
}
from
"
./file_info
"
;
import
{
assert
}
from
"
./util
"
;
...
...
@@ -25,7 +25,7 @@ export async function readDir(path: string): Promise<FileInfo[]> {
}
function
req
(
path
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
ReadDir
.
startReadDir
(
builder
);
msg
.
ReadDir
.
addPath
(
builder
,
path_
);
...
...
js/read_file.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
assert
}
from
"
./util
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
...
...
@@ -29,7 +29,7 @@ export async function readFile(filename: string): Promise<Uint8Array> {
function
req
(
filename
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
filename_
=
builder
.
createString
(
filename
);
msg
.
ReadFile
.
startReadFile
(
builder
);
msg
.
ReadFile
.
addFilename
(
builder
,
filename_
);
...
...
js/read_link.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
assert
}
from
"
./util
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
...
...
@@ -23,7 +23,7 @@ export async function readlink(name: string): Promise<string> {
}
function
req
(
name
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
name_
=
builder
.
createString
(
name
);
msg
.
Readlink
.
startReadlink
(
builder
);
msg
.
Readlink
.
addName
(
builder
,
name_
);
...
...
js/remove.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Removes the named file or (empty) directory synchronously. Would throw
...
...
@@ -47,7 +47,7 @@ function req(
path
:
string
,
recursive
:
boolean
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
Remove
.
startRemove
(
builder
);
msg
.
Remove
.
addPath
(
builder
,
path_
);
...
...
js/rename.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Synchronously renames (moves) `oldpath` to `newpath`. If `newpath` already
...
...
@@ -30,7 +30,7 @@ function req(
oldpath
:
string
,
newpath
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
oldpath_
=
builder
.
createString
(
oldpath
);
const
newpath_
=
builder
.
createString
(
newpath
);
msg
.
Rename
.
startRename
(
builder
);
...
...
js/stat.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
import
{
assert
}
from
"
./util
"
;
import
{
FileInfo
,
FileInfoImpl
}
from
"
./file_info
"
;
...
...
@@ -54,7 +54,7 @@ function req(
filename
:
string
,
lstat
:
boolean
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
filename_
=
builder
.
createString
(
filename
);
msg
.
Stat
.
startStat
(
builder
);
msg
.
Stat
.
addFilename
(
builder
,
filename_
);
...
...
js/symlink.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
import
*
as
util
from
"
./util
"
;
...
...
@@ -43,7 +43,7 @@ function req(
if
(
type
)
{
return
util
.
notImplemented
();
}
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
oldname_
=
builder
.
createString
(
oldname
);
const
newname_
=
builder
.
createString
(
newname
);
msg
.
Symlink
.
startSymlink
(
builder
);
...
...
js/timers.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
{
assert
}
from
"
./util
"
;
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
{
sendSync
,
setFireTimersCallback
}
from
"
./dispatch
"
;
// Tell the dispatcher which function it should call to fire timers that are
...
...
@@ -51,7 +51,7 @@ function setGlobalTimeout(due: number | null, now: number) {
assert
(
timeout
>=
0
);
}
// Send message to the backend.
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
msg
.
SetTimeout
.
startSetTimeout
(
builder
);
msg
.
SetTimeout
.
addTimeout
(
builder
,
timeout
);
const
inner
=
msg
.
SetTimeout
.
endSetTimeout
(
builder
);
...
...
js/truncate.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Truncates or extends the specified file synchronously, updating the size of
...
...
@@ -30,7 +30,7 @@ function req(
name
:
string
,
len
?:
number
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
name_
=
builder
.
createString
(
name
);
len
=
len
&&
len
>
0
?
Math
.
floor
(
len
)
:
0
;
msg
.
Truncate
.
startTruncate
(
builder
);
...
...
js/write_file.ts
浏览文件 @
213885a9
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import
*
as
msg
from
"
gen/msg_generated
"
;
import
{
flatbuffers
}
from
"
flatbuffers
"
;
import
*
as
flatbuffers
from
"
./
flatbuffers
"
;
import
*
as
dispatch
from
"
./dispatch
"
;
/** Write a new file, with given filename and data synchronously.
...
...
@@ -40,7 +40,7 @@ function req(
data
:
Uint8Array
,
perm
:
number
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
,
Uint8Array
]
{
const
builder
=
new
flatbuffers
.
Builder
();
const
builder
=
flatbuffers
.
create
Builder
();
const
filename_
=
builder
.
createString
(
filename
);
msg
.
WriteFile
.
startWriteFile
(
builder
);
msg
.
WriteFile
.
addFilename
(
builder
,
filename_
);
...
...
src/ops.rs
浏览文件 @
213885a9
...
...
@@ -816,8 +816,8 @@ fn op_copy_file(
// Once the issue is reolved, we should remove this workaround.
if
cfg!
(
unix
)
&&
!
from
.is_file
()
{
return
Err
(
errors
::
new
(
ErrorKind
::
NotFound
,
"File not found"
.to_string
(),
ErrorKind
::
NotFound
,
"File not found"
.to_string
(),
));
}
...
...
tools/http_server.py
浏览文件 @
213885a9
...
...
@@ -57,6 +57,7 @@ def spawn():
if
__name__
==
'__main__'
:
try
:
spawn
()
while
True
:
sleep
(
100
)
while
True
:
sleep
(
100
)
except
KeyboardInterrupt
:
sys
.
exit
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录