On Wed, Jul 30, 2008 at 01:02:36PM +0200, Stefan Schubert wrote:
I believe that our interface is too complex:
Read ( STRUCT of (Boolean, STRING, VARIANT) path, STRUCT of (Boolean, STRING, VARIANT) arg, STRUCT of (Boolean, STRING, VARIANT) opt) Execute ( STRUCT of (Boolean, STRING, VARIANT) path, STRUCT of (Boolean, STRING, VARIANT) arg, STRUCT of (Boolean, STRING, VARIANT) opt) Write( STRUCT of (Boolean, STRING, VARIANT) path, STRUCT of (Boolean, STRING, VARIANT) arg, STRUCT of (Boolean, STRING, VARIANT) opt)
The return values are not more clearlier: STRUCT of (Boolean, STRING, VARIANT) path, STRUCT of (Boolean, STRING, VARIANT) arg, STRUCT of (Boolean, STRING, VARIANT) opt, STRUCT of (Boolean, STRING, VARIANT) ret)
Yes, it is too complex. That is because the current SCR interface relies on the rich type set of YCP which is not available in DBus. For example the ini agent Write(.entry, "") writes entry="" while Write(.entry, nil) deletes the line. We figured it is better to release an early prototype than to modify the interface so that it uses only the simple DBus types.
Especial the VARIANT argument is not understandable by the user who uses this interface cause he does not know the internals.
So, if we would like to use the SCR via DBUS in other applications ( e.g. a web-service server) we should simplify the interface. I would like to have an interface like:
Read ( STRING path, STRING arg, STRING outputFormat) path: e.g. .sysconfig.console.CONSOLE_MAGIC arg: e.g. /etc/install.inf for the call SCR::Read (.target.size, "/etc/install.inf") outputFormat: XML, String, YaST, ...
Execute ( STRING path, STRING command, STRING YaSTarg, STRING outputFormat) path: e.g. .target.bash command : e.g. "/bin/touch /etc/modprobe.d/tv" YaSTarg: Special YaST arguments like $[ "C_locale" : true, "env" : $[ "LC_ALL" : "en_US" ] ] outputFormat: XML, String, YaST, YaSTBinary, ...
Write ( STRING path, STRING value )
The return value should always be a STRING with a special kind like XML, YaST, ... (defined in the arguments)
The other possibility would be to take the complete argument list into one STRING:
e.g. Write (".sysconfig.displaymanager.DISPLAYMANAGER_XSERVER, \"Xgl\") and parse it in the DBUS server.
You are proposing to pass only DBus strings and interpret them outside DBus. Another possibility is to use DBus Variants, containing strings, numbers, or nested arrays/dicts. That is what we started with, but had to add the other two bits: boolean (is-it-nil?) and string (type, distinguishing YCP "foo" from `foo and .foo)
Would this be possible? It would increase the acceptance of the API. Are there other options ? I fear otherwise no one ( with the exception of YaST) would be able to use the SCR via DBUS.
Correct. IMO we should simplify the interface and remove the YCP specific types, for example by replacing SCR::Write(.someini.crash_interval, nil) by SCR::Execute(.someini.crash_interval, "remove") -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org