123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /** @file environment.h
- *
- * @brief Handle LSUP environment initialization and teardown.
- */
- #ifndef _LSUP_ENVIRONMENT_H
- #define _LSUP_ENVIRONMENT_H
- #include "term.h"
- #include "store_mdb.h"
- #include "namespace.h"
- typedef struct env_t {
- LSUP_Buffer * default_ctx; // Default context URI.
- LSUP_MDBStore * mdb_store; // MDB permanent store handle.
- LSUP_MDBStore * mdb_store_ramdisk; // MDB RAM disk store handle.
- LSUP_NSMap * nsm; // Namespace prefix map.
- } LSUP_Env;
- /** @brief Environment variable that gets passed around.
- */
- extern LSUP_Env *LSUP_default_env;
- /** @brief Initialize default context and MDB environments.
- *
- * The ramdisk data will persist after the application is shut down, but they
- * will be wiped clean the next time this function is called.
- */
- LSUP_Env *
- LSUP_env_new (
- const char *default_ctx, const char *mdb_path,
- const char *mdb_ramdisk_path, const LSUP_NSMap *nsmap);
- /** @brief Initialize the default environment.
- *
- * This must be called before using the library.
- *
- * The default environment is cleaned up automatically on exit.
- *
- * This environment should suit most cases, unless an application needs to use
- * multiple environments and call #LSUP_env_init with specific handles. Such
- * other environment(s) must be freed up manually with #LSUP_env_done().
- */
- LSUP_rc
- LSUP_init (void);
- /** @brief Close an environment.
- *
- * This only needs to be done for non-default environments. The environment
- * handle is not freed.
- */
- void
- LSUP_env_done (LSUP_Env *env);
- /** @brief Close the defailt environment.
- *
- * This is called by atexit(). If called before then, subsequent calls have
- * no effect.
- */
- void LSUP_done (void);
- #endif /* _LSUP_ENVIRONMENT_H */
|