-
Notifications
You must be signed in to change notification settings - Fork 1
sharable document model
Enos Feedler edited this page Jun 26, 2013
·
3 revisions
there exists two main collections:
-
a unified collection of published documents
-
a private collection of unpublished documents
- an unpublished document is created by editing a published document (YK: should be created on page visit?)
- at the REST layer, this means posting a new document to the unpublished collection
- the query parameters to the new document contain a reference to the document which is being copied
- a 'parent' field in the unpublished document retains a memory of which published document this came from
- history is maintained because the parent document is not actually deleted, we still retain the mongo record
- there is no useful web-view of a published document (YK: what does this mean?)
- there is simplly operations to list and searched published documents in order to clone one
- therefore a real web user is always viewing an unpublished documemnt
- when a user views a project, we check to see if they have any unpublished clones of this project
- if there are no clones, we create one (YK)
- if they have 1 unpublished clone, we show that clone
- if they have multiple unpublished clones, we show either a) a summary list of clones sorted by last updated with meta data (title, etc) b) we default to their most recently updated clone c) always create a new clone (giving them a view of the original project)
- saving of unpublished documents is implicit
- file writes are persistent
- meta-data changes are persistent
- meta-data and file ops are in sync
- unpublished documents are cloned from documents in the unified colletion of published documents
- web api / file access is permitted on an unpublished document (can read/write/update source files)
- a terminal interface can be attached to an unpublished document (arbitrary document state changes)
- can directly update the meta data on the unpublished document
- can start/stop/restart an unpublished document
- this creates a layer of state that is temporary
- user can access the log stream of a running document
- log stream state is temporary and actually part of document state
- we cannot correlate it with the version of source code that generated it
- unpublished documents expire after N days (YK: don't expire for registered users)
- save is implied on each REST operation
- published documents are cloned from documents in the private collection of unpublished documents (save)
- file operations are not permitted (state stored as an image)
- published documents never expire
- there is no saving model, the resource exists in a fixed state until it is deleted
- know who the user on the page is (done)
- figure out if a container (private runnable) already exists for the user (query their list with parent=projectId)
- create a new private runnable cloned from the published one if it didint exist
- load an existing private runnable cloned from the published one (if we found it)
- if we created it, its not saved so dont update the url (create an open session)
- if we load it and its not saved already, dont update the url (existing open session)
- on save:
- figure out if they are the owner of a particular project (done)
- if they own the project the container was copied from, save back to that project
- if they dont own the project, on save, publish it (save to image) and update url
- delete the container (so they can do the process over again by visiting the parent url)