1 /* Blue Sky: File Systems in the Cloud
3 * Copyright (C) 2009 The Regents of the University of California
4 * Written by Michael Vrable <mvrable@cs.ucsd.edu>
9 /* Declarations internal to the BlueSky library. This header file should not
10 * be included by any users of the library (such as any filesystem
11 * proxy)--external users should only include bluesky.h. */
13 #ifndef _BLUESKY_PRIVATE_H
14 #define _BLUESKY_PRIVATE_H
22 /* TODO: Make this go away entirely. */
23 BlueSkyFS *bluesky_new_fs(gchar *name);
25 /* Serialization and deserialization of filesystem data for storing to
26 * persistent storage. */
27 void bluesky_serialize_superblock(GString *out, BlueSkyFS *fs);
28 BlueSkyFS *bluesky_deserialize_superblock(const gchar *buf);
29 void bluesky_serialize_inode(GString *out, BlueSkyInode *inode);
30 BlueSkyInode *bluesky_deserialize_inode(BlueSkyFS *fs, const gchar *buf);
32 /* Storage layer. Requests can be performed asynchronously, so these objects
33 * help keep track of operations in progress. */
42 ASYNC_NEW, // Operation not yet submitted to storage layer
43 ASYNC_PENDING, // Submitted to storage layer
44 ASYNC_RUNNING, // Operation is in progress
45 ASYNC_COMPLETE, // Operation finished, results available
52 GCond *completion_cond; /* Used to wait for operation to complete. */
54 gint refcount; /* Reference count for destruction. */
56 BlueSkyAsyncStatus status;
59 gchar *key; /* Key to read/write */
60 BlueSkyRCStr *data; /* Data read/to write */
62 int result; /* Result code; 0 for success. */
64 gpointer store_private; /* For use by the storage implementation */
67 /* The abstraction layer for storage, allowing multiple implementations. */
69 /* Create a new store instance and return a handle to it. */
72 /* Clean up any resources used by this store. */
73 void (*destroy)(gpointer store);
75 /* Submit an operation (get/put/delete) to the storage layer to be
76 * performed asynchronously. */
77 void (*submit)(gpointer store, BlueSkyStoreAsync *async);
79 /* Clean up any implementation-private data in a BlueSkyStoreAsync. */
80 void (*cleanup)(gpointer store, BlueSkyStoreAsync *async);
81 } BlueSkyStoreImplementation;
83 void bluesky_store_register(const BlueSkyStoreImplementation *impl,
86 BlueSkyStoreAsync *bluesky_store_async_new(BlueSkyStore *store);
87 void bluesky_store_async_ref(BlueSkyStoreAsync *async);
88 void bluesky_store_async_unref(BlueSkyStoreAsync *async);
89 void bluesky_store_async_wait(BlueSkyStoreAsync *async);
90 void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async);
91 void bluesky_store_async_submit(BlueSkyStoreAsync *async);
92 void bluesky_store_sync(BlueSkyStore *store);