Work to allow mmap-ed log entries to be used for data blocks.
[bluesky.git] / bluesky / bluesky.h
index 4b17bda..205da74 100644 (file)
@@ -64,15 +64,25 @@ void bluesky_init(void);
 gchar *bluesky_lowercase(const gchar *s);
 
 /* Reference-counted blocks of memory, used for passing data in and out of
- * storage backends and in other places. */
+ * storage backends and in other places.  This may also refer to read-only
+ * mmaped data. */
 typedef struct {
     gint refcount;
+    const char *addr;
+    size_t len;
+} BlueSkyMmap;
+
+typedef struct {
+    gint refcount;
+    BlueSkyMmap *mmap;
     gchar *data;
     gsize len;
 } BlueSkyRCStr;
 
 BlueSkyRCStr *bluesky_string_new(gpointer data, gsize len);
 BlueSkyRCStr *bluesky_string_new_from_gstring(GString *s);
+BlueSkyRCStr *bluesky_string_new_from_mmap(BlueSkyMmap *mmap,
+                                           int offset, gsize len);
 void bluesky_string_ref(BlueSkyRCStr *string);
 void bluesky_string_unref(BlueSkyRCStr *string);
 BlueSkyRCStr *bluesky_string_dup(BlueSkyRCStr *string);