mapistore_indexing.c File Reference

MAPISTORE internal indexing functions. More...

#include "mapistore.h"
#include "mapistore_errors.h"
#include "mapistore_private.h"
#include "backends/indexing_tdb.h"
#include "backends/indexing_mysql.h"
#include "mapiproxy/libmapiproxy/libmapiproxy.h"

Functions

_PUBLIC_ enum mapistore_error mapistore_indexing_add (struct mapistore_context *mstore_ctx, const char *username, struct indexing_context **ictxp)
_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderID (struct mapistore_context *mstore_ctx, uint64_t *fid)
_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderID_as_user (struct mapistore_context *mstore_ctx, const char *username, uint64_t *fid)
_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderIDs (struct mapistore_context *mstore_ctx, TALLOC_CTX *mem_ctx, uint64_t max, struct UI8Array_r **fids_p)
_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, int type)
enum mapistore_error mapistore_indexing_record_add_fmid_for_uri (struct mapistore_context *mstore_ctx, uint32_t context_id, const char *username, uint64_t fmid, const char *mapistore_uri)
_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, int type)
_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)
_PUBLIC_ enum mapistore_error mapistore_indexing_reserve_fmid_range (struct mapistore_context *mstore_ctx, uint64_t range_len, uint64_t *first_fmidp)
struct indexing_context * mapistore_indexing_search (struct mapistore_context *mstore_ctx, const char *username)
_PUBLIC_ void mapistore_set_default_cache_url (const char *url)
_PUBLIC_ void mapistore_set_default_indexing_url (const char *url)

Detailed Description

MAPISTORE internal indexing functions.

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

Function Documentation

◆ mapistore_indexing_add()

_PUBLIC_ enum mapistore_error mapistore_indexing_add ( struct mapistore_context * mstore_ctx,
const char * username,
struct indexing_context ** 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_NOT_INITIALIZED, MAPISTORE_ERROR, mapistore_indexing_search(), and MAPISTORE_SUCCESS.

Referenced by mapistore_add_context(), mapistore_indexing_record_add_fmid(), mapistore_indexing_record_add_fmid_for_uri(), mapistore_indexing_record_del_fmid(), and mapistore_indexing_record_get_uri().

◆ mapistore_indexing_get_new_folderID()

_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderID ( struct mapistore_context * mstore_ctx,
uint64_t * fid )

Allocates a new FolderID and returns it

Parameters
mstore_ctxpointer to the mapistore context
fidpointer to the fid value the function returns
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_get_new_folderID_as_user().

◆ mapistore_indexing_get_new_folderID_as_user()

_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderID_as_user ( struct mapistore_context * mstore_ctx,
const char * username,
uint64_t * fid )

Allocates a new FolderID for a specific user and returns it

Parameters
mstore_ctxpointer to the mapistore context
usernamename of the mailbox
fidpointer to the fid value the function returns
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_SUCCESS.

Referenced by mapistore_indexing_get_new_folderID().

◆ mapistore_indexing_get_new_folderIDs()

_PUBLIC_ enum mapistore_error mapistore_indexing_get_new_folderIDs ( struct mapistore_context * mstore_ctx,
TALLOC_CTX * mem_ctx,
uint64_t max,
struct UI8Array_r ** fids_p )

Allocates a batch of new folder ids and returns them

Parameters
mstore_ctxpointer to the mapistore context
mem_ctxmemory context where the fid will be allocated
maxnumber of fids to allocate
fids_ppointer array of fids values the function returns
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_SUCCESS.

◆ mapistore_indexing_record_add_fid()

_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().

◆ 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,
int type )

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
usernamethe username who owns the new entry
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_ERR_NO_MEMORY, MAPISTORE_ERROR, mapistore_indexing_add(), and MAPISTORE_SUCCESS.

Referenced by mapistore_indexing_record_add_fid(), and mapistore_indexing_record_add_mid().

◆ mapistore_indexing_record_add_fmid_for_uri()

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

Add a folder or message record to the indexing database using the given URI

Parameters
mstore_ctxpointer to the mapistore context
context_idthe context identifier referencing the indexing database to update
usernamethe username who owns the new entry
fmidthe folder or message ID to add
mapistore_urithe URI to map against this fmid
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

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

◆ 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().

◆ mapistore_indexing_record_del_fid()

_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().

◆ 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,
int type )

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
typeMAPISTORE_FOLDER or MAPISTORE_MESSAGE
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

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

Referenced by mapistore_indexing_record_del_fid(), and mapistore_indexing_record_del_mid().

◆ 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().

◆ mapistore_indexing_record_get_uri()

_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_INITIALIZED, MAPISTORE_ERROR, and mapistore_indexing_add().

◆ mapistore_indexing_reserve_fmid_range()

_PUBLIC_ enum mapistore_error mapistore_indexing_reserve_fmid_range ( struct mapistore_context * mstore_ctx,
uint64_t range_len,
uint64_t * first_fmidp )

Reserve a range of FMID

Parameters
mstore_ctxpointer to the mapistore context
range_lensize of the range of fmids to reserve
first_fmidppointer to the first reserved fid value the function returns
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_INVALID_PARAMETER, mapistore_indexing_search(), and MAPISTORE_SUCCESS.

◆ mapistore_indexing_search()

struct indexing_context * mapistore_indexing_search ( struct mapistore_context * mstore_ctx,
const char * username )

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(), and mapistore_indexing_reserve_fmid_range().

◆ mapistore_set_default_cache_url()

_PUBLIC_ void mapistore_set_default_cache_url ( const char * url)

Set the default cache url. If none is set, 127.0.0.1:11211 will be used.

Parameters
urldefault backend url to be used

Referenced by mapistore_init().

◆ mapistore_set_default_indexing_url()

_PUBLIC_ void mapistore_set_default_indexing_url ( const char * url)

Set the default backend url. If none is set, a tdb file per user will be used.

Parameters
urldefault backend url to be used

Referenced by mapistore_init().


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/