byu-dnasc / proto-smrtlink-share

0 stars 1 forks source link

How Request Handler Handles Requests #32

Open jwilki23 opened 2 months ago

jwilki23 commented 2 months ago

How to handle requests

flowchart TD
    A[HTTP request comes into server] --> B{Determine request type};
    B -- PUT --> C[Get up-to-date project form SMRTLNK];
    B -- POST --> D[Get newest project from SMRTLNK];
    B -- DELETE --> E[Delete files from DNASC group storage];
    C ----> F[Compare with project in SQLite database];
    F ----> G[Stage files in database and in Globus];
    G ----> H[End PUT Process];
    D ----> I[Create a new project in Globus];
    I ----> J[Update the database];
    J ----> K[End POST Process];
    E ----> L[Update the database records];
    L ----> M[End DELETE Process];

PUT Request

flowchart TD
    A[Update/PUT project request received] --> B[GET project from SMRTLNK];
    B ----> C{Compare current project to the request project};
    C -- Different Name --> D[Update the name of the folder];
    D ----> E[Update the name of the project in the database];
    C -- New dataset --> F[Stage the new dataset in file system, database, and Globus];
    C -- Remove dataset --> G[Delete the dataset in file system, database, and revoke access rule in Globus];
    C -- Add Globus User --> H[Add Globus ID to access rule in Globus];
    C -- Remove Globus User --> I[Delete Globus ID from access rule in Globus];
    F ----> J[End];
    G ----> J;
    H ----> J;
    I ----> J;
    E ----> J;

POST Request

flowchart TD
    A[New project/POST request received] --> B[Make a new folder with the project name];
    B ----> C[For each dataset make a new folder];
    B ----> D[Create access rule for the project folder];
    C ----> E[Create hard links for each file in the folder];
    C ----> F[Create a folder for the additional project analysis];
    D ----> G[End];
    E ----> G;
    F ----> G;

DELETE Request

flowchart TD
    A[New DELETE request received] --> B[Delete project files from DNASC group];
    B ----> C[Delete project from database];
    C ----> D[Revoke access rules to that project];
    D ----> E[End];