bobbai00 opened a new issue, #9489:
URL: https://github.com/apache/texera/issues/9489

   ### Task Summary
   
   Reading a resource takes a different endpoint for each kind, and two kinds 
cannot be read one at a time at all: there are `GET /workflow/{wid}`, `GET 
/dataset/{did}`, `GET /model/{mid}` and `GET /computing-unit/{cuid}`, but 
nothing for environments and warehouses. Lists differ in the same way, from 
`GET /workflow/list` to `GET /pve/db` and `GET /warehouse/status`. So a feature 
that works across kinds, such as letting the agent list the datasets a user can 
read (#9377) or a list page in the React frontend (#9387), needs a client for 
every kind.
   
   This task serves the reads of every kind through the endpoints of #9395, 
from the shared code, before any write moves:
   
   | Operation | Endpoint | Kinds |
   | --- | --- | --- |
   | List | `GET /{kind}` | all six |
   | Read | `GET /{kind}/{rid}` | all six |
   | List versions | `GET /{kind}/{rid}/versions` | workflows, datasets, models 
|
   | Read a version | `GET /{kind}/{rid}/versions/{vno}` | workflows, datasets, 
models |
   
   Because these endpoints only read through the views of #9487, they cannot 
break anything that works today, and the old read endpoints stay until #9492.
   
   #### Before
   
   ```mermaid
   flowchart LR
     c["Client"]
     ds["Dashboard Service"]
     fs["File Service"]
     cs["Computing Unit<br/>Managing Service"]
     ew["Environments,<br/>warehouses"]
     c -- "GET /workflow/{wid}" --> ds
     c -- "GET /dataset/{did}<br/>GET /model/{mid}" --> fs
     c -- "GET /computing-unit/{cuid}" --> cs
     c -. "no read endpoint" .-> ew
   ```
   
   #### After
   
   ```mermaid
   flowchart LR
     c["Generated client"]
     ifc["Generated interface<br/>in each kind's service"]
     sh["Shared read code<br/>common/resource"]
     chk["One access check"]
     v[("resource,<br/>resource_version<br/>views")]
     c -- "GET /{kind}<br/>GET /{kind}/{rid}<br/>and their versions" --> ifc
     ifc --> sh
     sh --> chk
     sh --> v
   ```
   
   #### Scope
   
   1. **The reads above.** Served from the generated interfaces of #9485, with 
paging and a text query, and filtered by the check of #9488.
   2. **One shape.** A read returns the common fields of `resource`, and the 
kind's own fields as `spec`. What only one kind has, such as the files of a 
dataset version, stays an operation of that kind.
   3. **The agent service first.** The agent service calls these reads through 
the client of #9485. When the frontend moves is a question for #9492.
   
   This task changes no write, which is #9490.
   
   #### Discussion Points
   
   1. **Where the reads run.** Each kind's service serves its own kind, so the 
gateway would route `/api/datasets` to file-service and `/api/computing-units` 
to the Computing Unit Managing Service. Workflows and warehouses are served by 
the Dashboard Service and environments by the computing unit, both on 
Dropwizard 1.3, so they need a Dropwizard 4 host first, as discussion point 3 
of the parent issue says.
   2. **Search.** The dashboard search maps the columns of each kind by hand 
into one schema of 28 columns. It can become a text query on these lists, with 
its full-text indexes on `resource`, or stay a separate endpoint over the same 
views.
   
   Done when every kind answers the reads above through generated interfaces 
and one access check, and the agent service lists a user's datasets with the 
generated client.
   
   ### Task Type
   
   - [x] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [ ] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to