X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fbluesky-private.h;h=20079daae419028ea0777e885effcf3af106523e;hb=afc95f0ab2900a311802028f1b811867fa3c0c31;hp=2f69166af7989525bc07988780b284f47008b333;hpb=772058dfc33fbe4857864b4bdb8ba947eca19303;p=bluesky.git diff --git a/bluesky/bluesky-private.h b/bluesky/bluesky-private.h index 2f69166..20079da 100644 --- a/bluesky/bluesky-private.h +++ b/bluesky/bluesky-private.h @@ -138,6 +138,10 @@ struct BlueSkyStoreAsync { bluesky_time_hires exec_time; /* Time processing started on operation. */ gpointer store_private; /* For use by the storage implementation */ + + /* If storage operations should be charged to any particular profile, which + * one? */ + BlueSkyProfile *profile; }; /* Support for notification lists. These are lists of one-shot functions which @@ -203,6 +207,12 @@ void bluesky_file_drop_cached(BlueSkyInode *inode); * various pieces of data (both where in the cloud and where cached locally). * */ +/* Eventually we'll want to support multiple writers. But for now, hard-code + * separate namespaces in the cloud for the proxy and the cleaner to write to. + * */ +#define BLUESKY_CLOUD_DIR_PRIMARY 0 +#define BLUESKY_CLOUD_DIR_CLEANER 1 + typedef struct { char bytes[16]; } BlueSkyCloudID; @@ -315,6 +325,12 @@ struct BlueSkyCloudLogState { GList *inode_list; GSList *writeback_list; // Items which are being serialized right now GList *pending_segments; // Segments which are being uploaded now + + /* What is the most recent sequence number written by the cleaner which we + * have processed and incorporated into our own log? This gets + * incorporated into the version vector written out with our checkpoint + * records. */ + int latest_cleaner_seq_seen; }; gboolean bluesky_cloudlog_equal(gconstpointer a, gconstpointer b); @@ -332,6 +348,7 @@ void bluesky_cloudlog_sync(BlueSkyCloudLog *log); void bluesky_cloudlog_insert(BlueSkyCloudLog *log); void bluesky_cloudlog_insert_locked(BlueSkyCloudLog *log); BlueSkyCloudLog *bluesky_cloudlog_get(BlueSkyFS *fs, BlueSkyCloudID id); +void bluesky_cloudlog_prefetch(BlueSkyCloudLog *log); void bluesky_cloudlog_fetch(BlueSkyCloudLog *log); BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log, BlueSkyFS *fs); @@ -382,11 +399,13 @@ struct BlueSkyCacheFile { gint mapcount; // References to the mmaped data const char *addr; // May be null if data is not mapped in memory size_t len; + int disk_used; BlueSkyFS *fs; BlueSkyLog *log; gboolean fetching, ready; // Cloud data: downloading or ready for use int64_t atime; // Access time, for cache management BlueSkyRangeset *items; // Locations of valid items + BlueSkyRangeset *prefetches;// Locations we have been requested to prefetch }; BlueSkyLog *bluesky_log_new(const char *log_directory); @@ -395,13 +414,13 @@ void bluesky_log_finish_all(GList *log_items); BlueSkyCloudLog *bluesky_log_get_commit_point(BlueSkyFS *fs); void bluesky_log_write_commit_point(BlueSkyFS *fs, BlueSkyCloudLog *marker); -BlueSkyRCStr *bluesky_log_map_object(BlueSkyFS *fs, int log_dir, int log_seq, - int log_offset, int log_size); +BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_data); void bluesky_mmap_unref(BlueSkyCacheFile *mmap); void bluesky_cachefile_unref(BlueSkyCacheFile *cachefile); BlueSkyCacheFile *bluesky_cachefile_lookup(BlueSkyFS *fs, - int clouddir, int log_seq); + int clouddir, int log_seq, + gboolean start_fetch); void bluesky_cachefile_gc(BlueSkyFS *fs); void bluesky_replay(BlueSkyFS *fs);