Permalink
Browse files

Merge branch 'feature/ReplicaSetSupport' into develop

  • Loading branch information...
mtowers committed Aug 3, 2011
2 parents ae8d9c9 + 0cbcebf commit 7c00db2aea586aff5d627fb5e89e1f9858f86f86
Showing with 1,402 additions and 709 deletions.
  1. +5 −4 Makefile
  2. +10 −9 common.h
  3. +2 −0 main.cpp
  4. +8 −673 mongo_connection.cpp
  5. +2 −5 mongo_cursor.cpp
  6. +735 −0 mongo_dbclient.cpp
  7. +3 −3 mongo_gridfile.cpp
  8. +3 −6 mongo_gridfs.cpp
  9. +6 −6 mongo_gridfschunk.cpp
  10. +132 −0 mongo_replicaset.cpp
  11. +64 −0 tests/connection.lua
  12. +366 −0 tests/lunity.lua
  13. +64 −0 tests/replicaset.lua
  14. +2 −3 utils.cpp
View
@@ -8,16 +8,13 @@ OUTLIB=mongo.so
LDFLAGS= $(LIBS)
-OBJS = main.o mongo_bsontypes.o mongo_connection.o mongo_cursor.o mongo_gridfile.o mongo_gridfs.o mongo_gridfschunk.o mongo_query.o utils.o
+OBJS = main.o mongo_bsontypes.o mongo_dbclient.o mongo_replicaset.o mongo_connection.o mongo_cursor.o mongo_gridfile.o mongo_gridfs.o mongo_gridfschunk.o mongo_query.o utils.o
all: luamongo
clean:
$(RM) $(OBJS) $(OUTLIB)
-old: CFLAGS := $(CFLAGS) -DMONGO_PRE_1_5
-old: luamongo
-
luamongo: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(OUTLIB) $(LDFLAGS)
@@ -31,6 +28,8 @@ echo:
main.o: main.cpp utils.h
$(CC) -c -o $@ $< $(CFLAGS)
+mongo_dbclient.o: mongo_dbclient.cpp common.h utils.h
+ $(CC) -c -o $@ $< $(CFLAGS)
mongo_connection.o: mongo_connection.cpp common.h utils.h
$(CC) -c -o $@ $< $(CFLAGS)
mongo_cursor.o: mongo_cursor.cpp common.h utils.h
@@ -43,6 +42,8 @@ mongo_gridfschunk.o: mongo_gridfschunk.cpp common.h utils.h
$(CC) -c -o $@ $< $(CFLAGS)
mongo_query.o: mongo_query.cpp common.h utils.h
$(CC) -c -o $@ $< $(CFLAGS)
+mongo_replicaset.o: mongo_replicaset.cpp common.h utils.h
+ $(CC) -c -o $@ $< $(CFLAGS)
mongo_bsontypes.o: mongo_bsontypes.cpp common.h
$(CC) -c -o $@ $< $(CFLAGS)
utils.o: utils.cpp common.h utils.h
View
@@ -1,12 +1,17 @@
-#define LUAMONGO_ROOT "mongo"
-#define LUAMONGO_CONNECTION "mongo.Connection"
-#define LUAMONGO_CURSOR "mongo.Cursor"
-#define LUAMONGO_QUERY "mongo.Query"
+#define LUAMONGO_ROOT "mongo"
+#define LUAMONGO_CONNECTION "mongo.Connection"
+#define LUAMONGO_REPLICASET "mongo.ReplicaSet"
+#define LUAMONGO_CURSOR "mongo.Cursor"
+#define LUAMONGO_QUERY "mongo.Query"
#define LUAMONGO_GRIDFS "mongo.GridFS"
#define LUAMONGO_GRIDFILE "mongo.GridFile"
#define LUAMONGO_GRIDFSCHUNK "mongo.GridFSChunk"
+// not an actual class, pseudo-base for error messages
+#define LUAMONGO_DBCLIENT "mongo.DBClient"
+
#define LUAMONGO_ERR_CONNECTION_FAILED "Connection failed: %s"
+#define LUAMONGO_ERR_REPLICASET_FAILED "ReplicaSet.New failed: %s"
#define LUAMONGO_ERR_GRIDFS_FAILED "GridFS failed: %s"
#define LUAMONGO_ERR_GRIDFSCHUNK_FAILED "GridFSChunk failed: %s"
#define LUAMONGO_ERR_QUERY_FAILED "Query failed: %s"
@@ -22,8 +27,4 @@
#define LUAMONGO_NOT_IMPLEMENTED "Not implemented: %s.%s"
#define LUAMONGO_ERR_CALLING "Error calling %s.%s: %s"
-#if defined(MONGO_PRE_1_5)
- #define CHUNK Chunk
-#else
- #define CHUNK GridFSChunk
-#endif
+
View
@@ -38,6 +38,7 @@ extern "C" {
extern int mongo_bsontypes_register(lua_State *L);
extern int mongo_connection_register(lua_State *L);
+extern int mongo_replicaset_register(lua_State *L);
extern int mongo_cursor_register(lua_State *L);
extern int mongo_query_register(lua_State *L);
extern int mongo_gridfs_register(lua_State *L);
@@ -55,6 +56,7 @@ extern "C" {
LM_EXPORT int luaopen_mongo(lua_State *L) {
mongo_bsontypes_register(L);
mongo_connection_register(L);
+ mongo_replicaset_register(L);
mongo_cursor_register(L);
mongo_query_register(L);
Oops, something went wrong.

0 comments on commit 7c00db2

Please sign in to comment.