Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
4 states for uploaded in the dataprovider table.
 - not_started when we haven't started uploading the clks
 - in_progress when we start uploading them (lock the resource)
 - done when completed
 - error when an error occured.
  • Loading branch information
gusmith committed Nov 11, 2019
commit bbadaddf56c4f66331730766b2b02d745ee89645
8 changes: 7 additions & 1 deletion backend/entityservice/init-db-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ RETURNS bool AS $$
SELECT $1.state = 'completed'
$$ STABLE LANGUAGE SQL;

CREATE TYPE UPLOADEDSTATE AS ENUM (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, now we have UPLOADEDSTATE and UPLOADSTATE. This is very confusing.
After looking at those for a bit, I think we should rename UPLOADSTATE to PROCESSEDSTATE.
It would also be nice to add a bit of an explanation what all those states are for.
In my view,
UPLOADSTATE describes the state of the processing of the uploaded clks. This is only set after CLKs have been uploaded. 'pending' means we are waiting for some processing to be done, 'ready' means done and 'error' if something fails.
UPLOADEDSTATE describes the state of the CLK upload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was indeed a pickle. I will add comments on the UPLOADEDSTATE.
I didn't want to touch the UPLOADSTATE as I wasn't sure what it was made for (as you mentioned, this is not well documented). But I'll also add some documentation around it and rename it. In which case I will also rename UPLOADEDSTATE to UPLOADSTATE which sounds better :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll finally keep UPLOADEDSTATE instead of renaming it because the value in the table is uploaded. But renamed the UPLOADSTATE to PROCESSEDSTATE, adding some documentation.

'not_started',
'in_progress',
'done',
'error'
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice


CREATE TABLE dataproviders (
id SERIAL PRIMARY KEY,
Expand All @@ -93,7 +99,7 @@ CREATE TABLE dataproviders (
token CHAR(48) NOT NULL UNIQUE,

-- Set after the bloom filter data has been added
uploaded BOOL NOT NULL DEFAULT FALSE,
uploaded UPLOADEDSTATE NOT NULL,

project CHAR(48) REFERENCES projects (project_id) on DELETE CASCADE
);
Expand Down