Skip to content

Commit 76406b1

Browse files
committed
embedded
1 parent 036bc08 commit 76406b1

File tree

2 files changed

+57
-24
lines changed

2 files changed

+57
-24
lines changed

embedded/build.bat

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@echo off
2+
3+
echo THIS IS EXPERIMENTAL.
4+
echo YMMV
5+
echo see embedded.h for how to use
6+
7+
echo todo: make this a make or scons file
8+
9+
echo vcvars.bat or the like should be ran before this file. if done, the
10+
echo following will print something reasonable:
11+
echo CL.EXE
12+
cl
13+
14+
pause
15+
16+
cd ../../mongo
17+
18+
echo first run "scons mongod" in ../../mongo to make all the ``.obj files needed for mongod.lib
19+
20+
cmd /C scons -j 4 mongod
21+
22+
pause
23+
24+
echo now make libmongod
25+
26+
echo libmongod...
27+
lib /OUT:mongod.lib pch.obj buildinfo.obj db/common.obj db/jsobj.obj bson/oid.obj db/json.obj db/lasterror.obj db/nonce.obj db/queryutil.obj db/projection.obj shell/mongo.obj util/background.obj util/mmap.obj util/sock.obj util/util.obj util/message.obj util/assert_util.obj util/log.obj util/httpclient.obj util/md5main.obj util/base64.obj util/concurrency/vars.obj util/concurrency/task.obj util/debug_util.obj util/concurrency/thread_pool.obj util/password.obj util/version.obj util/signal_handlers.obj util/histogram.obj util/concurrency/spin_lock.obj util/text.obj util/stringutils.obj util/processinfo.obj util/concurrency/synchronization.obj util/md5.obj client/connpool.obj client/dbclient.obj client/dbclientcursor.obj client/model.obj client/syncclusterconnection.obj client/distlock.obj s/shardconnection.obj util/mmap_win.obj util/processinfo_win32.obj db/commands.obj util/message_server_port.obj client/parallel.obj util/miniwebserver.obj db/dbwebserver.obj db/matcher.obj db/indexkey.obj db/dbcommands_generic.obj db/stats/counters.obj db/stats/service_stats.obj db/stats/snapshots.obj db/stats/top.obj scripting/engine.obj scripting/utils.obj scripting/bench.obj scripting/engine_spidermonkey.obj util/logfile.obj util/alignedbuilder.obj db/mongommf.obj db/dur.obj db/durop.obj db/dur_recover.obj db/dur_journal.obj db/query.obj db/update.obj db/introspect.obj db/btree.obj db/clientcursor.obj db/tests.obj db/repl.obj db/repl/rs.obj db/repl/consensus.obj db/repl/rs_initiate.obj db/repl/replset_commands.obj db/repl/manager.obj db/repl/health.obj db/repl/heartbeat.obj db/repl/rs_config.obj db/repl/rs_rollback.obj db/repl/rs_sync.obj db/repl/rs_initialsync.obj db/oplog.obj db/repl_block.obj db/btreecursor.obj db/cloner.obj db/namespace.obj db/cap.obj db/matcher_covered.obj db/dbeval.obj db/restapi.obj db/dbhelpers.obj db/instance.obj db/client.obj db/database.obj db/pdfile.obj db/cursor.obj db/security_commands.obj db/security.obj db/queryoptimizer.obj db/extsort.obj db/cmdline.obj db/index.obj db/geo/2d.obj db/geo/haystack.obj db/dbcommands.obj db/dbcommands_admin.obj db/commands/distinct.obj db/commands/group.obj db/commands/isself.obj db/commands/mr.obj db/driverHelpers.obj s/config.obj s/grid.obj s/chunk.obj s/shard.obj s/shardkey.obj s/d_logic.obj s/d_writeback.obj s/d_migrate.obj s/d_state.obj s/d_split.obj client/distlock_test.obj s/d_chunk_manager.obj s/d_background_splitter.obj db/module.obj db/modules/mms.obj
28+
29+
cd ../mongo-snippets/embedded
30+
31+
pause
32+
33+
echo eventually, embedded.obj could/should be in the above lib file
34+
35+
echo embedded.obj...
36+
cl /c /EHsc /I..\..\mongo\pcre-7.4 /I..\..\mongo /I..\..\mongo\db /IC:\boost /D_UNICODE /DUNICODE /DWIN32 /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /DHAVE_CONFIG_H /DPCRE_STATIC /DSUPPORT_UCP /DSUPPORT_UTF8 /DPSAPI_VERSION=1 /DNOEXECINFO "/IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" /TP /W3 /wd4355 /wd4800 /wd4267 /wd4244 /DMONGO_EXPOSE_MACROS embedded.cpp
37+
38+
pause
39+
40+
echo helloworld.obj...
41+
cl /c /EHsc /I..\..\mongo\pcre-7.4 /I..\..\mongo /I..\..\mongo\db /IC:\boost /D_UNICODE /DUNICODE /DWIN32 /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /DHAVE_CONFIG_H /DPCRE_STATIC /DSUPPORT_UCP /DSUPPORT_UTF8 /DPSAPI_VERSION=1 /DNOEXECINFO "/IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" /TP /W3 /wd4355 /wd4800 /wd4267 /wd4244 /DMONGO_EXPOSE_MACROS helloworld.cpp
42+
43+
pause
44+
45+
echo helloworld...
46+
link /OUT:helloworld /NODEFAULTLIB:MSVCPRT /NODEFAULTLIB:MSVCRT /LIBPATH:C:\boost\lib\vs2010_32 "/LIBPATH:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" ws2_32.lib kernel32.lib advapi32.lib Psapi.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib odbccp32.lib ..\..\mongo\mongod.lib embedded.obj helloworld.obj
47+
48+
echo build done
49+

