src/inc/udc.h 1.11
1.11 2009/11/03 00:51:53 angie
Support for udcFuse and apps that will read files from it: plug minor memory leaks, use errAbort not assert, make udcFileMayOpen public, make udcParseUrl public so apps can determine path to file in udcFuse, add udcPathToUrl and udcSizeFromCache so that udcFuse can report the correct total file size.
Index: src/inc/udc.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/inc/udc.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -B -U 4 -r1.10 -r1.11
--- src/inc/udc.h 18 May 2009 21:35:20 -0000 1.10
+++ src/inc/udc.h 3 Nov 2009 00:51:53 -0000 1.11
@@ -25,11 +25,15 @@
struct udcFile;
/* Handle to a cached file. Inside of structure mysterious unless you are udc.c. */
+struct udcFile *udcFileMayOpen(char *url, char *cacheDir);
+/* Open up a cached file. cacheDir may be null in which case udcDefaultDir() will be
+ * used. Return NULL if file doesn't exist. */
+
struct udcFile *udcFileOpen(char *url, char *cacheDir);
-/* Open up a cached file. CacheDir may be null in which case udcDefaultDir() will be
- * used. */
+/* Open up a cached file. cacheDir may be null in which case udcDefaultDir() will be
+ * used. Abort if if file doesn't exist. */
void udcFileClose(struct udcFile **pFile);
/* Close down cached file. */
@@ -67,8 +71,13 @@
/* Remove cached files older than maxDays old. If testOnly is set
* no clean up is done, but the size of the files that would be
* cleaned up is still. */
+void udcParseUrl(char *url, char **retProtocol, char **retAfterProtocol, char **retColon);
+/* Parse the URL into components that udc treats separately.
+ * *retAfterProtocol is Q-encoded to keep special chars out of filenames.
+ * Free *retProtocol and *retAfterProtocol but not *retColon when done. */
+
char *udcDefaultDir();
/* Get default directory for cache. Use this for the udcFileOpen call if you
* don't have anything better.... */
@@ -106,5 +115,13 @@
struct slName *udcFileCacheFiles(char *url, char *cacheDir);
/* Return low-level list of files used in cache. */
+char *udcPathToUrl(const char *path, char *buf, size_t size, char *cacheDir);
+/* Translate path into an URL, store in buf, return pointer to buf if successful
+ * and NULL if not. */
+
+int udcSizeFromCache(char *url, char *cacheDir);
+/* Look up the file size from the local cache bitmap file, or -1 if there
+ * is no cache for url. */
+
#endif /* UDC_H */