Changes between Version 3 and Version 4 of Session2


Ignore:
Timestamp:
Oct 1, 2015, 12:49:43 AM (10 years ago)
Author:
Greg Couch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Session2

    v3 v4  
    99(Chimera2 data can be categorized as raw data, GUI data, and organizational data. Expound.)
    1010
     11== Protocols ==
     12
     13=== Saving protocol: ===
     141. visit all session state and record:
     15  * what tool is responsible for the state
     16  * what data it refers to and
     17    * only referred to data needs to be named
     181. save the list of used tools
     19  * need tool's state version, not tool version
     201. serialize state
     21  * keep track of named data that was saved
     221. confirm that all referred to data was saved
     23  * if not, then the session is incomplete/corrupt
     24
     25=== Restoring protocol: ===
     261. Read the list of used tools
     27  * if installed tools are insufficient, then give user option to cancel or load tools
     281. deserialze state inside block/unblock of triggers
     29
     30
    1131== The Problem ==
    1232
     33The problem is how to serialize the session state.
    1334Ideally, when restoring a session, all data that is referenced by some other data has already been restored.  Therefore all of dependencies need to be known by the saving code and there can be no circular dependencies.  This avoids two-phase initialization, which is especially important for C++ objects.
    1435
     
    4869* Can we provide a "simple" API for tools?
    4970
    50 == Part of the Solution ==
     71== Possible Solution ==
    5172
    52 Saving protocol:
    53 1. visit all session state and record:
    54   * what tool is responsible for the state
    55   * what data it refers to and
    56     * only referred to data needs to be named
    57 1. save the list of used tools
    58 1. serialize state
    59   * keep track of named data that was saved
    60 1. confirm that all referred to data was saved
     73Two competing solutions:
     741. allow circular references via two-phase initialization
     75  * like Python's pickle
     762. Specify dependencies and save/restore in the right order
    6177
    62 Restoring protocol:
    63 1. Read the list of used tools
    64   * if installed tools are insufficient, then give user option to cancel or load tools
    65 1. deserialze state inside block/unblock of triggers
     78=== Example ===
    6679
     80* molecular data needs to be saved early
     81* molecular data is in a model
     82* session gets a model from its list of models
     83* a tool may provide a new model that depends on molecular data and tool state
     84* so some models will need to saved before others
     85* so some tools may need to saved before associated model
     86* does that mean that tools are saved first?
     87* ordering is complicated
     88
     89=== The Solution ===
     90
     91Circular dependencies are natural.  So use two-phase initialization when deserializing a session.
     92
     93Really don't want to use two-phase initialization for C++ objects.  So don't.  As long as the C++ objects are restored all together (i.e., atomic structures and pseudobonds), we can avoid two-phase initialization for them.  If the C++ objects refer to Python objects, that part would need to follow a two-phase protocol.
     94
     95On the Python side, it is possible to provide an API that takes "simple" data and implements all of the individual save and restore steps.