Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Async issue with Persistence.js & Node.js
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sudhakar Fomra  
View profile  
 More options Apr 11 2012, 7:12 am
From: Sudhakar Fomra <sfo...@gmail.com>
Date: Wed, 11 Apr 2012 04:12:24 -0700 (PDT)
Local: Wed, Apr 11 2012 7:12 am
Subject: Async issue with Persistence.js & Node.js

Hey Zef,

So in my project am using persistence.js to sync databases on mobile
devices with dbs on a node.js server and my server is required to host
multiple DBs.

The mobile app I am developing might call the server for synching with a
particular DB. So at any point of time AppA running on a phone could call
server to synch with DB1 and at the same time AppB could make a call (from
another phone) to sync with DB2.

My question here is will persistence.js perform well in such a scenario, as
we know Persistence.js is essentially a singleton. How will it handle 2
concurrent requests to different DBs??? And should I alter the code for
such a scenario... Hope my question is clear...

Cheers,
SF.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mason  
View profile  
 More options Jun 30 2012, 6:52 am
From: Mason <aladd...@gmail.com>
Date: Sat, 30 Jun 2012 03:52:44 -0700 (PDT)
Local: Sat, Jun 30 2012 6:52 am
Subject: Re: Async issue with Persistence.js & Node.js

Hi Sudhakar,

What's going on in your project? I have the exactly same requirement to
sync DBs between devices. I tested persisntence serer sync, and also found
some issues. Are you going to contribute to github or create a new branch?

Thanks,
Mason


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark M. Young  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 4:57 pm
From: "Mark M. Young" <milburn.yo...@gmail.com>
Date: Mon, 9 Jul 2012 15:57:16 -0500
Local: Mon, Jul 9 2012 4:57 pm
Subject: Re: [persistence.js] Re: Async issue with Persistence.js & Node.js
Sudhakar and Mason,

If you don't mind using jQuery, what about something like this?
<code>
var PersistenceJS = function(dbname, description, size)
{
    jQuery.extend(true, this, persistence);
    this.store.websql.config(this, dbname, description, size);

};

PersistenceJS.prototype = new Object();
PersistenceJS.prototype.constructor = PersistenceJS;
</code>
<code>
$(document).ready( function()
{
    var dbA = new PersistenceJS('dba', 'DBA', 1024 * 1024);
    dbA.debug = true;
    var EntityA = dbA.define('EntityA', {});
    EntityA.enableSync();

    var dbB = new PersistenceJS('dbb', 'DBB', 1024 * 1024);
    dbB.debug = true;
    var EntityB = dbB.define('EntityB', {});
    EntityB.enableSync();

    dbA.schemaSync( function()
    {
        console.log('DBA schema synced');
        dbA.add( new EntityA());
        dbA.flush('DBA flushed');
        dbB.schemaSync( function()
        {
            console.log('DBB schema synced');
            dbB.add( new EntityB());
            dbB.flush('DBB flushed');
        });
    });

});

</code>
Regards,
Mark M. Young

On 6/30/12, Mason <aladd...@gmail.com> wrote:

--
"When pride comes, then comes disgrace, but with humility comes wisdom."
—Proverbs 11:2

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark M. Young  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 5:03 pm
From: "Mark M. Young" <milburn.yo...@gmail.com>
Date: Mon, 9 Jul 2012 16:03:57 -0500
Local: Mon, Jul 9 2012 5:03 pm
Subject: Re: [persistence.js] Re: Async issue with Persistence.js & Node.js
If you want to use different stores across DBs, you can pass it as a parameter.
<code>
var PersistenceJS = function(dbname, description, size, store)
{
    store = store || 'websql';
    if( store in this.store )
    {
        jQuery.extend(true, this, persistence);
        this.store[store].config(this, dbname, description, size);
    }
    else
    {
        console.error( "Unknown PersistenceJS store '" + store "'." );
    }
};

</code>
Regards,
Mark M. Young

--
"When pride comes, then comes disgrace, but with humility comes wisdom."
—Proverbs 11:2


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark M. Young  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 5:09 pm
From: "Mark M. Young" <milburn.yo...@gmail.com>
Date: Mon, 9 Jul 2012 16:09:14 -0500
Local: Mon, Jul 9 2012 5:09 pm
Subject: Re: [persistence.js] Re: Async issue with Persistence.js & Node.js
I posted prematurely--I found a logic error and a syntax error.
var PersistenceJS = function(dbname, description, size, store)
{
    store = store || 'websql';
    jQuery.extend(true, this, persistence);
    if( store in this.store )
    {
        this.store[store].config(this, dbname, description, size);
    }
    else
    {
        console.error( "Unknown PersistenceJS store '" + store + "'." );
    }
};

Regards,
Mark M. Young

On 7/9/12, Mark M. Young <milburn.yo...@gmail.com> wrote:

--
"When pride comes, then comes disgrace, but with humility comes wisdom."
—Proverbs 11:2

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »