/* - Open authenticated data base connection. - Retrieve master series lists. - Build hash table over seriesnames. The series templates will be built on demand by querying the master keyword, link and observable tables. - Initialize datarecord cache and hash table. */ JSOC_Env_t *jsoc_initialize(const char *host, const char *user, const char *password, const char *dbname); /* - If commit_dirty==1 then commit all modified datarecords in the cache to the database. - Close database connection and free JSOC data structures. */ int jsoc_shutdown(JSOC_Env_t *env, int commit_dirty); /* Commit all modified datarecords in the cache to database. */ int jsoc_commit_dirty(JSOC_Env_t *env); /************** Datarecord cache operations. *****************/ /* Return a cache slot to the free list and update firstfree. */ void jsoc_env_release_drcache_slot(JSOC_Env_t *env, int index); /* Get the index of the first free slot in the dr cache and mark it used. If the cache is full double its size. */ int jsoc_env_get_drcache_slot(JSOC_Env_t *env); /* Add or remove datarecords from the JSOC environment. */ int jsoc_env_remove_dr(JSOC_Env_t *env, JSOC_Datarecord_t *dr);