durusmail: quixote-users: Interface for session persistence
Interface for session persistence
2002-05-18
2002-05-18
2002-05-19
2002-05-20
2002-05-20
2002-05-20
2002-05-20
2002-05-20
2002-05-21
2002-05-24
2002-05-24
2002-05-24
2002-05-18
2002-05-20
2002-05-20
Interface for session persistence
Greg Ward
2002-05-20
On 20 May 2002, I said:
> In summary, I haven't made up my mind yet.  I need to do some more
> thinking and coding and see what falls out.  I'm reconciled to more
> upheaval in session.py though, so what the heck.  Might as well get it
> all done at once.

OK, I've made up my mind.  Here's how I now think session persistence
should work:

  * Quixote provides a SessionManager class that is much like the
    current one, ie. sessions are stored in a mapping self.sessions,
    and the session manager provides a mapping interface that is
    delegated to self.sessions

  * but applications can provide an alternative mapping object that
    implements persistence.  If you want to store your sessions in small
    pickle files in a directory, you write a mapping class that does
    that.  If you want to use ZODB, you just provide an instance of
    OOBTree or PersistentMapping, depending on your needs.  If you want
    to write sessions to a DBM/BerkeleyDB hash file, you might be able
    to get away with just supplying the file, or maybe a very thin
    wrapper around it.

Something like this occurred to me Saturday as I was writing the
DemoSessionManager that I posted that evening, and then Jon suggested
the same idea today.  Now that I've actually implemented it, it just
feels right.  Very nice and OO.  I'm going to test it out a bit with my
session management demo to make sure it works, and then I'll post some
code for everyone to chew on.

        Greg
--
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org


reply