e2c9cfc1bb6a71ba957b8f2b674491595a232353 hiram Fri Jul 24 09:51:39 2026 -0700 refactor the ottoRequest table access with relay requests from Euro/Asia nodes to the RR system refs #31811 diff --git src/hg/hubApi/dataApi.h src/hg/hubApi/dataApi.h index 190e350e46a..3bb4646e414 100644 --- src/hg/hubApi/dataApi.h +++ src/hg/hubApi/dataApi.h @@ -84,30 +84,33 @@ #define argYear "year" #define argCategory "category" #define argStatus "status" #define argLevel "level" #define argLiftable "liftable" #define argFromGenome "fromGenome" #define argToGenome "toGenome" /* used by liftRequest */ #define argEmail "email" #define argComment "comment" #define argReturnTo "returnTo" /* used by assemblyRequest */ #define argAsmId "asmId" #define argName "name" #define argBetterName "betterName" +/* used by the internal /submitOttoRequest relay endpoint */ +#define argRequestType "requestType" +#define argRelaySecret "relaySecret" /* used in liftOver 'listExisting' function to filter the result */ #define argFilter "filter" /* used in list/files to show only certain file types */ #define argFileType "fileType" /* used by /blat */ #define argUserSeq "userSeq" #define argApiKey "apiKey" /* valid argument listings to verify extraneous arguments * initialized in hubApi.c */ extern char *argListPublicHubs[]; extern char *argListUcscGenomes[]; extern char *argListGenarkGenomes[]; extern char *argListHubGenomes[]; @@ -279,35 +282,56 @@ boolean isWiggleDataTable(char *type); /* is this a wiggle data track table */ char *chrOrAlias(char *db, char *hubUrl); /* get incoming chr name, may be an alias, return the native chr name */ void hubAliasSetup(struct trackHubGenome *hubGenome); /* see if this hub has an alias file and run chromAliasSetupBb() for it */ void textLineOut(char *lineOut); /* accumulate text lines for output in the dyString textOutput */ void textFinishOutput(); /* all done with text output, print it all out */ -struct sqlConnection *hConnectOtto(); -/* Connect to otto database using otto profile, fallback to central */ - -void hDisconnectOtto(struct sqlConnection **pConn); -/* Disconnect otto connection */ +boolean inUcscEduDomain(); +/* Return TRUE if this machine is configured (via hg.conf's central.domain) + * as belonging to the ucsc.edu domain. */ + +boolean onGenomeRRMachine(); +/* Return TRUE if running on one of the genome.ucsc.edu round-robin + * machines (hgw0, hgw1, hgw2, ... or hgwbeta), which carry direct SQL + * grants on hgcentral. Only meaningful within inUcscEduDomain(). */ + +char *submitOttoRequest(char *requestType, char *fromDb, char *toDb, char *email, char *comment); +/* Record a row in the ottoRequest table via hConnectCentral(), applying the + * liftOver duplicate/daily-rate guards when requestType is "liftOver", or a + * plain insert when requestType is "assembly". Returns a status string: + * "disabled", "duplicate", "rateLimited", "accepted", or "error". Never + * apiErrAbort()s -- used both for direct local calls (this host has + * hgcentral write grants) and to answer relaySubmitOttoRequest() calls. */ + +char *relaySubmitOttoRequest(char *requestType, char *fromDb, char *toDb, char *email, char *comment); +/* Relay an ottoRequest submission to genome.ucsc.edu's /submitOttoRequest + * endpoint, for hosts that lack local hgcentral write grants. Returns the + * same status vocabulary as submitOttoRequest(). */ + +void apiSubmitOttoRequest(char *words[MAX_PATH_INFO]); +/* Internal server-to-server endpoint backing relaySubmitOttoRequest(): + * authenticates via the shared hg.conf secret 'hubApi.relaySecret', then + * calls submitOttoRequest() locally and returns its status as JSON. */ /* ######################################################################### */ /* functions in getData.c */ void apiGetData(char *words[MAX_PATH_INFO]); /* 'getData' function, words[1] is the subCommand */ /* ######################################################################### */ /* functions in list.c */ void apiList(char *words[MAX_PATH_INFO]); /* 'list' function words[1] is the subCommand */ /* ######################################################################### */ /* functions in search.c */