Changeset 708 for trunk/src/model


Ignore:
Timestamp:
08/04/11 15:25:31 (14 years ago)
Author:
lgiessmann
Message:

trunk: datamode + json-exporter: implemented cahcing for the isidorus-json serialization format of fragments, i.e. a fragment is only serialized if it has changed, otherwise the stored serialization string is returned. The serialization string itself is created if the fragment changed and added to the slot serializer-cache of each fragment instance

Location:
trunk/src/model
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/model/changes.lisp

    r470 r708  
    325325          :index t
    326326          :documentation "changed topic (topicSI in Atom")
     327   (serializer-cache :type String
     328                     :initform nil
     329                     :initarg :serializer-cache
     330                     :documentation "contains te serialized string
     331                                     value of this FragmentC instance,
     332                                     that can contain any string format,
     333                                     e.g. JTM, XTM, ... depending on the
     334                                     setter method.")
     335   (serializer-notes :type List
     336                     :initform nil
     337                     :initarg :serializer-notes
     338                     :documentation "contains a list of the forms
     339                                     (:psis <int> :iis <int> :sls <int>
     340                                      :names <int> :occurrences <int>
     341                                      :roles <int>) that indicates the
     342                                     number of elements this fragment's
     343                                     topic is bound to. It is only necessary
     344                                     to recognize mark-as-deleted elements,
     345                                     since newly added elements will result
     346                                     in a completely new fragment.")
    327347   (referenced-topics
    328348    :type list
     
    451471                       #'(lambda(frg-1 frg-2)
    452472                           (> (revision frg-1) (revision frg-2))))))))))
     473
     474
     475(defgeneric serializer-cache (fragment)
     476  (:documentation "returns the slot value of serializer-cache or nil,
     477                   if it is unbound.")
     478  (:method ((fragment FragmentC))
     479    (when (slot-boundp fragment 'serializer-cache)
     480      (slot-value fragment 'serializer-cache))))
     481
     482
     483(defgeneric serializer-notes (fragment)
     484  (:documentation "returns the slot value of serializer-notes or nil,
     485                   if it is unbound.")
     486  (:method ((fragment FragmentC))
     487    (when (slot-boundp fragment 'serializer-notes)
     488      (slot-value fragment 'serializer-notes))))
     489
     490
     491(defgeneric serializer-notes-changed-p (fragment)
     492  (:documentation "Returns t if the serializer-notes slot contains
     493                   a value that does not correspond to the actual
     494                   values of the fragment.")
     495  (:method ((fragment FragmentC))
     496    (let ((top (topic fragment))
     497          (sn (serializer-notes fragment)))
     498      (or (/= (length (psis top :revision 0))
     499              (getf sn :psis))
     500          (/= (length (item-identifiers top :revision 0))
     501              (getf sn :iis))
     502          (/= (length (locators top :revision 0))
     503              (getf sn :sls))
     504          (/= (length (names top :revision 0))
     505              (getf sn :names))
     506          (/= (length (occurrences top :revision 0))
     507              (getf sn :occurrences))
     508          (/= (length (player-in-roles top :revision 0))
     509              (getf sn :roles))))))
  • TabularUnified trunk/src/model/datamodel.lisp

    r643 r708  
    4444
    4545           ;;methods, functions and macros
     46           :serializer-notes
     47           :serializer-cache
     48           :serializer-notes-changed-p
    4649           :instanceOf-association-p
    4750           :has-identifier
Note: See TracChangeset for help on using the changeset viewer.