r7177 - dumbhippo/trunk/client/common/ddm
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7177 - dumbhippo/trunk/client/common/ddm
- Date: Thu, 10 Jan 2008 11:42:42 -0600 (CST)
Author: otaylor
Date: 2008-01-10 11:42:40 -0600 (Thu, 10 Jan 2008)
New Revision: 7177
Modified:
dumbhippo/trunk/client/common/ddm/ddm-data-model.c
dumbhippo/trunk/client/common/ddm/ddm-data-model.h
dumbhippo/trunk/client/common/ddm/ddm-data-query.c
dumbhippo/trunk/client/common/ddm/ddm-data-resource-internal.h
dumbhippo/trunk/client/common/ddm/ddm-data-resource.c
dumbhippo/trunk/client/common/ddm/ddm-data-resource.h
Log:
ddm-data-model.c: #if 0 a noise debug message
ddm-data-query.c ddm-data-model.[ch] ddm-data-resource.[ch] ddm-data-resource.c:
Move code for recursive fetch marking into ddm-data-resource.c
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-model.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-model.c 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-model.c 2008-01-10 17:42:40 UTC (rev 7177)
@@ -597,7 +597,9 @@
g_hash_table_insert(model->changed_resources, resource, ddm_data_resource_ref(resource));
}
+#if 0
g_debug("Scheduling flush due to mark_changed");
+#endif
ddm_data_model_schedule_flush(model);
}
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-model.h
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-model.h 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-model.h 2008-01-10 17:42:40 UTC (rev 7177)
@@ -17,7 +17,6 @@
#define DDM_GLOBAL_RESOURCE "online-desktop:/o/global"
#define DDM_GLOBAL_RESOURCE_CLASS "online-desktop:/p/o/global"
-typedef struct _DDMDataModel DDMDataModel;
typedef struct _DDMDataModelClass DDMDataModelClass;
typedef struct _DDMDataModelBackend DDMDataModelBackend;
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-query.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-query.c 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-query.c 2008-01-10 17:42:40 UTC (rev 7177)
@@ -237,63 +237,6 @@
}
static void
-mark_received_fetches(DDMDataResource *resource,
- DDMDataFetch *fetch,
- gboolean local)
-{
- DDMDataFetchIter iter;
-
- /* For a fetch we short-circuit locally, we don't need to record
- * record any additional fetches on remote resources ... we can
- * only short-circuit a remote fetch if we already have everything
- * we need. But for a local resource (injected into the data model),
- * we want to record our fetch in resource->received_fetch, because
- * we use resource->received_fetch when calculating local interest.
- *
- * See comment in _ddm_data_resource_resolve_notification()
- */
- if (!local || ddm_data_resource_is_local(resource))
- _ddm_data_resource_fetch_received(resource, fetch);
-
- ddm_data_fetch_iter_init(&iter, resource, fetch);
-
- while (ddm_data_fetch_iter_has_next(&iter)) {
- DDMDataProperty *property;
- DDMDataFetch *children;
- DDMDataValue value;
-
- ddm_data_fetch_iter_next(&iter, &property, &children);
-
- if (children != NULL) {
- ddm_data_property_get_value(property, &value);
-
- if (DDM_DATA_BASE(value.type) == DDM_DATA_RESOURCE) { /* Could also be NONE */
- if (DDM_DATA_IS_LIST(value.type)) {
- GSList *l;
-
- for (l = value.u.list; l; l = l->next) {
- mark_received_fetches(l->data, children, local);
- }
- } else {
- mark_received_fetches(value.u.resource, children, local);
- }
- } else if (value.type == DDM_DATA_FEED) {
- if (value.u.feed != NULL) {
- DDMFeedIter feed_iter;
- DDMDataResource *item_resource;
-
- ddm_feed_iter_init(&feed_iter, value.u.feed);
- while (ddm_feed_iter_next(&feed_iter, &item_resource, NULL))
- mark_received_fetches(item_resource, children, local);
- }
- }
- }
- }
-
- ddm_data_fetch_iter_clear(&iter);
-}
-
-static void
data_query_response_internal (DDMDataQuery *query,
GSList *results,
gboolean local)
@@ -310,7 +253,7 @@
}
for (l = results; l; l = l->next) {
- mark_received_fetches(l->data, query->fetch, local);
+ ddm_data_resource_mark_received_fetches(l->data, query->fetch, !local);
}
_ddm_data_model_query_answered(query->model, query);
@@ -426,7 +369,7 @@
DDMDataResource *resource = ddm_data_model_lookup_resource(query->model, resource_id);
if (resource != NULL) {
g_debug("%s: marking fetch 'received' on errored getResource for %s'", query->id_string, resource_id);
- _ddm_data_resource_fetch_received(resource, query->fetch);
+ ddm_data_resource_fetch_received(resource, query->fetch);
}
}
}
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-resource-internal.h
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-resource-internal.h 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-resource-internal.h 2008-01-10 17:42:40 UTC (rev 7177)
@@ -28,8 +28,6 @@
void _ddm_data_resource_fetch_requested (DDMDataResource *resource,
DDMDataFetch *fetch,
guint64 serial);
-void _ddm_data_resource_fetch_received (DDMDataResource *resource,
- DDMDataFetch *received_fetch);
void _ddm_data_resource_send_local_notifications (DDMDataResource *resource,
GSList *changed_properties);
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-resource.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-resource.c 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-resource.c 2008-01-10 17:42:40 UTC (rev 7177)
@@ -462,6 +462,12 @@
resource->class_id = g_strdup(class_id);
}
+DDMDataModel *
+ddm_data_resource_get_model(DDMDataResource *resource)
+{
+ return resource->model;
+}
+
const char *
ddm_data_resource_get_resource_id (DDMDataResource *resource)
{
@@ -1824,8 +1830,8 @@
}
void
-_ddm_data_resource_fetch_received (DDMDataResource *resource,
- DDMDataFetch *received_fetch)
+ddm_data_resource_fetch_received (DDMDataResource *resource,
+ DDMDataFetch *received_fetch)
{
if (resource->received_fetch == NULL) {
resource->received_fetch = ddm_data_fetch_ref(received_fetch);
@@ -1836,6 +1842,65 @@
}
}
+void
+ddm_data_resource_mark_received_fetches(DDMDataResource *resource,
+ DDMDataFetch *fetch,
+ gboolean mark_remote_resources)
+{
+ DDMDataFetchIter iter;
+
+ /* For a fetch we short-circuit locally, we don't need to record
+ * record any additional fetches on remote resources ... we can
+ * only short-circuit a remote fetch if we already have everything
+ * we need. But for a local resource (injected into the data model),
+ * we want to record our fetch in resource->received_fetch, because
+ * we use resource->received_fetch when calculating local interest.
+ *
+ * See comment in _ddm_data_resource_resolve_notification()
+ */
+ if (mark_remote_resources || ddm_data_resource_is_local(resource))
+ ddm_data_resource_fetch_received(resource, fetch);
+
+ ddm_data_fetch_iter_init(&iter, resource, fetch);
+
+ while (ddm_data_fetch_iter_has_next(&iter)) {
+ DDMDataProperty *property;
+ DDMDataFetch *children;
+ DDMDataValue value;
+
+ ddm_data_fetch_iter_next(&iter, &property, &children);
+
+ if (children != NULL) {
+ ddm_data_property_get_value(property, &value);
+
+ if (DDM_DATA_BASE(value.type) == DDM_DATA_RESOURCE) { /* Could also be NONE */
+ if (DDM_DATA_IS_LIST(value.type)) {
+ GSList *l;
+
+ for (l = value.u.list; l; l = l->next) {
+ ddm_data_resource_mark_received_fetches(l->data, children, mark_remote_resources);
+ }
+ } else {
+ ddm_data_resource_mark_received_fetches(value.u.resource, children, mark_remote_resources);
+ }
+ } else if (value.type == DDM_DATA_FEED) {
+ if (value.u.feed != NULL) {
+ DDMFeedIter feed_iter;
+ DDMDataResource *item_resource;
+
+ ddm_feed_iter_init(&feed_iter, value.u.feed);
+ while (ddm_feed_iter_next(&feed_iter, &item_resource, NULL))
+ ddm_data_resource_mark_received_fetches(item_resource, children, mark_remote_resources);
+ }
+ }
+ }
+ }
+
+ ddm_data_fetch_iter_clear(&iter);
+}
+
+
+
static DDMDataProperty *
resource_ensure_rule_property(DDMDataResource *resource,
DDMRule *rule)
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-resource.h
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-resource.h 2008-01-10 17:40:39 UTC (rev 7176)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-resource.h 2008-01-10 17:42:40 UTC (rev 7177)
@@ -61,6 +61,8 @@
DDM_DATA_CARDINALITY_N
} DDMDataCardinality;
+typedef struct _DDMDataModel DDMDataModel; /* Avoid circular include */
+
typedef struct _DDMDataValue DDMDataValue;
typedef struct _DDMDataProperty DDMDataProperty;
typedef struct _DDMDataFetch DDMDataFetch; /* Avoid circular include */
@@ -103,9 +105,10 @@
GSList *element_node,
DDMDataValue *element);
-const char *ddm_data_resource_get_resource_id (DDMDataResource *resource);
-const char *ddm_data_resource_get_class_id (DDMDataResource *resource);
-gboolean ddm_data_resource_is_local (DDMDataResource *resource);
+DDMDataModel *ddm_data_resource_get_model (DDMDataResource *resource);
+const char * ddm_data_resource_get_resource_id (DDMDataResource *resource);
+const char * ddm_data_resource_get_class_id (DDMDataResource *resource);
+gboolean ddm_data_resource_is_local (DDMDataResource *resource);
void ddm_data_resource_get (DDMDataResource *resource,
...) G_GNUC_NULL_TERMINATED;
@@ -145,6 +148,18 @@
gboolean default_include,
const char *default_children,
DDMDataValue *value);
+/* Add the given fetch to the received fetch for a particular resource */
+void ddm_data_resource_fetch_received (DDMDataResource *resource,
+ DDMDataFetch *received_fetch);
+/* Add the given fetch to the received fetch for a particular resource, and recurse into children
+ * and add the appropriate fetches for them as well. If mark_remote_resources is FALSE, then
+ * we only do the marking for resources that are local and skip marking any resources in the
+ * tree that are remote, though we mark local children.
+ */
+void ddm_data_resource_mark_received_fetches (DDMDataResource *resource,
+ DDMDataFetch *fetch,
+ gboolean mark_remote_resources);
+
gboolean ddm_data_resource_update_feed_property (DDMDataResource *resource,
DDMQName *property_id,
DDMDataUpdate update,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]