adambird/entity_store — pull request #12 by gshutler (2014-04-03 15:34:18+00:00)
Title: Snapshot key

Added the ability to add a method to entity classes `entity_store_snapshot_key` to check the validity of previously taken snapshots when using the MongoEntityStore.

Example:

```ruby
class MyEntity
include EntityStore::Entity

def self.entity_store_snapshot_key
1
end
end
```

When hydrating an entity, if this method is defined, the snapshot will be inspected to ensure its key matches the one found against the entity's type. If it does not match then the snapshot is ignored and all events will be replayed.

This is intended to make it easier to release changes to your entities with zero downtime as if you make a change that makes your existing snapshots invalid, you can alter its entity_store_snapshot_key and they
will be ignored.