GError* service_info_from_chunk_id(struct grid_lbpool_s *glp, const gchar *chunk_id, service_info_t **srvinfo) { GError *err = NULL; struct service_info_s *si = NULL; if (chunk_id == NULL || strlen(chunk_id) <= 0) return NEWERROR(CODE_INTERNAL_ERROR, "emtpy chunk id"); // TODO FIXME Factorizes this with client/c/lib/loc_context.c and // TODO FIXME meta2v2/meta2_utils_lb.c, rawx-mover/src/main.c char **tok = g_regex_split_simple( "(([[:digit:]]{1,3}\\.){3}[[:digit:]]{1,3}:[[:digit:]]{1,5})", chunk_id, 0, 0); if (!tok || g_strv_length(tok) < 3) err = NEWERROR(CODE_INTERNAL_ERROR, "could not parse chunk id"); if (err == NULL) { si = grid_lbpool_get_service_from_url(glp, "rawx", tok[1]); if (si == NULL) err = NEWERROR(CODE_INTERNAL_ERROR, "unable to find service info from %s", tok[1]); else *srvinfo = si; } g_strfreev(tok); return err; }
static GSList * __srvinfo_from_m1srvurl(struct grid_lbpool_s *glp, const char *type, struct meta1_service_url_s **urls) { GSList *out = NULL; struct service_info_s* srvinfo = NULL; struct meta1_service_url_s **cursor = NULL; for (cursor = urls; cursor && *cursor; cursor++) { srvinfo = grid_lbpool_get_service_from_url(glp, type, (*cursor)->host); out = g_slist_prepend(out, srvinfo); } return out; }
static struct service_info_s * __service_info_from_chunkid(const struct loc_context_s *lc, const char *cid) { struct service_info_s *si = NULL; // TODO FIXME Factorizes this with client/c/lib/loc_context.c and // TODO FIXME meta2v2/meta2_utils_lb.c, rawx-mover/src/main.c char **tok = g_regex_split_simple( "(([[:digit:]]{1,3}\\.){3}[[:digit:]]{1,3}:[[:digit:]]{1,5})", cid, 0, 0); if(!tok) return NULL; if(g_strv_length(tok) < 3) { return NULL; } si = grid_lbpool_get_service_from_url(lc->glp, "rawx", tok[1]); g_strfreev(tok); return si; }