diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-09-10 10:42:43 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-09-10 17:17:07 -0400 |
commit | 7f1ff81b891bc463822d09093329554691d52270 (patch) | |
tree | ec3e188f3b17ff006dcc3e075b90fe4909f3168e /common/collection/collection.h | |
parent | 5acd83d38319f3da83b1831f486a55d83b64867c (diff) | |
download | sssd-7f1ff81b891bc463822d09093329554691d52270.tar.gz sssd-7f1ff81b891bc463822d09093329554691d52270.tar.bz2 sssd-7f1ff81b891bc463822d09093329554691d52270.zip |
COLLECTION Improvements to copy functions
This patch adds better options for
copying collections in flat mode.
It allows caller of the interface
to control prefixing of the fields
when one collection is appended to another.
It also avoids creating prefixes when the
collection is simply copied in flat mode.
Also for ELAPI I realized that the most efficient
way to deal with the "resolved" event
(event where all templeted values are actually replaced
with the real values) is to add a callback
capability to a copy collection function
so that the callback can be used to modify
the data (resolve it) while the copy operation
is in progress. This approach eliminates the need
for separate set of lookups after the event
is already copied.
Diffstat (limited to 'common/collection/collection.h')
-rw-r--r-- | common/collection/collection.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/common/collection/collection.h b/common/collection/collection.h index 710e33ba..1ff038e1 100644 --- a/common/collection/collection.h +++ b/common/collection/collection.h @@ -97,13 +97,6 @@ #define COL_TRAVERSE_IGNORE 0x00000004 /* Ignore sub collections as if none * is present */ #define COL_TRAVERSE_FLAT 0x00000008 /* Flatten the collection. */ -#define COL_TRAVERSE_FLATDOT 0x00000010 /* Flatten the collection but use - * dotted notation for property names - * For example the subcollection - * named "sub" containing "foo" and - * "bar" will be flattened as: - * "sub.foo", "sub.bar". - */ /* Additional iterator flags @@ -414,13 +407,32 @@ int col_add_collection_to_collection(struct collection_item *ci, /* C struct collection_item *collection_to_add, /* Collection to add */ int mode); /* How this collection needs to be added */ -/* Create a deep copy of the current collection. */ -/* The acceptable modes are defined at the top */ +/* Create a deep copy of the current collection. + * Wraps the function below. + * The acceptable modes are defined at the top. + */ int col_copy_collection(struct collection_item **collection_copy, struct collection_item *collection_to_copy, const char *name_to_use, int copy_mode); +/* Callback used in the next function */ +typedef int (*col_copy_cb)(struct collection_item *item, + void *ext_data, + int *skip); + +/* Create a deep copy of the current collection. + * Calls caller provided callback before + * copying each item's data. + * The acceptable modes are defined at the top. + */ +int col_copy_collection_with_cb(struct collection_item **collection_copy, + struct collection_item *collection_to_copy, + const char *name_to_use, + int copy_mode, + col_copy_cb copy_cb, + void *ext_data); + /* Signature of the callback that needs to be used when traversing a collection or looking for a specific item */ typedef int (*col_item_fn)(const char *property, /* The name of the property will be passed in this parameter. */ |