Skip to content

Commit

Permalink
Merge Zentyal contribution: openchangedb and indexing refactoring + m…
Browse files Browse the repository at this point in the history
…ysql backend
  • Loading branch information
jkerihuel committed Apr 23, 2014
1 parent abe0b1c commit d52fefd
Show file tree
Hide file tree
Showing 53 changed files with 9,330 additions and 3,249 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -39,7 +39,7 @@ mapiproxy/libmapistore/Doxyfile
mapiproxy/libmapistore/mapistore_nameid.h
mapiproxy/libmapistore/mgmt/gen_ndr/
pyopenchange/mapistore/errors.c
setup/mapistore/
setup/mapistore/mapistore_namedprops.ldif
stamp-h1
utils/mapitest/Doxyfile
utils/mapitest/mapitest_proto.h
Expand Down
31 changes: 22 additions & 9 deletions Makefile
Expand Up @@ -768,13 +768,16 @@ mapiproxy/libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION): mapiproxy/libmapiproxy/dc
mapiproxy/libmapiproxy/openchangedb_table.po \
mapiproxy/libmapiproxy/openchangedb_message.po \
mapiproxy/libmapiproxy/openchangedb_property.po \
mapiproxy/libmapiproxy/backends/openchangedb_ldb.po \
mapiproxy/libmapiproxy/backends/openchangedb_mysql.po \
mapiproxy/libmapiproxy/mapi_handles.po \
mapiproxy/libmapiproxy/entryid.po \
mapiproxy/libmapiproxy/modules.po \
mapiproxy/libmapiproxy/fault_util.po \
mapiproxy/libmapiproxy/fault_util.po \
mapiproxy/util/mysql.po \
libmapi.$(SHLIBEXT).$(PACKAGE_VERSION)
@echo "Linking $@"
@$(CC) -o $@ $(DSOOPT) $(LDFLAGS) -Wl,-soname,libmapiproxy.$(SHLIBEXT).$(LIBMAPIPROXY_SO_VERSION) $^ -L. $(LIBS) $(TDB_LIBS) $(DL_LIBS)
@$(CC) -o $@ $(DSOOPT) $(LDFLAGS) -Wl,-soname,libmapiproxy.$(SHLIBEXT).$(LIBMAPIPROXY_SO_VERSION) $^ -L. $(LIBS) $(TDB_LIBS) $(DL_LIBS) $(MYSQL_LIBS)

mapiproxy/libmapiproxy.$(SHLIBEXT).$(LIBMAPIPROXY_SO_VERSION): libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION)
ln -fs $< $@
Expand Down Expand Up @@ -853,6 +856,8 @@ mapiproxy/libmapistore/mgmt/gen_ndr/ndr_%.h mapiproxy/libmapistore/mgmt/gen_ndr/
libmapistore: mapiproxy/libmapistore/mapistore_nameid.h \
mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION) \
setup/mapistore/mapistore_namedprops.ldif \
setup/mapistore/named_properties_schema.sql \
setup/mapistore/indexing_schema.sql \
$(OC_MAPISTORE) \
$(MAPISTORE_TEST)

