{
int64_t size = 0;
list<string> object_list;
+ const char *status = NULL; /* Status indicator printed out */
/* Look up this file in the old stat cache, if we can. If the stat
* information indicates that the file has not changed, do not bother
const ObjectReference &ref = *i;
if (!db->IsAvailable(ref)) {
cached = false;
+ status = "repack";
break;
}
}
/* If the file is new or changed, we must read in the contents a block at a
* time. */
if (!cached) {
- printf(" [new]\n");
-
SHA1Checksum hash;
while (true) {
ssize_t bytes = file_read(fd, block_buf, LBS_BLOCK_SIZE);
* Additionally, keep track of the age of the data by looking
* up the age of the block which was expired and using that
* instead of the current time. */
- if (db->IsOldObject(block_csum, bytes, &block_age))
+ if (db->IsOldObject(block_csum, bytes, &block_age)) {
o->set_group("compacted");
- else
+ if (status == NULL)
+ status = "partial";
+ } else {
o->set_group("data");
+ status = "new";
+ }
o->set_data(block_buf, bytes);
o->write(tss);
segment_list.insert(ref.get_segment());
db->UseObject(ref);
size += bytes;
+
+ if (status == NULL)
+ status = "old";
}
file_info["checksum"] = hash.checksum_str();
}
+ if (status != NULL)
+ printf(" [%s]\n", status);
+
statcache->Save(path, &stat_buf, file_info["checksum"], object_list);
/* For files that only need to be broken apart into a few objects, store