Chromium Code Reviews| Index: experimental/webtry/DESIGN.md |
| diff --git a/experimental/webtry/DESIGN.md b/experimental/webtry/DESIGN.md |
| index 0bc214512833beb6c84a2f0c6fc416ccd45d0a44..6def175b823fd6a2c4782634125dca17b75b01cc 100644 |
| --- a/experimental/webtry/DESIGN.md |
| +++ b/experimental/webtry/DESIGN.md |
| @@ -136,6 +136,7 @@ Initial setup of the database, the user, and the only table: |
| GRANT SELECT, INSERT, UPDATE ON webtry.webtry TO 'webtry'@'%'; |
| GRANT SELECT, INSERT, UPDATE ON webtry.workspace TO 'webtry'@'%'; |
| GRANT SELECT, INSERT, UPDATE ON webtry.workspacetry TO 'webtry'@'%'; |
| + GRANT SELECT, INSERT, UPDATE ON webtry.sources TO 'webtry'@'%'; |
| // If this gets changed also update the sqlite create statement in webtry.go. |
| @@ -143,24 +144,40 @@ Initial setup of the database, the user, and the only table: |
| code TEXT DEFAULT '' NOT NULL, |
| create_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, |
| hash CHAR(64) DEFAULT '' NOT NULL, |
| - PRIMARY KEY(hash) |
| + source INTEGER DEFAULT 0 NOT NULL, |
|
mtklein
2014/05/28 17:36:50
Having both "code" and "source" is a touch confusi
jcgregorio
2014/05/28 18:42:59
Done.
|
| + PRIMARY KEY(hash), |
| + |
| + FOREIGN KEY (source) REFERENCES sources(id) |
| ); |
| CREATE TABLE workspace ( |
| name CHAR(64) DEFAULT '' NOT NULL, |
| create_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, |
| - PRIMARY KEY(name) |
| + PRIMARY KEY(name), |
| ); |
| CREATE TABLE workspacetry ( |
| name CHAR(64) DEFAULT '' NOT NULL, |
| create_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, |
| hash CHAR(64) DEFAULT '' NOT NULL, |
| + source INTEGER DEFAULT 0 NOT NULL, |
| hidden INTEGER DEFAULT 0 NOT NULL, |
| - FOREIGN KEY (name) REFERENCES workspace(name) |
| + FOREIGN KEY (name) REFERENCES workspace(name), |
| ); |
| + CREATE TABLE sources ( |
|
mtklein
2014/05/28 17:36:50
Funky indent?
jcgregorio
2014/05/28 18:42:59
Done.
|
| + id INTEGER PRIMARY KEY NOT NULL, |
| + image MEDIUMBLOB DEFAULT '' NOT NULL, |
|
mtklein
2014/05/28 17:36:50
Can we note somehow how image is encoded? Is it,
jcgregorio
2014/05/28 18:42:59
Done.
|
| + width INTEGER DEFAULT 0 NOT NULL, |
| + height INTEGER DEFAULT 0 NOT NULL, |
| + create_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, |
| + hidden INTEGER DEFAULT 0 NOT NULL |
| + ) |
| + |
| + ALTER TABLE webtry ADD COLUMN source INTEGER DEFAULT 0 NOT NULL AFTER hash; |
| + ALTER TABLE workspacetry ADD COLUMN source INTEGER DEFAULT 0 NOT NULL AFTER hash; |
| + |
| Common queries webtry.go will use: |
| INSERT INTO webtry (code, hash) VALUES('int i = 0;...', 'abcdef...'); |
| @@ -183,6 +200,10 @@ Common queries for workspaces: |
| SELECT name FROM workspace GROUP BY name; |
| +Common queries for sources: |
| + |
| + SELECT id, image, width, height, create_ts FROM sources ORDER BY create_ts DESC LIMIT 100; |
| + |
| Password for the database will be stored in the metadata instance, if the |
| metadata server can't be found, i.e. running locally, then a local sqlite |
| database will be used. To see the current password stored in metadata and the |
| @@ -202,6 +223,26 @@ the metadata server: |
| N.B. If you need to change the MySQL password that webtry uses, you must change |
| it both in MySQL and the value stored in the metadata server. |
| +Source Images |
| +------------- |
| + |
| +For every try the user can select an optional source image to use as an input. |
| +The id of the source image is just an integer and is stored in the database |
| +along with the other try information, such as the code. |
| + |
| +The actual image itself is also stored in a separate table, 'sources', in the |
| +database. On startup we check that all the images are available in 'inout', |
| +and write out the images if not. Since they are all written to 'inout' we can |
| +use the same /i/ image handler to serve them. |
| + |
| +The bitmap is available to user code as a module level variable: |
| + |
| + SkBitmap source; |
| + |
| +The bitmap is read, decoded and stored in source before the seccomp jail is |
| +instantiated. |
| + |
| + |
| Squid |
| ----- |