how to access data from dataEngine::query in javascript?

Thomas Fjellstrom tfjellstrom at shaw.ca
Tue Jun 29 18:21:29 CEST 2010


On June 29, 2010, Aaron J. Seigo wrote:
> On June 29, 2010, Thomas Fjellstrom wrote:
> > Basically the way the DataEngine is setup right now is each "Host
> > Source" is given a single Data Source, with a type of "source", and a
> > QStringList "hosts" property listing the hosts owned by this source.
> > After that each host that the host source provides is its own source
> > with a number of other properties (address, type, mac, name, isUp).
> 
> so there are discovery mechanisms (zeroconf, e.g.) and hosts, correct?
> given discovery mechs d1, d2 and d3 and hosts h1..h6, the DataEngine
> looks something like this:
> 
> d1
> 	hosts  = h1, h2
> d2
> 	hosts = h4, h5
> d3
> 	hosts = h6, h7
> h1
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> h2
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> h3
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> h4
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> h5
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> h6
> 	address =
> 	type =
> 	mac =
> 	name =
> 	isUp =
> 
> 
> is there any reason not just just skip the d1, d2 and d3 sources and just
> list the hosts directly? does the visualiation need to list "all hosts
> that were found using libvirt" such that it warrants the above
> structure?

It is not absolutely necessary. But I can see wanting to group by type. I'm 
not sure you want your virtual machines mixed up with manual hosts, or with 
the dynamic ones. I was also planning on adding a "cache source" of sorts to 
remember hosts that the zeroconf or other dynamic sources have forgotten 
about for one reason or another (ie: the machine is off, but you may want to 
turn it back on from the plasmoid using WoL), but you may not want to have 
them shown all the time. Imagine it displayed using a layout similar to a 
tree, except without the branches or anything. Just headers and items that 
collapse into the header on command.

> 
> to me, it would seem more natural to just list the hosts and the
> visualization can initially iterate over all sources() and then connect
> to the sourceAdded and sourceRemoved signals to be notified when hosts
> come and go.
> 
> that would resolve your issue fairly neatly?

It is the first design I thought of. I'm not entirely convinced that 
grouping is necessary, but if you have a lot of hosts, you may want to hide 
entire groups of them. With libvirt and Zeroconf/DNDSD sources you could 
easily have many tens, or hundreds of hosts just appear if you walk into an 
office building, a data center, or you're sharing a busy wifi network that 
happens to have wifi-separation turned off. And you may also be interested 
in /some/ of those hosts but not all, so you may not want to turn off the 
dynamic sources. 

-- 
Thomas Fjellstrom
tfjellstrom at shaw.ca


More information about the Plasma-devel mailing list