g_mutex_lock(map->lock);
map->cond = g_cond_new();
map->filename = g_strdup(logname);
+ map->log_dir = clouddir;
map->log_seq = log_seq;
map->log = log;
g_atomic_int_set(&map->mapcount, 0);
static void cloudlog_partial_fetch_complete(BlueSkyStoreAsync *async,
BlueSkyCacheFile *cachefile)
{
- g_print("Partial fetch of %s from cloud complete, status = %d\n",
+ g_print("Fetch of %s from cloud complete, status = %d\n",
async->key, async->result);
g_mutex_lock(cachefile->lock);
if (async->result >= 0) {
+ if (async->len == 0) {
+ g_print("Complete object was fetched.\n");
+ cachefile->complete = TRUE;
+ }
+
/* Descrypt items fetched and write valid items out to the local log,
* but only if they do not overlap existing objects. This will protect
* against an attack by the cloud provider where one valid object is
BlueSkyRangeset *items = bluesky_rangeset_new();
int fd = openat(cachefile->log->dirfd, cachefile->filename, O_WRONLY);
if (fd >= 0) {
+ gboolean allow_unauth;
async->data = bluesky_string_dup(async->data);
+ allow_unauth = cachefile->log_dir == BLUESKY_CLOUD_DIR_CLEANER;
bluesky_cloudlog_decrypt(async->data->data, async->data->len,
- cachefile->fs->keys, items);
+ cachefile->fs->keys, items, allow_unauth);
uint64_t item_offset = 0;
while (TRUE) {
const BlueSkyRangesetItem *item;