mapistore_indexing.c File Reference

MAPISTORE internal indexing functions. More...

#include <string.h>
#include "mapistore.h"
#include "mapistore_errors.h"
#include "mapistore_private.h"
#include <dlinklist.h>
#include "libmapi/libmapi_private.h"
#include <tdb.h>

Functions

_PUBLIC_ enum mapistore_error mapistore_indexing_add (struct mapistore_context *mstore_ctx, const char *username, struct indexing_context_list **ictxp)
_PUBLIC_ enum mapistore_error mapistore_indexing_record_add_fid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t fid)
enum mapistore_error mapistore_indexing_record_add_fmid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t fmid)
_PUBLIC_ enum mapistore_error mapistore_indexing_record_add_mid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t mid)
_PUBLIC_ enum mapistore_error mapistore_indexing_record_del_fid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t fid, uint8_t flags)
enum mapistore_error mapistore_indexing_record_del_fmid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t fmid, uint8_t flags)
_PUBLIC_ enum mapistore_error mapistore_indexing_record_del_mid (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t mid, uint8_t flags)
_PUBLIC_ enum mapistore_error mapistore_indexing_record_get_uri (struct mapistore_context *mstore_ctx, const char *username, TALLOC_CTX *mem_ctx, uint64_t fmid, char **urip, bool *soft_deletedp)
struct indexing_context_list * mapistore_indexing_search (struct mapistore_context *mstore_ctx, const char *username)
enum mapistore_error mapistore_indexing_search_existing_fmid (struct indexing_context_list *ictx, uint64_t fmid, bool *IsSoftDeleted)

Detailed Description

MAPISTORE internal indexing functions.

This file contains functionality to map between folder / message identifiers and backend URI strings.

Function Documentation

_PUBLIC_ enum mapistore_error mapistore_indexing_add ( struct mapistore_context *  mstore_ctx,
const char *  username,
struct indexing_context_list **  ictxp 
)

Open connection to indexing database for a given user

Parameters
mstore_ctxpointer to the mapistore context
usernamename for which the indexing database has to be created
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_DATABASE_INIT, MAPISTORE_ERR_NOT_INITIALIZED, MAPISTORE_ERROR, mapistore_indexing_search(), and MAPISTORE_SUCCESS.

Referenced by mapistore_add_context(), mapistore_indexing_record_add_fmid(), mapistore_indexing_record_del_fmid(), mapistore_indexing_record_get_uri(), mapistore_mgmt_register_message(), and mapistore_mgmt_registered_message().

_PUBLIC_ enum mapistore_error mapistore_indexing_record_add_fid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  fid 
)

Add a fid record to the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
fidthe fid to add
Note
This is a wrapper to the internal common mapistore_indexing_record_add_fmid function.
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_record_add_fmid().

enum mapistore_error mapistore_indexing_record_add_fmid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  fmid 
)

Add a folder or message record to the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
fmidthe folder or message ID to add
typeMAPISTORE_FOLDER or MAPISTORE_MESSAGE
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_backend_lookup(), MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERROR, mapistore_indexing_add(), and mapistore_indexing_search_existing_fmid().

Referenced by mapistore_indexing_record_add_fid(), and mapistore_indexing_record_add_mid().

_PUBLIC_ enum mapistore_error mapistore_indexing_record_add_mid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  mid 
)

Add a mid record to the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
midthe mid to add
Note
This is a wrapper to the internal common mapistore_indexing_record_add_fmid function.
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_record_add_fmid().

_PUBLIC_ enum mapistore_error mapistore_indexing_record_del_fid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  fid,
uint8_t  flags 
)

Delete a fid record from the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
fidthe fid to remove
flagsthe type of deletion MAPISTORE_SOFT_DELETE or MAPISTORE_PERMANENT_DELETE
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_record_del_fmid().

enum mapistore_error mapistore_indexing_record_del_fmid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  fmid,
uint8_t  flags 
)

Remove a folder or message record from the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
fmidthe folder or message ID to delete
flagsthe type of deletion MAPISTORE_SOFT_DELETE or MAPISTORE_PERMANENT_DELETE
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_backend_lookup(), MAPISTORE_ERR_DATABASE_OPS, MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERROR, mapistore_indexing_add(), mapistore_indexing_search_existing_fmid(), and MAPISTORE_SUCCESS.

Referenced by mapistore_indexing_record_del_fid(), and mapistore_indexing_record_del_mid().

_PUBLIC_ enum mapistore_error mapistore_indexing_record_del_mid ( struct mapistore_context *  mstore_ctx,
uint32_t  context_id,
const char *  username,
uint64_t  mid,
uint8_t  flags 
)

Delete a mid record from the indexing database

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
midthe mid to remove
flagsthe type of deletion MAPISTORE_SOFT_DELETE or MAPISTORE_PERMANENT_DELETE
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_record_del_fmid().

_PUBLIC_ enum mapistore_error mapistore_indexing_record_get_uri ( struct mapistore_context *  mstore_ctx,
const char *  username,
TALLOC_CTX *  mem_ctx,
uint64_t  fmid,
char **  urip,
bool *  soft_deletedp 
)

Returns record data

Parameters
mstore_ctxpointer to the mapistore context
usernamethe name of the account where to look for the indexing database
mem_ctxpointer to the memory context
fmidthe fmid/key to the record
urippointer to the uri pointer
soft_deletedppointer to the soft deleted pointer
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_NOT_FOUND, MAPISTORE_ERR_NOT_INITIALIZED, MAPISTORE_ERROR, mapistore_indexing_add(), and MAPISTORE_SUCCESS.

struct indexing_context_list* mapistore_indexing_search ( struct mapistore_context *  mstore_ctx,
const char *  username 
)
read

Search the indexing record matching the username

Parameters
mstore_ctxpointer to the mapistore context
usernamethe username to lookup
Returns
pointer to the tdb_wrap structure on success, otherwise NULL

Referenced by mapistore_indexing_add().

enum mapistore_error mapistore_indexing_search_existing_fmid ( struct indexing_context_list *  ictx,
uint64_t  fmid,
bool *  IsSoftDeleted 
)

Convenient function to check if the folder/message ID passed in parameter already exists in the database or not and whether it is soft deleted or not

Parameters
ictxpointer to the indexing context
fmidfolder/message ID to lookup
IsSoftDeletedpointer to boolean returned by the function which indicates whether the record is soft_deleted or not
Returns
MAPISTORE_SUCCESS if the folder/message ID doesn't exist, otherwise MAPISTORE_ERR_EXIST.

References MAPISTORE_ERR_EXIST, MAPISTORE_ERROR, and MAPISTORE_SUCCESS.

Referenced by mapistore_indexing_record_add_fmid(), and mapistore_indexing_record_del_fmid().


Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/