• Kirill Smelkov's avatar
    Add support for persistent references (#37) · 84598fe1
    Kirill Smelkov authored
    * Add docstrings to types exposed in public API
    
    I was refreshing my knowled of ogórek and added them along the way.
    
    * Add support for persistent references
    
    Python has the mechanism for objects in one pickle to reference objects
    in another pickle. This mechanism is primarily used in ZODB object
    database for one object to "persistently" reference another object(*).
    
    I needed a way to load and understand objects from a ZODB database in
    Go, and hence comes this patch for ogórek that teaches it to understand
    such persistent references.
    
    Like it is already with Call and Class we add a dedicated Ref type to
    represent persistent references in pickle stream.
    
    (*) in ZODB when one object is changed, there is no need to resave
    unchanged object that is referencing it because its reference stays
    valid and pointing to changed object: the "persistent ID" in ZODB is
    only object ID and which revision of the referenced object it points to
    is implicitly follows by current transaction number view of the database.
    84598fe1
encode.go 7.49 KB