Embedded Magma database

Chris Muller ma.chris.m at gmail.com
Mon Sep 15 15:12:58 UTC 2008


Hi Jerry,

> I believe I'd prefer to have my image start from a clean state with no
> existing Magma sessions.

Well, a "clean slate" would mean you start from a base image every
time and reload all the code too.  They're just objects like
everything else.  It's not any cleaner.

>   I believe that is happening now, but I'm not
> sure.   I don't save the server image, I always either quit without saving
> the image, or the server might possibly be shutdown "dirty" without any
> warning.

Magma can handle the server image being shutdown in a variety of ways,
1) saving and exiting, exiting without saving, killing the VM or
pulling the plug on the host computer.

> Another question: I have a few "long running" operations which should be
> triggered from the web application, but which should run in their own
> background process without blocking the web interface.  For example, I
> generate RSS feeds for some of my database contents.  What's the best way to
> handle this?   Currently i make a deepCopy of my target object, and fork the
> operation as a separate process with that copy.   If I need to access the
> database in that forked process, I use
>
> (WAMagma forApp: 'appName') rootAs: MyServerRoot
>
> Without the deepCopy, I believe I was attempting to access a Magma proxy
> outside of the Seaside session, and I would sometimes get magma proxy
> errors.

Not sure, I'm not familiar with WA stuff.  But the #deepCopy doesn't
sound like a good approach to me.

> I think it might be better if I passed the unique ID of my target object to
> the new process, and let it use that ID to find the target object and access
> everything from the database through "direct access" instead of using a
> deepCopy.

Well, what's the purpose of the unique ID in an ODBMS?  An ID has the
same "weight" as any object; one object pointer, so maybe you can just
pass the object iself..

> Also, how should I handle the "direct access"?  Is it ok to do a
>
> myDB := (WAMagma forApp: 'appName') rootAs: MyServerRoot
>
> the first time I need it, and then use it over and over again?

Umm, sure.

> If so, do I
> need to do an abortSession on it from time to time to keep it up to date
> with changes from the web interface?

Well, that can sometimes be useful, depending on the application..

> Perhaps I should do an abortSession
> before each time I use it?   Do I need to do anything to close that session
> when the Squeak image quits?

Connected sessions when you save the image, are reconnected
automatically when you return to the image..  See MagmaSession
class>>#connectedSessions.

> Thanks,
>
> Jerry

 - Chris

>
>
>
>
>
>
>
>
> On Sep 14, 2008, at 11:04 AM, Chris Muller wrote:
>
>> After more thinking, there is a (fairly common!) scenario where
>> developers will not feel the need to wrap the MagmaServerConsole in
>> their own application-server wrapper.  In other words, just a plain
>> vanilla Magma server image.
>>
>> In these cases, a Magma server image is simply saved and exited while
>> its running, and this can even be performed remotely ("mySession
>> serverSaveAndExit").
>>
>> Under this case, when the server image is restarted, only Magma's own
>> startUp: code re-establishes the files and sockets, your application
>> code will not have the opportunity to handle any warnings if there are
>> any.
>>
>> I will fix that..
>>
>> - Chris
>>
>>
>> On Fri, Sep 12, 2008 at 7:12 PM, Chris Muller <asqueaker at gmail.com> wrote:
>>>
>>> Hi Jerry, yes Magma may signal warnings which you will need to handle
>>> if you want to run headless.  Are you familiar with handling
>>> exceptions in Squeak?  Here is the pattern:
>>>
>>> [ ..do some squeak code.. ]
>>>  on: Warning
>>>  do:
>>>      [ : warning |
>>>      ..log the warning somewhere if you want...
>>>      warning resume ]
>>>
>>> Honestly, I'm curious why you would be receiving that particular
>>> warning..
>>>
>>>
>>>
>>> On Fri, Sep 12, 2008 at 4:15 PM, Jerry Bell <jdbell at oxfordmetamedia.com>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm building a simple web application with an embedded Magma database
>>>> which
>>>> will run on a headless Linux appliance.
>>>>
>>>> A few times while developing the system, I've had a dialog window when
>>>> starting Squeak which has asked me to OK a recovery of the Magma
>>>> database.
>>>>
>>>> Obviously I won't have a UI on this headless appliance.  What do I need
>>>> to
>>>> do to make sure all of those types of interaction are handled by my
>>>> application?
>>>>
>>>> Thanks,
>>>>
>>>> Jerry
>>>>
>>>>
>>>> _______________________________________________
>>>> Magma mailing list
>>>> Magma at lists.squeakfoundation.org
>>>> http://lists.squeakfoundation.org/mailman/listinfo/magma
>>>>
>>>
>
>
>


More information about the Magma mailing list