---
# System prepended metadata

title: Untitled

---

                                                                               # URN Request Flow

```rust
struct WaitingArea {
    requests: vec![Request]
}

enum Status<Id> {
    NotFound(Id),
    Processing(Id),
    Complete(Id),
}

trait Request<Id> {
    type Error;
    
    fn request(&self) -> Status<Id>;
}

A -> bool

type Request<A> = FnOnce(A) -> bool;

1. (Urn, Channel) -> bool // The Urn is for knowing what thing we asked for and the Channel is knowing when we got a response, i.e. check = channel.peek().is_some()
2. (Urn, Channel) -> bool // channel.next()
3. (Urn, Channel) -> bool // channel.next().map(|peer| clone(urn, peer)).is_some()
4. () -> bool // true

States:
1. Asked Network, we can transition when Urn is found
    a. This can go on forever unless user cancels; maybe
    we add a timeout
2. Network gives stream of peers
    a. Has a next a value go to 3.
    b. No values; wait at 2.
3. Attempting clone from peer
    a. Project is in monorepo go to 4.
    b. No project after X seconds/minutes go back to 2.
4. Clone successful - Done

todos
[] document states & create flow diagram

```

1. Start up app
2. Create user
3. Create project
4. Clear Session -- invalidates previous user as default
5. Create new user
6. List projects -- original project gets listed but it's not owned by the new user, i.e. rad/self points to the wrong user.

1. Get all projects -- then for each project
2. Get rad/self of project
3. Check rad/self === default rad/self
    a. If not filter out
    b. If so keep in
    
    pub fn my_projects(&self) -> ... {
        self.list_projects().into_iter().filter(|project| self.list_project_refs(project.urn())?.is_not_empty())
    }
    
    pub fn tracked_project(&self) -> ... {
        self.list_projects().into_iter().filter(|project| self.list_project_refs(project.urn())?.is_empty()).map(Tracked)
    }
    
    GET /projects/my
    GET /projects/tracked
    
    enum ProjectState {
        Mine,
        Tracked
    }
    
    fn project(t: ProjectState) {
        match t {
            ProjectState::Mine => api.my_projects(..),
            ProjectState::Tracked => api.tracked_projects(..),
        }
    }
    
    
```typescript=
    enum ProjectState {
        Mine = "mine",
        Tracked = "tracked"
    }
    
    interface Project {
        urn: string;
        id: string;
        ...
        state: ProjectState;
    }
    
```