BlueSkyRCStr *bluesky_string_dup(BlueSkyRCStr *string);
void bluesky_string_resize(BlueSkyRCStr *string, gsize len);
-/* Cryptographic operations. */
-#define CRYPTO_BLOCK_SIZE 16 /* 128-bit AES */
-#define CRYPTO_KEY_SIZE 16
-#define CRYPTO_HASH_SIZE 32 /* SHA-256 */
-
-struct BlueSkyCryptKeys {
- uint8_t encryption_key[CRYPTO_KEY_SIZE];
- uint8_t authentication_key[CRYPTO_HASH_SIZE];
-};
-
-void bluesky_crypt_init();
-void bluesky_crypt_hash_key(const char *keystr, uint8_t *out);
-void bluesky_crypt_random_bytes(guchar *buf, gint len);
-BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key);
-BlueSkyRCStr *bluesky_crypt_decrypt(BlueSkyRCStr *in, const uint8_t *key);
-
/* Storage interface. This presents a key-value store abstraction, and can
* have multiple implementations: in-memory, on-disk, in-cloud. */
struct _BlueSkyStore;
/* Filesystem state. Each filesystem which is exported is represented by a
* single bluesky_fs structure in memory. */
+struct BlueSkyCryptKeys;
+
typedef struct {
GMutex *lock;
BlueSkyLog *log;
BlueSkyCloudLogState *log_state;
+ /* Filesystem crypto keys */
+ char *master_key;
+ struct BlueSkyCryptKeys *keys;
+
/* Accounting for memory used for caches. Space is measured in blocks, not
* bytes. Updates to these variables must be made atomically. */
gint cache_dirty;
/* The inode map, which maps inode numbers to the location of the most
* recent version. */
GSequence *inode_map;
+
+ /* Queue for asynchronous cloudlog unrefs, where needed. */
+ GAsyncQueue *unref_queue;
+
+ /* Thread pool for asynchronous inode fetches */
+ GThreadPool *inode_fetch_thread_pool;
} BlueSkyFS;
/* Inode number of the root directory. */
BlueSkyRCStr *dirty; /* if DIRTY: raw data in memory */
} BlueSkyBlock;
-BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store);
+BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store,
+ const gchar *master_key);
gboolean bluesky_inode_is_ready(BlueSkyInode *inode);