Notes about revision architecture
diff --git a/NewDocumentEditor.wiki b/NewDocumentEditor.wiki index 5ccff9c..7622a12 100644 --- a/NewDocumentEditor.wiki +++ b/NewDocumentEditor.wiki
@@ -11,20 +11,38 @@ # Minimize the size of the data retrieved. # Minimize datastore queries and simplify them. -Here is the prototypes of models: +== First approach: independent revisions == {{{ -from google.appengine.ext import db -class DocRevision(db.Model): - user = db.UserProperty() # User, who has created the revision - created = db.DateTimeProperty() # Date and time of creation - doc = db.ReferenceProperty() # Document entity reference - class Revision(db.Model): - revs = db.LinkProperty(db.Key) # List of DocRevision keys - public = db.LinkProperty(db.Key) # List of keys to public revisions - private = db.LinkProperty(db.Key) # List of keys to private revisions + revision_id = db.IntegerProperty() + timestamp = db.DateTimeProperty() # It's not required, cause Document entity has it + user = db.UserProperty() # It's not required, cause Document entity has it + comment = db.TextProperty() # Comment about the revision + current = db.BooleanProperty() # Current revision + deleted = db.BooleanProperty() # Revision is marked as deleted + public = db.BooleanProperty() # Public or private revision + document = db.ReferenceProperty() # Reference to content }}} +It's obvious that revisions are not linked to each other. Each operation on revision is just a query to a datastore. + +== Second approach: Linked revisions == +{{{ +class DocRevision(db.Model): + revision_id = db.IntegerProperty() # It's necessary for list rearrangement + timestamp = db.DateTimeProperty() # It's not required, cause Document entity has it + user = db.UserProperty() # It's not required, cause Document entity has it + comment = db.TextProperty() # Comment about the revision + document = db.ReferenceProperty() # Reference to content + +class Revision(db.Model): + revisions = db.ListProperty(db.Key) # List of revisions + public = db.ListProperty(db.Key) + private = db.ListProperty(db.Key) +}}} + +This approach helps to manage revisions easily, but list rearrangement operations consumes expensive CPU time. + This approach allows us to simplify revision management. {{{revs}}}, {{{public}}} and {{{private}}} are manged at entity creation. = Project timeline = == Week 1 (24 May - 30 May) ==