• Kirill Smelkov's avatar
    go/zodb: IPersistent + Connection stub · f6a27a1e
    Kirill Smelkov authored
    Add to ZODB/go IPersistent - the interface that is used to represent
    in-RAM application-level objects that are mirroring objects in database.
    
    The interface is modelled after Python's IPersistent
    
    	https://github.com/zopefoundation/ZODB/blob/3.10.7-4-gb8d7a8567/src/persistent/interfaces.py#L22
    
    but is not exactly equal to it. In particular we support concurrent
    access to an object from multiple goroutines simultaneously.
    
    Due to concurrency support there is no STICKY state, because STICKY is
    used in CPython version to temporarily pin object in RAM briefly and is
    not safe to use from multiple threads there. Correspondingly the
    semantic of PActivate is a bit different from _p_activate - in Go, after
    an object has been activated, it is guaranteed that it will remain
    present in RAM until it is explicitly deactivated by user.
    
    Please see details of the activation protocol in IPersistent
    documentation.
    
    ZODB/py uses interface (IDataManager) for a persistent-object's jar, but
    in Go I decided, at least for now, to go without explicit interface at
    that level. For this reason a concrete type - Connection - will be used,
    and so its stub is also introduced in the patch, since IPersistent wants
    to return the connection via PJar.
    f6a27a1e
persistent_api.go 4.06 KB