summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_private.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-05-23 18:18:00 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-06-23 13:47:07 +0200
commita257259b05d62ebe548b6c798a3aa03a97dbc0c2 (patch)
treeaf4cc3c4e1e109bcf25b673ce06beb85a2a4536d /src/db/sysdb_private.h
parentdd285415d7a8d8376207960cfa3e977524c3b98c (diff)
downloadsssd-a257259b05d62ebe548b6c798a3aa03a97dbc0c2.tar.gz
sssd-a257259b05d62ebe548b6c798a3aa03a97dbc0c2.tar.xz
sssd-a257259b05d62ebe548b6c798a3aa03a97dbc0c2.zip
SYSDB: If modifyTimestamp is the same, only update the TS cache
Resolves: https://fedorahosted.org/sssd/ticket/2602 If the entry being saved contains the original modifyTimestamp attribute and the modifyTimestamp attribute is the same as the one we already saved to the timestamp cache, only the expire timestamps in the asynchronous timestamp cache will be bumped and the sysdb code will avoid writes to the main cache completely. If the modifyTimestamp is either missing or differs, we assume the entry had changed and do a full write to the main cache. Also amends the generic sysdb_set_attrs* and similar functions that their results is also reflected in the timestamps cache. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/db/sysdb_private.h')
-rw-r--r--src/db/sysdb_private.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
index dae348b0b..9d03d59f0 100644
--- a/src/db/sysdb_private.h
+++ b/src/db/sysdb_private.h
@@ -194,6 +194,18 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
*/
bool is_ts_ldb_dn(struct ldb_dn *dn);
+/* Returns true if the attrname is an attribute we store to the timestamp
+ * cache, false if it's a sysdb-only attribute
+ */
+bool is_ts_cache_attr(const char *attrname);
+
+/* Returns a subset of attrs that only contains the attributes we store to
+ * the timestamps cache. Useful in generic functions that set some attributes
+ * and we want to mirror that change in the timestamps cache
+ */
+struct sysdb_attrs *sysdb_filter_ts_attrs(TALLOC_CTX *mem_ctx,
+ struct sysdb_attrs *attrs);
+
/* Given a ldb_result found in the timestamp cache, merge in the
* corresponding full attributes from the sysdb cache. The new
* attributes are allocated on the messages in the ldb_result.
@@ -239,4 +251,17 @@ int sysdb_search_ts_groups(TALLOC_CTX *mem_ctx,
size_t *msgs_count,
struct ldb_message ***msgs);
+/* Compares the modifyTimestamp attribute between old_entry and
+ * new_entry. Returns true if they differ (or either entry is missing
+ * the attribute) and false if the attribute is the same
+ */
+bool sysdb_msg_attrs_modts_differs(struct ldb_message *old_entry,
+ struct sysdb_attrs *new_entry);
+
+/* Given a sysdb_attrs pointer, returns a corresponding ldb_message */
+struct ldb_message *sysdb_attrs2msg(TALLOC_CTX *mem_ctx,
+ struct ldb_dn *entry_dn,
+ struct sysdb_attrs *attrs,
+ int mod_op);
+
#endif /* __INT_SYS_DB_H__ */