X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fbluesky-private.h;h=a265796a0b716d32f295e5ffabd877f40c023aa8;hb=e9af23b41ae0c11245fbc6886a794e1dfb04a6bd;hp=3cabcd12d2a5454b5df3d2b440b60ca5930b8a33;hpb=db4915b4f7fc8f74958c4d1891dc69b76cbbe383;p=bluesky.git diff --git a/bluesky/bluesky-private.h b/bluesky/bluesky-private.h index 3cabcd1..a265796 100644 --- a/bluesky/bluesky-private.h +++ b/bluesky/bluesky-private.h @@ -139,43 +139,16 @@ void bluesky_store_sync(BlueSkyStore *store); void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier, BlueSkyStoreAsync *async); -void bluesky_inode_start_sync(BlueSkyInode *inode, BlueSkyStoreAsync *barrier); +void bluesky_inode_start_sync(BlueSkyInode *inode); 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, GList **log_items); -void bluesky_file_flush(BlueSkyInode *inode, BlueSkyStoreAsync *barrier, - GList **log_items); + GList **log_items); +void bluesky_file_flush(BlueSkyInode *inode, GList **log_items); void bluesky_file_drop_cached(BlueSkyInode *inode); -/* Logging infrastructure for ensuring operations are persistently recorded to - * disk. */ -#define BLUESKY_CRC32C_SEED (~(uint32_t)0) -uint32_t crc32c(uint32_t crc, const char *buf, unsigned int length); -uint32_t crc32c_finalize(uint32_t crc); - -struct _BlueSkyLog { - char *log_directory; - GAsyncQueue *queue; - int fd; - int seq_num; -}; - -typedef struct { - gboolean committed; - GMutex *lock; - GCond *cond; - char *key; - BlueSkyRCStr *data; -} BlueSkyLogItem; - -BlueSkyLog *bluesky_log_new(const char *log_directory); -BlueSkyLogItem *bluesky_log_item_new(); -void bluesky_log_item_submit(BlueSkyLogItem *item, BlueSkyLog *log); -void bluesky_log_item_finish(BlueSkyLogItem *item); - /* Writing of data to the cloud in log segments and tracking the location of * various pieces of data (both where in the cloud and where cached locally). * */ @@ -207,6 +180,8 @@ typedef enum { #define CLOUDLOG_CLOUD 0x04 typedef struct { gint refcount; + GMutex *lock; + GCond *cond; BlueSkyFS *fs; @@ -214,6 +189,7 @@ typedef struct { // Bitmask of CLOUDLOG_* flags indicating where the object exists. int location_flags; + int pending_read, pending_write; // A stable identifier for the object (only changes when authenticated data // is written out, but stays the same when the in-cloud cleaner relocates @@ -228,6 +204,7 @@ typedef struct { BlueSkyCloudPointer location; // TODO: Location in journal/cache + int log_seq, log_offset, log_size; // Pointers to other objects GArray *pointers; @@ -250,10 +227,27 @@ gchar *bluesky_cloudlog_id_to_string(BlueSkyCloudID id); BlueSkyCloudID bluesky_cloudlog_id_from_string(const gchar *idstr); void bluesky_cloudlog_ref(BlueSkyCloudLog *log); void bluesky_cloudlog_unref(BlueSkyCloudLog *log); -BlueSkyLogItem *bluesky_cloudlog_sync(BlueSkyCloudLog *log); +void bluesky_cloudlog_sync(BlueSkyCloudLog *log); void bluesky_cloudlog_insert(BlueSkyCloudLog *log); void bluesky_cloudlog_write_log(BlueSkyFS *fs); +/* Logging infrastructure for ensuring operations are persistently recorded to + * disk. */ +#define BLUESKY_CRC32C_SEED (~(uint32_t)0) +uint32_t crc32c(uint32_t crc, const char *buf, unsigned int length); +uint32_t crc32c_finalize(uint32_t crc); + +struct _BlueSkyLog { + char *log_directory; + GAsyncQueue *queue; + int fd; + int seq_num; +}; + +BlueSkyLog *bluesky_log_new(const char *log_directory); +void bluesky_log_item_submit(BlueSkyCloudLog *item, BlueSkyLog *log); +void bluesky_log_finish_all(GList *log_items); + #ifdef __cplusplus } #endif