Expand Down Expand Up @@ -889,7 +894,6 @@ libmapistore-clean: $(OC_MAPISTORE_CLEAN)
rm -f mapiproxy/libmapistore/*.gcno mapiproxy/libmapistore/*.gcda
rm -f mapiproxy/libmapistore.$(SHLIBEXT).*
rm -f setup/mapistore/mapistore_namedprops.ldif
rmdir setup/mapistore
rm -f mapiproxy/libmapistore/mapistore_nameid.h
rm -rf mapiproxy/libmapistore/mgmt/gen_ndr

Expand All @@ -913,14 +917,19 @@ mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION): mapiproxy/libmapistore/m
mapiproxy/libmapistore/mapistore_backend.po \
mapiproxy/libmapistore/mapistore_backend_defaults.po \
mapiproxy/libmapistore/mapistore_tdb_wrap.po \
mapiproxy/libmapistore/mapistore_ldb_wrap.po \
mapiproxy/libmapistore/mapistore_indexing.po \
mapiproxy/libmapistore/mapistore_replica_mapping.po \
mapiproxy/libmapistore/mapistore_namedprops.po \
mapiproxy/libmapistore/mapistore_notification.po \
mapiproxy/libmapistore/backends/namedprops_ldb.po \
mapiproxy/libmapistore/backends/namedprops_mysql.po \
mapiproxy/libmapistore/backends/indexing_tdb.po \
mapiproxy/libmapistore/backends/indexing_mysql.po \
mapiproxy/util/mysql.po \
mapiproxy/libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION) \
libmapi.$(SHLIBEXT).$(PACKAGE_VERSION)
@echo "Linking $@"
@$(CC) -o $@ $(DSOOPT) $^ -L. $(LDFLAGS) $(LIBS) $(TDB_LIBS) $(DL_LIBS) -Wl,-soname,libmapistore.$(SHLIBEXT).$(LIBMAPISTORE_SO_VERSION)
@$(CC) -o $@ $(DSOOPT) $^ -L. $(LDFLAGS) $(LIBS) $(TDB_LIBS) $(DL_LIBS) -Wl,-soname,libmapistore.$(SHLIBEXT).$(LIBMAPISTORE_SO_VERSION) $(MYSQL_LIBS)

mapiproxy/libmapistore/mapistore_interface.po: mapiproxy/libmapistore/mapistore_nameid.h

Expand All @@ -938,7 +947,8 @@ mapiproxy/libmapistore.$(SHLIBEXT).$(LIBMAPISTORE_SO_VERSION): libmapistore.$(SH
mapistore_test: bin/mapistore_test

bin/mapistore_test: mapiproxy/libmapistore/tests/mapistore_test.o \
mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION)
mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION) \
mapiproxy/libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION)
@echo "Linking $@"
@$(CC) -o $@ $^ $(LDFLAGS) $(LIBS) -lpopt -L. libmapi.$(SHLIBEXT).$(PACKAGE_VERSION)

Expand Down Expand Up @@ -1015,6 +1025,7 @@ provision-install: python-install
$(INSTALL) -d $(DESTDIR)$(datadir)/setup
$(INSTALL) -d $(DESTDIR)$(datadir)/setup/openchangedb
$(INSTALL) -m 0644 setup/openchangedb/oc_provision* $(DESTDIR)$(datadir)/setup/openchangedb/
$(INSTALL) -m 0644 setup/openchangedb/openchangedb_schema.sql $(DESTDIR)$(datadir)/setup/openchangedb/

provision-uninstall: python-uninstall
rm -f $(DESTDIR)$(samba_setupdir)/AD/oc_provision_configuration.ldif
Expand Down Expand Up @@ -1060,6 +1071,7 @@ mapiproxy/servers/exchange_emsmdb.$(SHLIBEXT): mapiproxy/servers/default/emsmdb/
mapiproxy/servers/default/emsmdb/emsmdbp.po \
mapiproxy/servers/default/emsmdb/emsmdbp_object.po \
mapiproxy/servers/default/emsmdb/emsmdbp_provisioning.po \
mapiproxy/servers/default/emsmdb/emsmdbp_provisioning_names.po \
mapiproxy/servers/default/emsmdb/oxcstor.po \
mapiproxy/servers/default/emsmdb/oxcprpt.po \
mapiproxy/servers/default/emsmdb/oxcfold.po \
Expand Down Expand Up @@ -1434,9 +1446,10 @@ check_fasttransfer-clean::

clean:: check_fasttransfer-clean

bin/check_fasttransfer: testprogs/check_fasttransfer.o \
libmapi.$(SHLIBEXT).$(PACKAGE_VERSION) \
mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION)
bin/check_fasttransfer: testprogs/check_fasttransfer.o \
libmapi.$(SHLIBEXT).$(PACKAGE_VERSION) \
mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION) \
mapiproxy/libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION)
@echo "Linking $@"
@$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) -lpopt

Expand Down
5 changes: 5 additions & 0 deletions config.mk.in
Expand Up @@ -16,6 +16,10 @@ PYTHON_CONFIG=@PYTHON_CONFIG@
PYTHON_CFLAGS=@PYTHON_CFLAGS@
PYTHON_LIBS=@PYTHON_LIBS@

MYSQL_CONFIG=@MYSQL_CONFIG@
MYSQL_CFLAGS=@MYSQL_CFLAGS@
MYSQL_LIBS=@MYSQL_LIBS@

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
Expand All @@ -35,6 +39,7 @@ DSOOPT=-shared -fPIC
CFLAGS=@CFLAGS@ @COMPILER_OPTIONS_C@ @ASSERT_DEFINITION@ @SUBUNIT_CFLAGS@ \
-DDEFAULT_LDIF=\"$(datadir)/setup/profiles\" \
-DMAPISTORE_LDIF=\"$(datadir)/setup/mapistore\" \
-DOPENCHANGEDB_DATA_DIR=\"$(datadir)/setup/openchangedb\" \
-DMAPISTORE_BACKEND_INSTALLDIR=\"$(libdir)/mapistore_backends\" \
-DLZXPRESS_DATADIR=\"$(datadir)/mapitest/lzxpress\" \
-DLZFU_DATADIR=\"$(datadir)/mapitest/lzfu\" \
Expand Down
20 changes: 20 additions & 0 deletions configure.ac
Expand Up @@ -332,6 +332,26 @@ pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_pyth
AC_MSG_RESULT($pythondir)
AC_SUBST(pythondir)

dnl ----------------------------------------------------------------------------
dnl Check for MYSQL client libraries
dnl ----------------------------------------------------------------------------
AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
if test x"$MYSQL_CONFIG" = x""; then
AC_MSG_WARN([No version of mysql_config was found!])
AC_MSG_ERROR([Please install libmysqlclient-dev])
fi
AC_SUBST(MYSQL_CONFIG)

AC_MSG_CHECKING(mysql cflags)
MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
AC_MSG_RESULT($MYSQL_CFLAGS)
AC_SUBST(MYSQL_CFLAGS)

AC_MSG_CHECKING(mysql libs)
MYSQL_LIBS=`$MYSQL_CONFIG --libs`
AC_MSG_RESULT($MYSQL_LIBS)
AC_SUBST(MYSQL_LIBS)

dnl ----------------------------------------------------------------------------
dnl Check for Flex
dnl ----------------------------------------------------------------------------
Expand Down
74 changes: 74 additions & 0 deletions mapiproxy/libmapiproxy/backends/openchangedb_backends.h
@@ -0,0 +1,74 @@
#ifndef __OPENCHANGEDB_BACKEND_H__
#define __OPENCHANGEDB_BACKEND_H__

#include <stdint.h>
#include <stdbool.h>
#include <talloc.h>
#include <gen_ndr/exchange.h>

struct openchangedb_context {
enum MAPISTATUS (*get_new_changeNumber)(struct openchangedb_context *, uint64_t *);
enum MAPISTATUS (*get_new_changeNumbers)(struct openchangedb_context *, TALLOC_CTX *, uint64_t, struct UI8Array_r **);
enum MAPISTATUS (*get_next_changeNumber)(struct openchangedb_context *, uint64_t *);
enum MAPISTATUS (*get_SpecialFolderID)(struct openchangedb_context *, const char *, uint32_t, uint64_t *);
enum MAPISTATUS (*get_SystemFolderID)(struct openchangedb_context *, const char *, uint32_t, uint64_t *);
enum MAPISTATUS (*get_PublicFolderID)(struct openchangedb_context *, uint32_t, uint64_t *);
enum MAPISTATUS (*get_distinguishedName)(TALLOC_CTX *, struct openchangedb_context *, uint64_t, char **);
enum MAPISTATUS (*get_MailboxGuid)(struct openchangedb_context *, const char *, struct GUID *);
enum MAPISTATUS (*get_MailboxReplica)(struct openchangedb_context *, const char *, uint16_t *, struct GUID *);
enum MAPISTATUS (*get_PublicFolderReplica)(struct openchangedb_context *, uint16_t *, struct GUID *);
enum MAPISTATUS (*get_parent_fid)(struct openchangedb_context *, const char *, uint64_t, uint64_t *, bool);
enum MAPISTATUS (*get_MAPIStoreURIs)(struct openchangedb_context *, const char *, TALLOC_CTX *, struct StringArrayW_r **);
enum MAPISTATUS (*get_mapistoreURI)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint64_t, char **, bool);
enum MAPISTATUS (*set_mapistoreURI)(struct openchangedb_context *, const char *, uint64_t, const char *);
enum MAPISTATUS (*get_fid)(struct openchangedb_context *, const char *, uint64_t *);
enum MAPISTATUS (*get_ReceiveFolder)(TALLOC_CTX *, struct openchangedb_context *, const char *, const char *, uint64_t *, const char **);
enum MAPISTATUS (*get_TransportFolder)(struct openchangedb_context *, const char *, uint64_t *);
enum MAPISTATUS (*lookup_folder_property)(struct openchangedb_context *, uint32_t, uint64_t);
enum MAPISTATUS (*set_folder_properties)(struct openchangedb_context *, const char *, uint64_t, struct SRow *);
enum MAPISTATUS (*get_folder_property)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint32_t, uint64_t, void **);
enum MAPISTATUS (*get_folder_count)(struct openchangedb_context *, const char *, uint64_t, uint32_t *);
enum MAPISTATUS (*get_message_count)(struct openchangedb_context *, const char *, uint64_t, uint32_t *, bool);
enum MAPISTATUS (*get_system_idx)(struct openchangedb_context *, const char *, uint64_t, int *);
enum MAPISTATUS (*get_table_property)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint32_t, uint32_t, void **);
enum MAPISTATUS (*get_fid_by_name)(struct openchangedb_context *, const char *, uint64_t, const char*, uint64_t *);
enum MAPISTATUS (*get_mid_by_subject)(struct openchangedb_context *, const char *, uint64_t, const char *, bool, uint64_t *);
enum MAPISTATUS (*set_ReceiveFolder)(struct openchangedb_context *, const char *, const char *, uint64_t);
enum MAPISTATUS (*create_mailbox)(struct openchangedb_context *, const char *, int, uint64_t, const char *);
enum MAPISTATUS (*create_folder)(struct openchangedb_context *, const char *, uint64_t, uint64_t, uint64_t, const char *, int);
enum MAPISTATUS (*delete_folder)(struct openchangedb_context *, const char *, uint64_t);
enum MAPISTATUS (*get_fid_from_partial_uri)(struct openchangedb_context *, const char *, uint64_t *);
enum MAPISTATUS (*get_users_from_partial_uri)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint32_t *, char ***, char ***);

enum MAPISTATUS (*table_init)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint8_t, uint64_t, void **);
enum MAPISTATUS (*table_set_sort_order)(struct openchangedb_context *, void *, struct SSortOrderSet *);
enum MAPISTATUS (*table_set_restrictions)(struct openchangedb_context *, void *, struct mapi_SRestriction *);
enum MAPISTATUS (*table_get_property)(TALLOC_CTX *, struct openchangedb_context *, void *, enum MAPITAGS, uint32_t, bool, void **);

enum MAPISTATUS (*message_create)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint64_t, uint64_t, bool, void **);
enum MAPISTATUS (*message_save)(struct openchangedb_context *, void *, uint8_t);
enum MAPISTATUS (*message_open)(TALLOC_CTX *, struct openchangedb_context *, const char *, uint64_t, uint64_t, void **, void **);
enum MAPISTATUS (*message_get_property)(TALLOC_CTX *, struct openchangedb_context *, void *, uint32_t, void **);
enum MAPISTATUS (*message_set_properties)(TALLOC_CTX *, struct openchangedb_context *, void *, struct SRow *);

enum MAPISTATUS (*transaction_start)(struct openchangedb_context *);
enum MAPISTATUS (*transaction_commit)(struct openchangedb_context *);

enum MAPISTATUS (*get_new_public_folderID)(struct openchangedb_context *, const char *, uint64_t *);
bool (*is_public_folder_id)(struct openchangedb_context *, uint64_t);

const char * (*get_indexing_url)(struct openchangedb_context *, const char *);

bool (*set_locale)(struct openchangedb_context *, const char *, uint32_t);

const char **(*get_folders_names)(TALLOC_CTX *, struct openchangedb_context *, const char *, const char *);
const char *backend_type;
void *data;
};

const char *nil_string;


#define TRANSPORT_FOLDER_SYSTEM_IDX 14

#endif /* __OPENCHANGEDB_BACKEND_H__ */

0 comments on commit d52fefd

Please sign in to comment.