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/project-info.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
/*
7
This table contains real-time information about a running project. In particular, this includes the running processes, CGroup status, etc. It is updated frequently, hence use it wisely...
8
*/
9
10
import { Table } from "./types";
11
12
Table({
13
name: "project_info",
14
fields: {
15
project_id: {
16
type: "uuid",
17
desc: "The project id.",
18
},
19
info: {
20
// change this according to all the usual schema rules
21
type: "map",
22
pg_type: "JSONB[]",
23
desc: "Info about the project",
24
},
25
},
26
rules: {
27
durability: "ephemeral", // won't be stored in the database at all ever.
28
desc:
29
"Information about running processes, cgroups, disk space, etc. of projects",
30
primary_key: ["project_id"], // can list multiple another field if you want to have multiple records for a project.
31
user_query: {
32
get: {
33
pg_where: ["projects"],
34
fields: {
35
project_id: null,
36
info: null,
37
},
38
},
39
set: {
40
// users can set that they are interested in this
41
fields: {
42
project_id: "project_id",
43
info: true,
44
},
45
},
46
},
47
48
project_query: {
49
get: {
50
pg_where: [{ "project_id = $::UUID": "project_id" }],
51
fields: {
52
project_id: null,
53
info: null,
54
},
55
},
56
set: {
57
// delete=true, since project *IS* allowed to delete entries
58
delete: true,
59
fields: {
60
project_id: "project_id",
61
info: true,
62
},
63
},
64
},
65
},
66
});
67
68