Voyage - PharoConf 2012

29
Voyage The adventure of persisting object-models Wednesday, June 27, 12

description

Voyage is a persistence framework for object models.

Transcript of Voyage - PharoConf 2012

Page 1: Voyage - PharoConf 2012

VoyageThe adventure of persisting object-models

Wednesday, June 27, 12

Page 2: Voyage - PharoConf 2012

A glimpse of Seaside

• Stateful

• Component model

• Maybe aged, but still the best :)

Wednesday, June 27, 12

Page 3: Voyage - PharoConf 2012

ContinuationsI still prefer:

Wednesday, June 27, 12

Page 4: Voyage - PharoConf 2012

ContinuationsOver:

Wednesday, June 27, 12

Page 5: Voyage - PharoConf 2012

A glimpse of Pier

• A CMS

• Component based

• You can embed almost anything

• You can decorate almost anything

Wednesday, June 27, 12

Page 6: Voyage - PharoConf 2012

A perfect world

Wednesday, June 27, 12

Page 7: Voyage - PharoConf 2012

A perfect world

• Objects collaborate inside your image, creating a perfect choreography of interacting elements...

Wednesday, June 27, 12

Page 8: Voyage - PharoConf 2012

A perfect world

• Objects collaborate inside your image, creating a perfect choreography of interacting elements...

• INSIDE your image

Wednesday, June 27, 12

Page 9: Voyage - PharoConf 2012

Why to persist?

• Space

• Reliability

• Scalability

Wednesday, June 27, 12

Page 10: Voyage - PharoConf 2012

Persisting Pier

• A complex* object model

• Looking for

• Scalability

• Update capabilities

• Backup

*And I mean really complex: take a look to all those commands, decorations and dictionaries :)

Wednesday, June 27, 12

Page 11: Voyage - PharoConf 2012

Show time!

Wednesday, June 27, 12

Page 12: Voyage - PharoConf 2012

Voyage

• A “non-abstract” persistence layer

• An “implementation pattern” which provides some services as well

Wednesday, June 27, 12

Page 13: Voyage - PharoConf 2012

A simple layered approach

Voyage

Memory Mongo ...

MongoTalk Magritte-Mongo

Wednesday, June 27, 12

Page 14: Voyage - PharoConf 2012

Use cases

Singleton mode:

Regular mode:

Wednesday, June 27, 12

Page 15: Voyage - PharoConf 2012

A simple API

• #save:

• #remove:

• #removeAll:

• #selectAll:

• #selectMany:where:

• #selectOne:where:

Wednesday, June 27, 12

Page 16: Voyage - PharoConf 2012

A simple API

• #save:

• #remove:

• #removeAll:

• #selectAll:

• #selectMany:where:

• #selectOne:where:

Where clauses are what

the back-end needs, no something intermediate

Wednesday, June 27, 12

Page 17: Voyage - PharoConf 2012

A simple API

• #save:

• #remove:

• #removeAll:

• #selectAll:

• #selectMany:where:

• #selectOne:where:

Where clauses are what

the back-end needs, no something intermediate

Memory: [ :each | each key = 42 ]

Wednesday, June 27, 12

Page 18: Voyage - PharoConf 2012

A simple API

• #save:

• #remove:

• #removeAll:

• #selectAll:

• #selectMany:where:

• #selectOne:where:

Where clauses are what

the back-end needs, no something intermediate

Memory: [ :each | each key = 42 ]

Mongo: { #key->42 } asDictionary

Wednesday, June 27, 12

Page 19: Voyage - PharoConf 2012

What Voyage provides

• Common API

• Centralized management

- Preserve identity (caching live objects)

- Error handling

- Reconnection

- Pluggable connection pool

Wednesday, June 27, 12

Page 20: Voyage - PharoConf 2012

Voyage-Memory

• Is just a centralized dictionary of collections.

• Used for prototyping and early stages of development (no need to choose a persistent repository at first instance)

• Works for “stateless” applications which need readonly data (I made one once, yes)

Wednesday, June 27, 12

Page 21: Voyage - PharoConf 2012

Voyage-Mongo

• Uses MongoTalk

• Adds

- Object cache

- Error handling/reconnection

- Transparent mapping (magritte guided)

Wednesday, June 27, 12

Page 22: Voyage - PharoConf 2012

Magritte-Mongo• “Object-Document mapper”

• Magritte base implementation is intended to UI and there is some difference with mongo needs.

- Explicit (static) declaration vs. dynamic type inference. (i.e. Pier persistence is nearly impossible with an explicit declaration approach)

• I changed it a lot since Norbert saw him (more and more inference... and still needs more)

Wednesday, June 27, 12

Page 23: Voyage - PharoConf 2012

Serializer

Wednesday, June 27, 12

Page 24: Voyage - PharoConf 2012

Serializer

Wednesday, June 27, 12

Page 25: Voyage - PharoConf 2012

Serializer

Wednesday, June 27, 12

Page 26: Voyage - PharoConf 2012

Serializer

• Uses become, so yes, it is slow

• So far, no need more speed.

• Other possible approaches: Two phases (mark and persist)

Wednesday, June 27, 12

Page 27: Voyage - PharoConf 2012

Status

✓First version working (make it work)

• Need cleanup (make it right)

• Need some optimization (make it fast)

Wednesday, June 27, 12

Page 28: Voyage - PharoConf 2012

Future

• Finish it (collaborators would be fine :)

• Add/Update some backends (Just if/when needed)

- Fuel

- Phriak

- Glorp?

Wednesday, June 27, 12

Page 29: Voyage - PharoConf 2012

Voyage and PierVoyage are available at: http://smalltalkhub.com/#!/~estebanlm/Voyage

Thanks!

Already a tester who is blogging about!http://articles.tulipemoutarde.be/

Wednesday, June 27, 12