summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-07-07 13:45:06 +0200
committerYorhel <git@yorhel.nl>2013-07-07 13:47:27 +0200
commit4cec8af78b733c42fbaba553fdc478366740f607 (patch)
tree17e43e7a266011406a13a3f8f41648379cf9ed20
parentaefdfc477f0a329bef9875a7ba7b4573ccfbe21d (diff)
share/hash: Add 'Hasher" object to the API tree
Not that it does anything yet.
-rw-r--r--doc/api.pod4
-rw-r--r--src/share/conf.c1
-rw-r--r--src/share/hash.c10
-rw-r--r--src/share/hash.h2
4 files changed, 15 insertions, 2 deletions
diff --git a/doc/api.pod b/doc/api.pod
index 0275333..1a5075f 100644
--- a/doc/api.pod
+++ b/doc/api.pod
@@ -692,8 +692,8 @@ I<TODO:> Add to global object structure.
property u QueueFiles r
property t QueueSize r
- property u TotalFiles
- property t TotalSize
+ property u TotalFiles r
+ property t TotalSize r
I<TODO:> Methods/property to pause/resume hashing
diff --git a/src/share/conf.c b/src/share/conf.c
index 9bbfd3e..268e134 100644
--- a/src/share/conf.c
+++ b/src/share/conf.c
@@ -500,6 +500,7 @@ void share_manager_init() {
static const dbo_reg_t reg = { &dbo_sharem_interface, (void**)&vt, 0 };
dbo_register(&manager, MANAGER_PATH, &reg, 1);
+ share_hash_load();
share_manager_load();
share_db_load();
}
diff --git a/src/share/hash.c b/src/share/hash.c
index 9e35915..b5b2402 100644
--- a/src/share/hash.c
+++ b/src/share/hash.c
@@ -34,6 +34,9 @@
* - The stuff mentioned in api.pod
*/
+#define HASHER_PATH "/net/blicky/Globster/Hasher"
+
+
/* Maximum number of levels to keep, including root (level 0). The ADC docs
* specify that this should be at least 7, and everyone else uses 10. Since
* keeping 10 levels of hash data does eat up more space than I'd be willing to
@@ -511,4 +514,11 @@ void share_hash_destroy(share_t *s) {
}
+void share_hash_load() {
+ static const dbo_hash_vtable_t(dbo_t) vt = dbo_hash_funcs();
+ static const dbo_reg_t reg = { &dbo_hash_interface, (void**)&vt, offsetof(obj_t, props) };
+
+ dbo_register(&obj->dbo, HASHER_PATH, &reg, 1);
+}
+
/* vim: set noet sw=4 ts=4: */
diff --git a/src/share/hash.h b/src/share/hash.h
index 670a4ce..7cb9bcc 100644
--- a/src/share/hash.h
+++ b/src/share/hash.h
@@ -57,6 +57,8 @@ void share_hash_add(share_t *s, share_fl_t *fl);
/* Should be called whenever a file has been removed from the file list. */
void share_hash_remove(share_t *s, share_fl_t *fl);
+void share_hash_load();
+
#endif
/* vim: set noet sw=4 ts=4: */