+/* Read the given block from cloud-backed storage if the data is not already
+ * cached. */
+void bluesky_block_fetch(BlueSkyFS *fs, BlueSkyBlock *block)
+{
+ if (block->type != BLUESKY_BLOCK_REF)
+ return;
+
+ g_print("Fetching block from %s\n", block->ref);
+ BlueSkyRCStr *string = s3store_get(fs->store, block->ref);
+
+ g_free(block->data);
+ block->data = g_memdup(string->data, BLUESKY_BLOCK_SIZE);
+ block->type = BLUESKY_BLOCK_CACHED;
+ bluesky_string_unref(string);
+}
+