void bluesky_file_read(BlueSkyInode *inode, uint64_t offset,
char *buf, gint len);
+void bluesky_inode_flush(BlueSkyFS *fs, BlueSkyInode *inode);
+void bluesky_serialize_inode(GString *out, BlueSkyInode *inode);
+
#ifdef __cplusplus
}
#endif
g_hash_table_insert(dir->dirhash, d->name, d);
bluesky_inode_update_ctime(dir, 1);
+ bluesky_inode_flush(dir->fs, dir);
return TRUE;
}
}
bluesky_inode_update_ctime(inode, 1);
+ bluesky_inode_flush(inode->fs, inode);
}
void bluesky_file_read(BlueSkyInode *inode, uint64_t offset,
* TODO: Licensing
*/
+#include <stdio.h>
#include <stdint.h>
#include <glib.h>
#include <string.h>
g_hash_table_insert(fs->inodes, &inode->inum, inode);
g_mutex_unlock(fs->lock);
}
+
+/* Synchronize an inode to stable storage. */
+void bluesky_inode_flush(BlueSkyFS *fs, BlueSkyInode *inode)
+{
+ GString *buf = g_string_new("");
+ bluesky_serialize_inode(buf, inode);
+
+ gsize len = buf->len;
+ BlueSkyRCStr *data = bluesky_string_new(g_string_free(buf, FALSE), len);
+
+ char key[64];
+ sprintf(key, "inode-%016llx", inode->inum);
+
+ bluesky_store_put(fs->store, key, data);
+}