Introduce Session::Relation with state tracking and identity map
Introduce Session::Relation with state tracking and identity map

Here are 3 core concepts within the rom-session:

* Session::Relation

    Session::Relation is a proxy object decorating ROM's relation. It intercepts
    persistence-related calls and records state changes instead of hitting db-backend
    immediately.

    Session relations expose session-specific interface, which are methods like
    `#dirty?` or `#tracking?`. I only implemented a sub-set of these methods, more
    will be added shortly.

* Session::Tracker

    Tracker holds a reference to all registered objects within a session. It knows
    about the object and its current state.

* Session::IdentityMap

    IdentityMap is used to skip loading objects that are already registered in the IM.
    Please note that it's a different concept than the tracker. Tracker is concerned
    with the state changes. IM is only used to store loaded objects accessible via
    their identifiers. IM stores loaded objects in the tracker because a persisted
    object has "persisted" state and we need to track that.

* Session::State

    In a session objects can have following states:

      - Persisted - an object was loaded from the database
      - Deleted   - an object was loaded from the database and delete is pending
      - Updated   - an object was loaded from the database, changed in memory and
                    update is pending
      - Created   - an object was registered and insert is pending
      - Transient - an object was initialized in memory and registered in the session

This should open doors to flushing the session. Flushing should work with or
without a unit of work. Without a UoW it will simply go through all of the state
changes and commit them one by one in the same order as they were recorded. With
a UoW it will sort the recorded state changes and call prepare/finalize hooks
before/after state changes are committed.

That's at least my vision ;)

This is very early code and I suspect we should be able to come up with a better
design over time. I just made it work, more or less, partially. More tests to
be written.

rom-rb/rom-support