Identifier mapping context.
This structure stores PR_MID and PR_FID identifiers to backend
- identifiers mapping. It points on 2 databases, one with "in use"
- identifiers and another one with a list of "free identifiers" which
- are added when an object is deleted, moved, etc.
+ identifiers mapping. It points to a database containing the used
+ identifiers.
The last_id structure member references the last identifier value
which got created. There is no identifier available with a value
*/
struct id_mapping_context {
struct tdb_wrap *used_ctx;
- struct tdb_wrap *free_ctx;
uint64_t last_id;
};
#define MAPISTORE_DB_LAST_ID_VAL 0x15000
#define MAPISTORE_DB_NAME_USED_ID "mapistore_id_mapping_used.tdb"
-#define MAPISTORE_DB_NAME_FREE_ID "mapistore_id_mapping_free.tdb"
__BEGIN_DECLS
mem_ctx = talloc_named(NULL, 0, "mapistore_init_mapping_context");
- /* Step 1. Open/Create the used ID database */
+ /* Open/Create the used ID database */
if (!pctx->mapping_ctx->used_ctx) {
dbpath = talloc_asprintf(mem_ctx, "%s/%s", mapistore_get_mapping_path(), MAPISTORE_DB_NAME_USED_ID);
pctx->mapping_ctx->used_ctx = tdb_wrap_open(pctx, dbpath, 0, 0, O_RDWR|O_CREAT, 0600);
}
}
- /* Step 2. Open/Create the free ID database */
- if (!pctx->mapping_ctx->free_ctx) {
- dbpath = talloc_asprintf(mem_ctx, "%s/%s", mapistore_get_mapping_path(), MAPISTORE_DB_NAME_FREE_ID);
- pctx->mapping_ctx->free_ctx = tdb_wrap_open(pctx, dbpath, 0, 0, O_RDWR|O_CREAT, 0600);
- talloc_free(dbpath);
- if (!pctx->mapping_ctx->free_ctx) {
- DEBUG(3, ("[%s:%d]: %s\n", __FUNCTION__, __LINE__, strerror(errno)));
- talloc_free(mem_ctx);
- talloc_free(pctx->mapping_ctx);
- return MAPISTORE_ERR_DATABASE_INIT;
- }
- }
-
- /* Step 3. Retrieve the last ID value */
+ /* Retrieve the last ID value */
key.dptr = (unsigned char *) MAPISTORE_DB_LAST_ID_KEY;
key.dsize = strlen(MAPISTORE_DB_LAST_ID_KEY);