a019cec925f0e902a6eb2ddeb781dd549c7e9406
chmalee
  Fri Mar 5 15:54:25 2021 -0800
Add public track hub results to track search, refs #26179

diff --git src/hg/inc/hubConnect.h src/hg/inc/hubConnect.h
index 1fcdbe2..ad600d2 100644
--- src/hg/inc/hubConnect.h
+++ src/hg/inc/hubConnect.h
@@ -65,30 +65,31 @@
 /* Return TRUE if it's a hub track. */
 
 struct hubConnectStatus
 /* Basic status in hubStatus.  Note it is *not* the same as the
  * hubStatus table, that has a bunch of extra fields to help 
  * keep track of whether the hub is alive. */
     {
     struct hubConnectStatus *next;
     unsigned id;	/* Hub ID */
     char *hubUrl;	/* URL to hub.ra file. */
     char *errorMessage;	/* If non-empty hub has an error and this describes it. */
     struct trackHub *trackHub; /* pointer to structure that describes hub */
     unsigned  status;   /* 1 if private */
     };
 
+
 void hubConnectStatusFree(struct hubConnectStatus **pHub);
 /* Free hubConnectStatus */
 
 void hubConnectStatusFreeList(struct hubConnectStatus **pList);
 /* Free a list of dynamically allocated hubConnectStatus's */
 
 struct hubConnectStatus *hubConnectStatusForId( struct sqlConnection *conn, 
     int id);
 /* Given a hub ID return associated status. */
 
 struct hubConnectStatus *hubConnectStatusListFromCart(struct cart *cart);
 /* Return list of track hubs that are turned on by user in cart. */
 
 struct hubConnectStatus *hubConnectStatusListFromCartAll(struct cart *cart);
 /* Return list of all track hubs that are referenced by cart. */
@@ -119,32 +120,31 @@
  * and store in tdb->html. */
 
 struct trackDb *hubConnectAddHubForTrackAndFindTdb( char *database, 
     char *trackName, struct trackDb **pTdbList, struct hash *trackHash);
 /* Go find hub for trackName (which will begin with hub_), and load the tracks
  * for it, appending to end of list and adding to trackHash.  Return the
  * trackDb associated with trackName. */
 
 char *hubFileVar();
 /* return the name of the cart variable that holds the name of the
  * file in trash that has private hubs */
 
 boolean hubWriteToFile(FILE *f, struct hubConnectStatus *el);
 /* write out a hubConnectStatus structure to a file */
 
-unsigned hubFindOrAddUrlInStatusTable(char *database, struct cart *cart,
-    char *url, char **errorMessage);
+unsigned hubFindOrAddUrlInStatusTable(struct cart *cart, char *url, char **errorMessage);
 /* find or add a URL to the status table */
 
 unsigned hubResetError(char *url);
 /* clear the error for this url in the hubStatus table,return the id */
 
 unsigned hubClearStatus(char *url);
 /* drop the information about this url from the hubStatus table,return the id */
 
 void hubDisconnect(struct cart *cart, char *url);
 /* drop the information about this url from the hubStatus table, and 
  * the cart variable the references this hub */
 
 void hubUpdateStatus(char *errorMessage, struct hubConnectStatus *hub);
 /* set the error message in the hubStatus table */
 
@@ -162,25 +162,37 @@
 /* return the static global to the track data hubs */
 
 struct trackHub *hubConnectGetHub(char *hubUrl);
 /* Return the connected hub for hubUrl, or NULL if not found.  Do not free result. */
 
 struct trackHub *hubConnectGetHubForDb(char *db);
 /* Return the connected hub for db, or NULL if not found.  Do not free result. */
 
 struct trackDb *hubCollectTracks( char *database, struct grp **pGroupList);
 /* Generate trackDb structures for all the tracks in attached hubs.  
  * Make grp structures for each hub. Returned group list is reversed. */
 
 char *hubConnectSkipHubPrefix(char *trackName);
 /* Given something like "hub_123_myWig" return myWig.  Don't free this, it's not allocated */
 
+struct hubConnectStatus *hubFromId(unsigned hubId);
+/* Given a hub ID number, return corresponding trackHub structure.
+ * ErrAbort if there's a problem. */
+
 struct hubConnectStatus *hubConnectNewHub();
 /* return the hub of the hubUrl we added (if any) */
 
 char *hubPublicTableName();
 /* Get the name of the table that lists public hubs.  Don't free the result. */
 
 char *hubNameFromUrl(char *hubUrl);
 /* Given the URL for a hub, return its hub_# name. */
 
+void addPublicHubsToHubStatus(struct cart *cart, struct sqlConnection *conn, char *publicTable, char  *statusTable);
+/* Add urls in the hubPublic table to the hubStatus table if they aren't there already */
+
+struct hash *buildPublicLookupHash(struct sqlConnection *conn, char *publicTable, char *statusTable,
+        struct hash **pHash);
+/* Return a hash linking hub URLs to struct hubEntries.  Also make pHash point to a hash that just stores
+ * the names of the public hubs (for use later when determining if hubs were added by the user) */
+
 #endif /* HUBCONNECT_H */