batching gets and searching



Hi,

I forgot one very basic suggestion in my recent mails: an API to
get multiple keys in a single request.

It is not entirely straightforward to define this as an extension
to the current API - I have a variety of proposals:

- int gconf_value_group_get( GConfEntry *group, int nentries );

  assuming that each of the GConfEntry items in group have been
  initialised with a full key, the API will set the GConfValue
  member in each GConfEntry and return the number of keys
  found.

- If it is desired to keep the keys in GConfEntry without a
  directory (bar, not /foo/bar), then this API morphs to

  int gconf_value_group_get( const gchar *directory, GConfEntry *group,
       int nentries );
 
  in which case it is limited to getting keys from a single directory.
  
- int gconf_value_group_get( GConfValue **group, const char **keys, int nkeys );

  Same idea, just that the keys are in a separate array and GConfValue pointers
  are set by the API.


Alternatively, it would be possible to extend the notion of GConfChangeSet
to also include gets.

One other API we need when creating a GConf GUI is the ability to search
recursively through keys and values. For efficiency, a search must be
done on the server (gconfd) side. I suggest:

GConfSearch *gconf_search_new (
 const gchar *key_root,       /* directory to search from */
 const gchar *search_value,   /* expression to search for */
 int flags, /* GCONF_SEARCH_KEY | GCONF_SEARCH_VALUE | ... */
 int depth, /* -1 = unlimited, 0 => no directories, 1 => 1 directory deep, ... 
*/
 );
 GSList *gconf_search_apply ( GConfSearch *search,
   int maxkeys /* maximum number of keys to retrieve, < 1 implies limited only
     by system limits */
  );
 GConfEntry *gconf_search_next (GConfSearch *search); /* returns the first or
   next value; the state of the search is maintained to ensure a linear
   breadth-first search of the tree is carried out */
 void gconf_search_destroy (GConfSearch *search); /* destroys all resources
   associated with this search, including memory allocated to search struct */
   
I'd welcome feedback!

Colm.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]