Do not signal barrier until all notifiers have run.
[bluesky.git] / bluesky / bluesky-private.h
index 3e4d39b..852b04e 100644 (file)
@@ -47,7 +47,8 @@ typedef enum {
 } BlueSkyAsyncStatus;
 
 struct BlueSkyNotifierList;
-typedef struct {
+typedef struct _BlueSkyStoreAsync BlueSkyStoreAsync;
+struct _BlueSkyStoreAsync {
     BlueSkyStore *store;
 
     GMutex *lock;
@@ -63,11 +64,17 @@ typedef struct {
 
     int result;                 /* Result code; 0 for success. */
     struct BlueSkyNotifierList *notifiers;
+    gint notifier_count;
+
+    /* The barrier waiting on this operation.  Support for more than one
+     * barrier for a single async is not well-supported and should be avoided
+     * if possible. */
+    BlueSkyStoreAsync *barrier;
 
     bluesky_time_hires start_time;  /* Time operation was submitted. */
 
     gpointer store_private;     /* For use by the storage implementation */
-} BlueSkyStoreAsync;
+};
 
 /* Support for notification lists.  These are lists of one-shot functions which
  * can be called when certain events--primarily, competed storage
@@ -83,7 +90,7 @@ struct BlueSkyNotifierList {
 /* The abstraction layer for storage, allowing multiple implementations. */
 typedef struct {
     /* Create a new store instance and return a handle to it. */
-    gpointer (*create)();
+    gpointer (*create)(const gchar *path);
 
     /* Clean up any resources used by this store. */
     void (*destroy)(gpointer store);
@@ -100,6 +107,7 @@ void bluesky_store_register(const BlueSkyStoreImplementation *impl,
                             const gchar *name);
 
 BlueSkyStoreAsync *bluesky_store_async_new(BlueSkyStore *store);
+gpointer bluesky_store_async_get_handle(BlueSkyStoreAsync *async);
 void bluesky_store_async_ref(BlueSkyStoreAsync *async);
 void bluesky_store_async_unref(BlueSkyStoreAsync *async);
 void bluesky_store_async_wait(BlueSkyStoreAsync *async);
@@ -114,9 +122,13 @@ void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier,
 
 void bluesky_inode_start_sync(BlueSkyInode *inode, BlueSkyStoreAsync *barrier);
 
+void bluesky_block_touch(BlueSkyInode *inode, uint64_t i);
+void bluesky_block_fetch(BlueSkyFS *fs, BlueSkyBlock *block,
+                         BlueSkyStoreAsync *barrier);
 void bluesky_block_flush(BlueSkyFS *fs, BlueSkyBlock *block,
                          BlueSkyStoreAsync *barrier);
 void bluesky_file_flush(BlueSkyInode *inode, BlueSkyStoreAsync *barrier);
+void bluesky_file_drop_cached(BlueSkyInode *inode);
 
 #ifdef __cplusplus
 }