Persistant Objects

I’m new to this so forgive me if I’m stating the obvious but won’t the
built in Marshall module do what you need?

All the best,

jon

···

-----Original Message-----
From: David Corbin [mailto:dcorbin@imperitek.com]
Sent: 04 July 2002 15:42
To: ruby-talk ML
Subject: Persistant Objects

Is there library/framework for ruby that makes doing persistant objects
easy? At this point, I’m not in the least bit concerned about how the
back-end works (SQL, XML, proprietary). All I want is something where I

can store and reload a large conglomerate of interrelated objects with a

simple calls. I’d like to do this without an extensive learning curve,
or a lot of object customization. Support for migration between
different versions of the same classes is important.

I’ve looked through the RAA, but nothing jumped out at me. Google led
me to pstore (standard with ruby), but documentation seems to be
extremely scare on that.

Thanks for any pointers

David Corbin


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:



This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit


Any views or personal opinions expressed within this email may not be those of Talis Information Ltd.
The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.

Well, it might from my original description. I’m not sure how if it
handles multiple references to the same object. Regardless, I’ve
realized I need more flexibility than that really offers. I don’t
actually want to load all the objects up front. I want to load a
core-set of objects, and then load others “on-demand”. Ideally, these
latter ones would even get dropped from memory if not used in a certain
amount of time, though that may not be required.

J.Hawkesworth wrote:

···

I’m new to this so forgive me if I’m stating the obvious but won’t the
built in Marshall module do what you need?

All the best,

jon

-----Original Message-----
From: David Corbin [mailto:dcorbin@imperitek.com]
Sent: 04 July 2002 15:42
To: ruby-talk ML
Subject: Persistant Objects

Is there library/framework for ruby that makes doing persistant objects
easy? At this point, I’m not in the least bit concerned about how the
back-end works (SQL, XML, proprietary). All I want is something where I

can store and reload a large conglomerate of interrelated objects with a

simple calls. I’d like to do this without an extensive learning curve,
or a lot of object customization. Support for migration between
different versions of the same classes is important.

I’ve looked through the RAA, but nothing jumped out at me. Google led
me to pstore (standard with ruby), but documentation seems to be
extremely scare on that.

Thanks for any pointers

David Corbin


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk



This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp


Any views or personal opinions expressed within this email may not be those of Talis Information Ltd.
The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.

I’m on the way to write some persistance layer at the moment. An overal
design exists. At the time writing this I’m hassling with Mixins in Ruby
(as a watchful read of this list might have noticed). Following are my
design goals:

  • Make the persistence engine pluggable, so we can have
    InMemoryPersistance, DB-Persitence, XML or file persistance.

  • Build the framewort in a way that the business object aren’t coupled
    to the persistence mechanism; this will simplify testing e.g.

  • Make use of rubys meta programming capability to archive this.

Currently, my design is like this:

  • A Mixin provides a “persist(*ids)” class method which make a given id
    persitent. The perist method implements accessors to the given ids
    which simply call a read or write method on a Persistor
    Implementation. It passed to it the instace, the attribute id and the
    value.

  • The Mixin provides also a method “each” which fetches references to all
    persistet classes from the persistor.

Open issues:

  • The persistor should return only instances or children of the class which
    calls request objects on behalf of the method “each”.

Current coding look like:

require ‘persist’

class Person
# by default Persist uses a hash based Persistor
include Persist

persist :firname, :lastname   # this creates accessor proxy methods

def initialize(first, last)
	firstname=first
	lastname=last
end

end

p1 = Person.new(“Donald”, “Duck”);
p2 = Person.new(“Daisy”, “Duck”);

puts p1.lastname # calls p2.persistor.read(p2, “Daisy”)
all = Person.each # calls p2.persistor.each

Any ideas or improvements are welcome. As soon as my code is stabilized
and working with a rough DBI implementation I will make it public.

My $0.02,
-billy.

···

On Fri, Jul 05, 2002 at 12:31:17AM +0900, David Corbin wrote:

Well, it might from my original description. I’m not sure how if it
handles multiple references to the same object. Regardless, I’ve
realized I need more flexibility than that really offers. I don’t
actually want to load all the objects up front. I want to load a
core-set of objects, and then load others “on-demand”. Ideally, these
latter ones would even get dropped from memory if not used in a certain
amount of time, though that may not be required.


Meisterbohne Söflinger Straße 100 Tel: +49-731-399 499-0
eLösungen 89077 Ulm Fax: +49-731-399 499-9

No, that’s waaay more than $0.02. I can’t wait to see this.

Massimiliano

···

On Fri, Jul 05, 2002 at 02:49:37AM +0900, Philipp Meier wrote:

My $0.02,