embedded/embedded.cpp

100644100755
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
#include "dbwebserver.h"
4242
#include "dur.h"
4343
#include "concurrency.h"
44+
#if !defined(_WIN32)
4445
#include <sys/file.h>
46+
#endif
4547

4648
namespace mongo {
4749

@@ -461,11 +463,12 @@ namespace mongo {
461463
}
462464

463465
if (cmdLine.dur)
464-
enableDurability();
466+
dur::enableDurability();
465467

466468
getDur().startup();
467-
if( cmdLine.durTrace & CmdLine::DurRecoverOnly )
468-
return;
469+
470+
//if( cmdLine.durTrace & CmdLine::DurRecoverOnly )
471+
// return;
469472

470473
repairDatabasesAndCheckVersion();
471474

@@ -592,10 +595,6 @@ int initEmbeddedMongo(int argc, char* argv[])
592595
("ipv6", "enable IPv6 support (disabled by default)")
593596
;
594597

595-
#if defined(_WIN32)
596-
CmdLine::addWindowsOptions( windows_scm_options, hidden_options );
597-
#endif
598-
599598
replication_options.add_options()
600599
("fastsync", "indicate that this instance is starting from a dbpath snapshot of the repl peer")
601600
("autoresync", "automatically resync if slave data is stale")
@@ -617,12 +616,6 @@ int initEmbeddedMongo(int argc, char* argv[])
617616
("replSet", po::value<string>(), "specify repl set seed hostnames format <set id>/<host1>,<host2>,etc...")
618617
;
619618

620-
sharding_options.add_options()
621-
("configsvr", "declare this is a config db of a cluster; default port 27019; default dir /data/configdb")
622-
("shardsvr", "declare this is a shard db of a cluster; default port 27018")
623-
("noMoveParanoia" , "turn off paranoid saving of data for moveChunk. this is on by default for now, but default will switch" )
624-
;
625-
626619
hidden_options.add_options()
627620
("pretouch", po::value<int>(), "n pretouch threads for applying replicationed operations")
628621
("command", po::value< vector<string> >(), "command")
@@ -635,13 +628,9 @@ int initEmbeddedMongo(int argc, char* argv[])
635628

636629
positional_options.add("command", 3);
637630
visible_options.add(general_options);
638-
#if defined(_WIN32)
639-
visible_options.add(windows_scm_options);
640-
#endif
641631
visible_options.add(replication_options);
642632
visible_options.add(ms_options);
643633
visible_options.add(rs_options);
644-
visible_options.add(sharding_options);
645634
Module::addOptions( visible_options );
646635

647636
setupCoreSignals();
@@ -718,13 +707,8 @@ int initEmbeddedMongo(int argc, char* argv[])
718707
assert( false );
719708
#endif
720709
}
721-
if (params.count("durTrace")) {
722-
cmdLine.durTrace = params["durTrace"].as<int>();
723-
#if !defined(_DURABLE)
724-
assert( cmdLine.durTrace == 0 );
725-
#endif
726-
}
727-
if (params.count("objcheck")) {
710+
{
711+
// objcheck on for safety
728712
objcheck = true;
729713
}
730714
if (params.count("appsrvpath")) {

0 commit comments

Comments
 (0)