225c0d55992aefae478461bba278644bdfdda3c5 max Wed Jan 15 08:33:57 2014 -0800 library changes for the browser box: This changes mostly hdb and jksql,plus - to a smaller extent - various other places in the code that deal with /gbdb/ files. The overall aim is to make it possible to have the data remote at UCSC while having the CGIs on a machine far away. At up to 180msecs distance from UCSC (Europe,Japan), each query can get slow. So I tried to reduce the number of queries sent to UCSC while allowing to keep some mysql tables on localhost. I changed four things: - extend larry's table cache to include field names. The code uses "describe" very often, which is slow from remote. With a table name cache these queries can be handled locally. This is configured in hg.conf - mysql "failover" connections: a mysql connection can have a 2nd connection that is used if a query fails, configured in hg.conf (I didn't call it "remote" connections, because we use that term already in the code) - mysql lazy connects: don't connect a sqlConnection right away, but only when needed. a mysql connect takes >500msecs from across the atlantic. - move gbdb: patch various places that use absolute "/gbdb/" pathnames to go through a central function that can change the filename of gbdb files to something else, as configured in hg.conf Plus patch 1 or 2 lines for more speed + update the hgMirror script diff --git src/inc/udc.h src/inc/udc.h index 607144d..c081b75 100644 --- src/inc/udc.h +++ src/inc/udc.h @@ -88,30 +88,35 @@ void udcSeek(struct udcFile *file, bits64 offset); /* Seek to a particular (absolute) position in file. */ void udcSeekCur(struct udcFile *file, bits64 offset); /* Seek to a particular (from current) position in file. */ bits64 udcTell(struct udcFile *file); /* Return current file position. */ bits64 udcCleanup(char *cacheDir, double maxDays, boolean testOnly); /* 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 all *ret's except *retColon when done. */ + void udcParseUrlFull(char *url, char **retProtocol, char **retAfterProtocol, char **retColon, char **retAuth); /* Parse the URL into components that udc treats separately. * *retAfterProtocol is Q-encoded to keep special chars out of filenames. * Free all *ret's except *retColon when done. */ char *udcDefaultDir(); /* Get default directory for cache. Use this for the udcFileOpen call if you * don't have anything better.... */ void udcSetDefaultDir(char *path); /* Set default directory for cache */ #define udcDevicePrefix "udc:" /* Prefix used by convention to indicate a file should be accessed via udc. This is @@ -139,18 +144,21 @@ void udcSetCacheTimeout(int timeout); /* Set cache timeout (if local cache files are newer than this many seconds, * we won't ping the remote server to check the file size and update time). */ time_t udcUpdateTime(struct udcFile *udc); /* return udc->updateTime */ boolean udcFastReadString(struct udcFile *f, char buf[256]); /* Read a string into buffer, which must be long enough * to hold it. String is in 'writeString' format. */ #ifdef PROGRESS_METER off_t remoteFileSize(char *url); /* fetch remote file size from given URL */ -#endif +#endif /* PROGRESS_METER */ + +boolean udcIsLocal(char *url); +/* return true if url is not a http or ftp file, just a normal local file path */ #endif /* UDC_H */