why is server.from not supported for the localhost?

23 views
Skip to first unread message

Scott Erholm

unread,
Mar 27, 2017, 12:04:12 PM3/27/17
to zetta-discuss
In trying to make an app which will run anywhere, I'd like to write a device query something like:

var devQuery = this.server.from(serverName).where({name:deviceName});

This works fine when serverName is the name of a remote peer.  It does not work when serverName is the name of the localhost hub server.

For example, if the local hub name is foo, then server.from('foo') does not match when running on the hub itself.  Is this behavior intentional, and if so, why?

Thanks,
Scott

Adam Magaluk

unread,
Mar 27, 2017, 12:13:24 PM3/27/17
to Scott Erholm, zetta-discuss
This behavior is intentional. When querying from the local server leave out the .from() syntax. It should just be var devQuery = this.server.where({name:deviceName});

Don't have a great reason why we choose to do it that way but we added the remote queries after the local queries where already in place so we decided to add the .from() as the syntax for getting remote servers devices.

--
You received this message because you are subscribed to the Google Groups "zetta-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zetta-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to zetta-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zetta-discuss/bd5ff564-5964-4b00-8afb-2af6e304a684%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Adam Magaluk | Software Engineer | adamm...@google.com | 248-842-0885

Scott Erholm

unread,
Mar 27, 2017, 12:49:47 PM3/27/17
to zetta-discuss, sc...@agilatech.com
Okay.  Thanks for the answer (and amazingly fast as always).

I've run up against this in other aspects before.  I can certainly put some additional logic around the query so that if the device is on the local server, then we leave off the .from() clause.
It would seem to make sense to allow the .from() clause in any domain, similar to SQL if the database name is specified in the query even when the database name is the same as the database in use.  A related issue (which I've posted on in the past) is a query that uses from('*') does not pick up the local server. 

It's good to see that zetta and the support here and elsewhere has not been abandoned or cancelled after the Google acquisition!

Thanks,
Scott


On Monday, March 27, 2017 at 10:13:24 AM UTC-6, Adam Magaluk wrote:
This behavior is intentional. When querying from the local server leave out the .from() syntax. It should just be var devQuery = this.server.where({name:deviceName});

Don't have a great reason why we choose to do it that way but we added the remote queries after the local queries where already in place so we decided to add the .from() as the syntax for getting remote servers devices.

Adam Magaluk

unread,
Mar 27, 2017, 6:14:21 PM3/27/17
to Scott Erholm, zetta-discuss
Totally agree on both points, just something that needs to an issued filed in GH and fixed.

--
You received this message because you are subscribed to the Google Groups "zetta-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zetta-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to zetta-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages