minix/servers/ds/store.h
Ben Gras 3512a86b44 . DS understands publishing and subscribing where keys are in string
form. Subscriptions are regular expressions.
 . different types are stored per key; currently u32 and/or string.
   the same key can be referenced (publish, subscribe, check) as any type.
 . notify()s are sent when subscriptions are triggered (publishing or
   updating of matching keys); optionally, a subscribe flag sends
   updates for all matching keys at subscription time, instead of only
   after updates after subscribing
 . all interfacing to ds is in /usr/src/lib/syslib/ds.c.
 . subscribe is ds_subscribe
   publish functions are ds_publish_<type>
   retrieve functions are ds_retrieve_<type> (one-time retrieval of a value)
   check functions are ds_check_<type> (check for updated key caller
      subscribes to not yet checked for, or ESRCH for none)
 . ramdisk driver updated with new ds interface
2006-07-13 14:50:23 +00:00

33 lines
948 B
C

/* Type definitions for the Data Store Server. */
#include <sys/types.h>
#include <minix/sys_config.h>
#include <minix/ds.h>
#include <minix/bitmap.h>
#include <regex.h>
/* Constants for the Data Store Server. */
#define NR_DS_KEYS 64 /* reserve space for so many items */
#define NR_DS_SUBS (4*_NR_SYS_PROCS) /* .. and so many subscriptions */
/* Types. */
struct data_store {
int ds_flags; /* flags for this store, includes type info */
char ds_key[DS_MAX_KEYLEN]; /* key to lookup information */
union {
u32_t ds_val_u32; /* u32 data (DS_TYPE_U32) */
char ds_val_str[DS_MAX_VALLEN]; /* string data (DS_TYPE_STR) */
} ds_val;
/* out of date subscribers. */
bitchunk_t ds_old_subs[BITMAP_CHUNKS(NR_DS_SUBS)];
};
struct subscription {
int sub_flags; /* flags for this subscription */
regex_t sub_regex; /* regular expression agains keys */
endpoint_t sub_owner; /* who is subscribed */
};