aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_indexing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-14 11:20:29 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-14 11:20:29 +0000
commitcced1cd7e8a319105177e29cc4f1720739e307bb (patch)
treefd712679c47946af449f03bf3684cc3bfa31388a /src/fs/gnunet-service-fs_indexing.c
parent5e6ff76c94890e47b51f8bd555437c0ee181e851 (diff)
downloadgnunet-cced1cd7e8a319105177e29cc4f1720739e307bb.tar.gz
gnunet-cced1cd7e8a319105177e29cc4f1720739e307bb.zip
fixes
Diffstat (limited to 'src/fs/gnunet-service-fs_indexing.c')
-rw-r--r--src/fs/gnunet-service-fs_indexing.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index f8593ffd4..363bdea41 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -101,6 +101,12 @@ static struct GNUNET_SCHEDULER_Handle *sched;
101 */ 101 */
102static const struct GNUNET_CONFIGURATION_Handle *cfg; 102static const struct GNUNET_CONFIGURATION_Handle *cfg;
103 103
104/**
105 * Datastore handle. Created and destroyed by code in
106 * gnunet-service-fs (this is an alias).
107 */
108static struct GNUNET_DATASTORE_Handle *dsh;
109
104 110
105/** 111/**
106 * Write the current index information list to disk. 112 * Write the current index information list to disk.
@@ -575,12 +581,14 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
575 if (size != sizeof (struct OnDemandBlock)) 581 if (size != sizeof (struct OnDemandBlock))
576 { 582 {
577 GNUNET_break (0); 583 GNUNET_break (0);
578 GNUNET_FS_drq_remove (key, 584 GNUNET_DATASTORE_remove (dsh,
579 size, 585 key,
580 data, 586 size,
581 &remove_cont, 587 data,
582 NULL, 588 -1, -1,
583 GNUNET_TIME_UNIT_FOREVER_REL); 589 GNUNET_TIME_UNIT_FOREVER_REL,
590 &remove_cont,
591 NULL);
584 return GNUNET_SYSERR; 592 return GNUNET_SYSERR;
585 } 593 }
586 odb = (const struct OnDemandBlock*) data; 594 odb = (const struct OnDemandBlock*) data;
@@ -608,12 +616,14 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
608 STRERROR (errno)); 616 STRERROR (errno));
609 if (fh != NULL) 617 if (fh != NULL)
610 GNUNET_DISK_file_close (fh); 618 GNUNET_DISK_file_close (fh);
611 GNUNET_FS_drq_remove (key, 619 GNUNET_DATASTORE_remove (dsh,
612 size, 620 key,
613 data, 621 size,
614 &remove_cont, 622 data,
615 NULL, 623 -1, -1,
616 GNUNET_TIME_UNIT_FOREVER_REL); 624 GNUNET_TIME_UNIT_FOREVER_REL,
625 &remove_cont,
626 NULL);
617 return GNUNET_SYSERR; 627 return GNUNET_SYSERR;
618 } 628 }
619 GNUNET_DISK_file_close (fh); 629 GNUNET_DISK_file_close (fh);
@@ -637,12 +647,14 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
637 _("Indexed file `%s' changed at offset %llu\n"), 647 _("Indexed file `%s' changed at offset %llu\n"),
638 fn, 648 fn,
639 (unsigned long long) off); 649 (unsigned long long) off);
640 GNUNET_FS_drq_remove (key, 650 GNUNET_DATASTORE_remove (dsh,
641 size, 651 key,
642 data, 652 size,
643 &remove_cont, 653 data,
644 NULL, 654 -1, -1,
645 GNUNET_TIME_UNIT_FOREVER_REL); 655 GNUNET_TIME_UNIT_FOREVER_REL,
656 &remove_cont,
657 NULL);
646 return GNUNET_SYSERR; 658 return GNUNET_SYSERR;
647 } 659 }
648#if DEBUG_FS 660#if DEBUG_FS
@@ -692,13 +704,16 @@ shutdown_task (void *cls,
692 * 704 *
693 * @param s scheduler to use 705 * @param s scheduler to use
694 * @param c configuration to use 706 * @param c configuration to use
707 * @param d datastore to use
695 */ 708 */
696int 709int
697GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s, 710GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s,
698 const struct GNUNET_CONFIGURATION_Handle *c) 711 const struct GNUNET_CONFIGURATION_Handle *c,
712 struct GNUNET_DATASTORE_Handle *d)
699{ 713{
700 sched = s; 714 sched = s;
701 cfg = c; 715 cfg = c;
716 dsh = d;
702 ifm = GNUNET_CONTAINER_multihashmap_create (128); 717 ifm = GNUNET_CONTAINER_multihashmap_create (128);
703 GNUNET_SCHEDULER_add_delayed (sched, 718 GNUNET_SCHEDULER_add_delayed (sched,
704 GNUNET_TIME_UNIT_FOREVER_REL, 719 GNUNET_TIME_UNIT_FOREVER_REL,