From: Martin Mares Date: Sun, 12 Jan 2003 17:36:53 +0000 (+0000) Subject: Added function for measuring bucket file size (as an oid) and used it X-Git-Tag: holmes-import~1307 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=cb0d339ba7cb41e474294d873fc1f7a86ea6fb08;p=libucw.git Added function for measuring bucket file size (as an oid) and used it for better progress indicator in the scanner. --- diff --git a/lib/bucket.c b/lib/bucket.c index aff99310..9be78b28 100644 --- a/lib/bucket.c +++ b/lib/bucket.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- Object Buckets * - * (c) 2001--2002 Martin Mares + * (c) 2001--2003 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -272,6 +272,13 @@ obuck_fetch_end(struct fastbuf *b UNUSED) { } +oid_t +obuck_predict_last_oid(void) +{ + sh_off_t size = sh_seek(obuck_fd, 0, SEEK_END); + return size >> OBUCK_SHIFT; +} + struct fastbuf * obuck_create(void) { diff --git a/lib/bucket.h b/lib/bucket.h index 798e9a9a..81145523 100644 --- a/lib/bucket.h +++ b/lib/bucket.h @@ -1,7 +1,7 @@ /* * Sherlock Library -- Object Buckets * - * (c) 2001 Martin Mares + * (c) 2001--2003 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -45,6 +45,7 @@ void obuck_sync(void); /* Flush all buffers to disk */ void obuck_lock_read(void); /* Explicit locking to make sure other threads don't touch buckets now */ void obuck_lock_write(void); void obuck_unlock(void); +oid_t obuck_predict_last_oid(void); /* Get OID corresponding to the next to be created bucket (i.e., bucket file size estimate) */ /* Searching for buckets */ void obuck_find_by_oid(struct obuck_header *hdrp);