Skip to content

b-tsao/infrastructure-test-tool

Repository files navigation

Tech Notes

While the application supports HTTP REST Requests for retrieving or modifying projects, real-time data retrieval is also available through SSE (Server Sent Events) and Websockets.

REST
GET           /heartbeat
GET           /projects
GET           /project
POST        /project
DELETE   /project1
PUT           /project/file
DELETE   /project/file2
POST        /project/file/rename2

Server Sent Events
GET           /event/projects
GET           /event/project

Websockets
TODO Will be used for individual file editing for real time collaboration

1The DELETE project operation deactivates the project. Currently deactivated projects are permanently deleted upon server start.

2Rename and delete utilizes a dynamic directory feature where directories are created and deleted dynamically based on the file path. If a directory is empty, it is removed. If a file indicates it is under a directory in the path and the directory does not exist, it is created.

The file system structure for storing projects looks as follows (relative to app directory):

  • public/projects/1

    • metadata.json
    • files (directory)

1 Project directories are UUIDs by design in order to allow projects to be 'deactivated' instead of 'deleted' by the user. A deactivated project is essentially deleted to the user and is removed from memory.2

2 Projects are loaded into memory upon server start as JSON with key/value pair of <project_name>/<project_metadata>.

The metadata.json structure is as follow:
{
    "name": Project name,
    "description": Project description,
    "active": Project active status,
    "status": enum{ 0 (NORMAL), 1 (ERROR) },
    "errors": Number of errors in the project,
    "files": [] Files in the project
}

Note: Each project contains all the fields above in-memory, in addition to the following fields added upon load:

  • "path": "Project path relative to app directory"
  • "createdTime": Created time retrieved from metadata.json file stat created time
  • "modifiedTime": Modified time retrieved from metadata.json file stat modified time

The File structure is as follow:
{
    "name": File name,
    "path": File path relative to project path files directory1,
    (file) "description": File description,
    (directory) "files": [] Files in the directory
}

1 Directory path always ends with a '/'. The file path in the file structure is constructed using '/' separators, which can be different from the OS file system separator. The model 'projectmanager' takes care of this by deconstructing (splitting) the file path and using the path library to reconstruct the absolute file path when using it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published