123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /** @file environment.h
- *
- * @brief Handle LSUP environment initialization and teardown.
- */
- #ifndef _LSUP_ENVIRONMENT_H
- #define _LSUP_ENVIRONMENT_H
- #include "store_mdb.h"
- /*
- * Data types.
- */
- /** @brief Environment structure containing "global" LSUP variables.
- *
- * Multiple environments may be opened within one program. One environment,
- * the default one, must always be opened before performing any operation with
- * the library.
- *
- * The namespace map is used by all volatile (not LSUP_STORE_PERM) stores
- */
- typedef struct env_t {
- LSUP_Buffer * default_ctx; ///> Default context URI.
- LSUP_NSMap * nsm; ///> Namespace prefix map.
- } LSUP_Env;
- /** @brief Default environment that gets created with #LSUP_init().
- */
- 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 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_free (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);
- LSUP_rc
- LSUP_env_push_id (LSUP_Env *env, const uint32_t key, const char *data);
- const char *
- LSUP_env_get_id (LSUP_Env *env, const uint32_t key);
- #endif /* _LSUP_ENVIRONMENT_H */
|