len -= size;
}
+ if (checkpoint_size == 0) {
+ g_error("Unable to locate checkpoint record!\n");
+ }
+
g_print("Found checkpoint record at %zd (size %zd)\n",
checkpoint - last->data, checkpoint_size);
struct list_info {
int success;
char *last_entry;
+ gboolean truncated;
};
static S3Status s3store_get_handler(int bufferSize, const char *buffer,
g_free(info->last_entry);
info->last_entry = g_strdup(contents[contentsCount - 1].key);
}
+ info->truncated = isTruncated;
return S3StatusOK;
}
static char *s3store_lookup_last(gpointer s, const char *prefix)
{
S3Store *store = (S3Store *)s;
- struct list_info info = {0, NULL};
+ struct list_info info = {0, NULL, FALSE};
struct S3ListBucketHandler handler;
handler.responseHandler.propertiesCallback
char *marker = NULL;
- S3_list_bucket(&store->bucket, prefix, marker, NULL, 1024, NULL, &handler, &info);
+ do {
+ S3_list_bucket(&store->bucket, prefix, marker, NULL, 1024, NULL,
+ &handler, &info);
+ g_free(marker);
+ marker = g_strdup(info.last_entry);
+ g_print("Last key: %s\n", info.last_entry);
+ } while (info.truncated);
- g_print("Last key: %s\n", info.last_entry);
+ g_free(marker);
return info.last_entry;
}