This all looks good.
Could you give more explanation to what the different ATTR_ enums mean?
Regards
-steve
On Thu, 2009-07-30 at 20:33 +1200, Angus Salkeld wrote:
> Hi all
>
> Thanks for all the feedback, here is the next iteration of objdb.h.
>
> Major changes:
> - a more object oriented API
> - add transactions
> - (reluctantly) allow objects with the same name at the same level.
> - add support for object unlinking, retention duration & expiration timeout.
>
> -Angus
>
>
> typedef enum {
> OBJECT_TRACK_DEPTH_ONE,
> OBJECT_TRACK_DEPTH_RECURSIVE
> } objdb_track_depth_t;
>
> typedef enum {
> OBJDB_OBJECT_CREATE,
> OBJDB_OBJECT_DELETE,
> OBJDB_KEY_CREATE,
> OBJDB_KEY_REPLACE,
> OBJDB_KEY_DELETE,
> OBJDB_KEY_READ,
> OBJDB_KEY_WRITE,
> OBJDB_VALIDATE_OBJECT_CREATE,
> OBJDB_VALIDATE_OBJECT_DELETE,
> OBJDB_VALIDATE_KEY_CREATE,
> OBJDB_VALIDATE_KEY_REPLACE,
> OBJDB_VALIDATE_KEY_DELETE
> } objdb_callback_type_t;
>
> typedef enum {
> OBJDB_OPTION_RETENTION_DURATION,
> OBJDB_OPTION_EXPIRATION_TIMEOUT,
> } objdb_object_option_t;
>
> #define OBJDB_ATTR_MEMORY 0x01
> #define OBJDB_ATTR_PERSISTENT 0x02
> #define OBJDB_ATTR_RUNTIME 0x04
> #define OBJDB_ATTR_READONLY 0x08
> #define OBJDB_ATTR_READWRITE 0x10
>
> typedef int (*objdb_callback_fn_t) (
> const char *path_pt,
> objdb_callback_type_t type,
> const void *value, size_t value_len,
> void *priv_data_pt);
>
>
> typedef struct {
> hdb_handle_t *handle,
> char * path;
>
> /**
> * get a key value from this object.
> */
> int (*get)(char * name, void * value, int * value_len);
> /**
> * set a key value from this object.
> */
> int (*set)(char * name, const void * value, int value_len);
>
> /**
> * After creating an object set your self as the implementor for
> * this object.
> * @param cb pass in the validation and commit callbacks.
> */
> int (*set_implementor)(objdb_callback_fn_t cb);
>
> /**
> * create an object with the given path and attributes.
> * @code
> * cs = trans->object_request("/clusters", OBJDB_ATTR_MEMORY);
> * c1 = cs->create_child_object ("cluster", OBJDB_ATTR_MEMORY);
> * c1->set("field", "value1", 7);
> * c2 = cs->create_child_object ("cluster", OBJDB_ATTR_MEMORY);
> * c2->set("field", "value2", 7);
> * trans->commit();
> * @endcode
> */
> objdb_object_t * (*create_child_object)(char * name, uint8_t
> attributes);
>
> /**
> * Request this object to be deleted (once all applications have
> * dereferenced it).
> */
> int (*unlink)(void);
>
> /**
> * set object options
> */
> int (*set_option) (objdb_object_option_t option, int value);
>
> /* iterators */
> objdb_object_t * (*get_first_object)(void);
> objdb_object_t * (*get_next_object)(void);
>
> objdb_object_t * (*get_first_key)(char *name, void *value, int
> *value_len);
> objdb_object_t * (*get_next_key)(char *name, void *value, int
> *value_len);
>
> } objdb_object_t;
>
> typedef struct {
>
> /**
> * lookup the object, add a reference count to it and allocate a
> * objdb_object_t.
> * @return return null if the obj can't be found.
> */
> objdb_object_t * (*object_request)(char * path);
>
> /**
> * dereference the object and free the objdb_object_t struct.
> */
> void (*object_release)(objdb_object_t * obj);
>
> /**
> * create an object with the given path and attributes.
> */
> objdb_object_t * (*object_create)(char * path, uint8_t attributes);
>
> /**
> * commit any pending changes made within this transaction.
> */
> int (*commit)(void);
>
> /* TODO search API goes here. */
>
> } objdb_transaction_t;
>
>
> struct objdb_iface_ver_2_0 {
> int (*objdb_init) (void);
>
> /**
> * create a new transaction to access the objdb.
> */
> objdb_transaction_t * (*trans_new)(void);
>
> /**
> * release a transaction.
> * If there are any uncommitted changes they will be discarded.
> */
> void (*trans_release)(objdb_transaction_t * trans);
>
> int (*track_start) (
> const char *path,
> hdb_handle_t *track_handle,
> objdb_track_depth_t depth,
> objdb_callback_fn_t data_changed_notify_fn,
> void * priv_data_pt);
>
> void (*track_stop) (hdb_handle_t track_handle);
>
> };
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais