CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/db-schema/copy-paths.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Table } from "./types";
7
8
/*
9
Requests and status related to copying files between projects.
10
11
TODO: for now there are no user queries -- this is used entirely by backend servers,
12
actually only in kucalc; later that may change, so the user can make copy
13
requests this way, check on their status, show all current copies they are
14
causing in a page (that is persistent over browser refreshes, etc.).
15
That's for later.
16
*/
17
Table({
18
name: "copy_paths",
19
fields: {
20
id: {
21
type: "uuid",
22
desc: "random unique id assigned to this copy request",
23
},
24
time: {
25
type: "timestamp",
26
desc: "when this request was made",
27
},
28
source_project_id: {
29
type: "uuid",
30
desc: "the project_id of the source project",
31
},
32
source_path: {
33
type: "string",
34
desc: "the path of the source file or directory",
35
},
36
target_project_id: {
37
type: "uuid",
38
desc: "the project_id of the target project",
39
},
40
target_path: {
41
type: "string",
42
desc: "the path of the target file or directory",
43
},
44
exclude: {
45
type: "array",
46
pg_type: "TEXT[]",
47
desc: "patterns to exclude (each is passed to rsync's --exclude)",
48
},
49
overwrite_newer: {
50
type: "boolean",
51
desc: "if new, overwrite newer files in destination",
52
},
53
delete_missing: {
54
type: "boolean",
55
desc: "if true, delete files in the target that aren't in the source path",
56
},
57
backup: {
58
type: "boolean",
59
desc: "if true, make backup of files before overwriting",
60
},
61
public: {
62
type: "boolean",
63
desc: "if true, use files from the public share server instead of starting up the project",
64
},
65
bwlimit: {
66
type: "string",
67
desc: "optional limit on the bandwidth dedicated to this copy (passed to rsync)",
68
},
69
timeout: {
70
type: "number",
71
desc: "fail if the transfer itself takes longer than this number of seconds (passed to rsync)",
72
},
73
scheduled: {
74
type: "timestamp",
75
desc: "earliest time in the future, when the copy request should start (or null, for immediate execution)",
76
},
77
started: {
78
type: "timestamp",
79
desc: "when the copy request actually started running",
80
},
81
finished: {
82
type: "timestamp",
83
desc: "when the copy request finished",
84
},
85
error: {
86
type: "string",
87
desc: "if the copy failed or output any errors, they are put here.",
88
},
89
expire: {
90
type: "timestamp",
91
desc: "delete this row after this date, if not null",
92
},
93
},
94
rules: {
95
primary_key: "id",
96
97
pg_indexes: [
98
"time",
99
"scheduled",
100
"((started IS NULL))",
101
"((started IS NOT NULL))",
102
"((finished IS NULL))",
103
"((finished IS NOT NULL))",
104
"((error IS NOT NULL))",
105
],
106
},
107
});
108
109