[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3467 - in GNUnet/src: applications/fs/ecrs applications/fs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3467 - in GNUnet/src: applications/fs/ecrs applications/fs/tools applications/fs/uritrack include setup |
Date: |
Wed, 11 Oct 2006 13:21:26 -0700 (PDT) |
Author: grothoff
Date: 2006-10-11 13:21:23 -0700 (Wed, 11 Oct 2006)
New Revision: 3467
Modified:
GNUnet/src/applications/fs/ecrs/meta.c
GNUnet/src/applications/fs/tools/gnunet-directory.c
GNUnet/src/applications/fs/uritrack/file_info.c
GNUnet/src/include/gnunet_uritrack_lib.h
GNUnet/src/setup/gnunet-setup.c
Log:
trying to improve listURIs speed
Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2006-10-11 20:21:16 UTC (rev
3466)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2006-10-11 20:21:23 UTC (rev
3467)
@@ -613,14 +613,16 @@
}
md = ECRS_createMetaData();
+ GROW(md->items,
+ md->itemCount,
+ ic);
i = 0;
pos = sizeof(unsigned int) * ic;
while ( (pos < dataSize) &&
(i < ic) ) {
len = strlen(&data[pos])+1;
- ECRS_addToMetaData(md,
- (EXTRACTOR_KeywordType) ntohl(((unsigned int*)data)[i]),
- &data[pos]);
+ md->items[i].type = (EXTRACTOR_KeywordType) ntohl(((unsigned
int*)data)[i]);
+ md->items[i].data = STRDUP(&data[pos]);
pos += len;
i++;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-directory.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-10-11 20:21:16 UTC
(rev 3466)
+++ GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-10-11 20:21:23 UTC
(rev 3467)
@@ -183,6 +183,7 @@
printf(_("Listed %d matching entries.\n"),
URITRACK_listURIs(ectx,
cfg,
+ YES,
&printNode,
NULL));
if (do_kill) {
Modified: GNUnet/src/applications/fs/uritrack/file_info.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/file_info.c 2006-10-11 20:21:16 UTC
(rev 3466)
+++ GNUnet/src/applications/fs/uritrack/file_info.c 2006-10-11 20:21:23 UTC
(rev 3467)
@@ -156,7 +156,7 @@
fi->meta,
data,
size,
- ECRS_SERIALIZE_FULL));
+ ECRS_SERIALIZE_FULL |
ECRS_SERIALIZE_NO_COMPRESS));
size = htonl(size);
suri = ECRS_uriToString(fi->uri);
sem = createIPC(ectx, cfg);
@@ -234,10 +234,13 @@
*
* @param iterator function to call on each entry, may be NULL
* @param closure extra argument to the callback
+ * @param need_metadata YES if metadata should be
+ * provided, NO if metadata is not needed (faster)
* @return number of entries found
*/
int URITRACK_listURIs(struct GE_Context * ectx,
struct GC_Configuration * cfg,
+ int need_metadata,
ECRS_SearchProgressCallback iterator,
void *closure) {
struct IPC_SEMAPHORE *sem;
@@ -316,19 +319,24 @@
ECRS_freeUri(fi.uri);
goto FORMATERROR;
}
- fi.meta = ECRS_deserializeMetaData(ectx,
- &result[spos], msize);
- if(fi.meta == NULL) {
- GE_BREAK(ectx, 0);
- ECRS_freeUri(fi.uri);
- goto FORMATERROR;
+ if (need_metadata == YES) {
+ fi.meta = ECRS_deserializeMetaData(ectx,
+ &result[spos], msize);
+ if(fi.meta == NULL) {
+ GE_BREAK(ectx, 0);
+ ECRS_freeUri(fi.uri);
+ goto FORMATERROR;
+ }
+ } else {
+ fi.meta = NULL;
}
pos = spos + msize;
if(iterator != NULL) {
- if(OK != iterator(&fi, NULL, NO, closure)) {
- ECRS_freeMetaData(fi.meta);
+ if (OK != iterator(&fi, NULL, NO, closure)) {
+ if (fi.meta != NULL)
+ ECRS_freeMetaData(fi.meta);
ECRS_freeUri(fi.uri);
- if(0 != MUNMAP(result, buf.st_size))
+ if (0 != MUNMAP(result, buf.st_size))
GE_LOG_STRERROR_FILE(ectx,
GE_ERROR | GE_ADMIN | GE_BULK,
"munmap",
@@ -341,7 +349,8 @@
}
}
rval++;
- ECRS_freeMetaData(fi.meta);
+ if (fi.meta != NULL)
+ ECRS_freeMetaData(fi.meta);
ECRS_freeUri(fi.uri);
}
if(0 != MUNMAP(result, buf.st_size))
Modified: GNUnet/src/include/gnunet_uritrack_lib.h
===================================================================
--- GNUnet/src/include/gnunet_uritrack_lib.h 2006-10-11 20:21:16 UTC (rev
3466)
+++ GNUnet/src/include/gnunet_uritrack_lib.h 2006-10-11 20:21:23 UTC (rev
3467)
@@ -72,9 +72,13 @@
/**
* List all URIs.
+ *
+ * @param need_metadata YES if metadata should be
+ * provided, NO if metadata is not needed (faster)
*/
int URITRACK_listURIs(struct GE_Context * ectx,
struct GC_Configuration * cfg,
+ int need_metadata,
ECRS_SearchProgressCallback iterator,
void * closure); /* file_info.c */
Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c 2006-10-11 20:21:16 UTC (rev 3466)
+++ GNUnet/src/setup/gnunet-setup.c 2006-10-11 20:21:23 UTC (rev 3467)
@@ -197,6 +197,7 @@
GC_parse_configuration(cfg,
cfgFilename);
dirname = os_get_installation_path(IPK_DATADIR);
+ GE_ASSERT(ectx, dirname != NULL);
specname = MALLOC(strlen(dirname) + strlen("config-daemon.scm") + 1);
strcpy(specname, dirname);
FREE(dirname);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3467 - in GNUnet/src: applications/fs/ecrs applications/fs/tools applications/fs/uritrack include setup,
grothoff <=