The motivation for this is to have a clean API to use in persistent models. The trade off is biased towards having something less general but easier to use.
Use this snippet to load it into your Pharo* image:
Gofer it smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo30'; package: 'ConfigurationOfAggregate'; load. (Smalltalk at: #ConfigurationOfAggregate) load
Make a session to the odb (it will create one if needed):
pool := ARODBPool onPath: ('aha' / 'mhm') asFileReference path.
Saving a new dummy person aggregate
pool commit:[ ARDummyUser new firstName: 'Chewbacca'; save].
Fetching all dummy person aggregates (and read-only-ish make them sing)
pool readOnly:[ ARDummyUser findAll do:[:wookie| wookie sayGrroooouuugggaaaghhh]].
Fetching Chewbaccas that ...
pool readOnly:[ ARDummyUser withFirstName: 'Chewbacca' ].
ARDummyPerson class>>withFirstName: aName ^ self storage find: self where: #firstName is: aName
...indexed because they have this class side method:
ARDummyPerson class>>indices "Answers the indices for this aggregate so it performs well for the application using it. Note: a repository index rebuild is needed when this definition changes" ^ super indices add: (ARAttributeIndex new aggregateClass: self; selector: #firstName; keySize: self nameKeySize; yourself); yourself
Garbage collect the database
Well is filebased BTrees so...
Go ahed and take a look here:
...are welcomed, send that push request and hopefully we can review it together
Getting a fresh Pharo Smalltalk image and its virtual machine is as easy as running in your terminal:
wget -O- get.pharo.org/30+vm | bash
MIT - License
2014 - sebastian