Permalink
Browse files

Compilation fixes for recent code

  • Loading branch information...
1 parent 30fbdc5 commit 2a292de9536a621f3236a9a76acfd80369b40abe groys committed Jun 7, 2010
View
2 examples/scribe_ctrl
@@ -22,7 +22,7 @@
import sys
#make this work for facebook environment too
-isFacebook = 1
+isFacebook = 0
if (isFacebook == 1):
# put your own path here!
sys.path.insert(0, '/mytrunk/fbcode-test/common/fb303/scripts')
View
10 src/Makefile.am
@@ -80,9 +80,10 @@ AM_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
# Static -- multiple libraries can be defined
if STATIC
-lib_LIBRARIES = libscribe.a
+lib_LIBRARIES = libscribe.a libdynamicbucketupdater.a
libscribe_a_SOURCES = gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp gen-cpp/scribe_constants.cpp
-INTERNAL_LIBS = libscribe.a
+libdynamicbucketupdater_a_SOURCES = gen-cpp/BucketStoreMapping.cpp gen-cpp/bucketupdater_constants.cpp gen-cpp/bucketupdater_types.cpp
+INTERNAL_LIBS = libscribe.a libdynamicbucketupdater.a
endif
# Shared -- multiple libraries can be defined
@@ -97,7 +98,7 @@ endif
# Binaries -- multiple progs can be defined.
bin_PROGRAMS = scribed
-scribed_SOURCES = store.cpp store_queue.cpp conf.cpp file.cpp HdfsFile.cpp conn_pool.cpp scribe_server.cpp $(FB_SOURCES) $(ENV_SOURCES)
+scribed_SOURCES = store.cpp store_queue.cpp conf.cpp file.cpp conn_pool.cpp scribe_server.cpp network_dynamic_config.cpp dynamic_bucket_updater.cpp $(FB_SOURCES) $(ENV_SOURCES)
if USE_SCRIBE_HDFS
scribed_SOURCES += HdfsFile.cpp
endif
@@ -111,7 +112,8 @@ endif
# Set up Thrift specific activity here.
# We assume that a <name>+types.cpp will always be built from <name>.thrift.
-$(eval $(call thrift_template,.,$(srcdir)/../if/scribe.thrift, -I $(fb303_home)/share/ --cpp --py --php))
+$(eval $(call thrift_template,.,$(srcdir)/../if/scribe.thrift, -I $(fb303_home)/share/ --cpp --py --php --java))
+$(eval $(call thrift_template,.,$(srcdir)/../if/bucketupdater.thrift, -I $(fb303_home)/share/ --cpp --py --php --java))
if FACEBOOK
$(eval $(call thrift_template,.,$(smc_home)/if/ServiceManager.thrift,--cpp))
View
18 src/common.h
@@ -46,24 +46,6 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
-#include "thrift/protocol/TBinaryProtocol.h"
-#include "thrift/server/TNonblockingServer.h"
-#include "thrift/concurrency/ThreadManager.h"
-#include "thrift/concurrency/PosixThreadFactory.h"
-#include "thrift/concurrency/Mutex.h"
-#include "thrift/transport/TSocket.h"
-#include "thrift/transport/TSocketPool.h"
-#include "thrift/transport/TServerSocket.h"
-#include "thrift/transport/TTransportUtils.h"
-#include "thrift/transport/THttpClient.h"
-#include "thrift/transport/TFileTransport.h"
-#include "fb303/FacebookBase.h"
-
-#include "src/gen-cpp/scribe.h"
-
-typedef boost::shared_ptr<scribe::thrift::LogEntry> logentry_ptr_t;
-typedef std::vector<logentry_ptr_t> logentry_vector_t;
-typedef std::vector<std::pair<std::string, int> > server_vector_t;
// For security reasons we can't release everything that's compiled
// in at facebook. Other users might find this useful as well for
View
8 src/conf.h
@@ -21,13 +21,7 @@
#ifndef SCRIBE_CONF_H
#define SCRIBE_CONF_H
-#include <string>
-#include <vector>
-#include <queue>
-#include <iostream>
-#include <fstream>
-
-#include "src/gen-cpp/scribe.h"
+#include "common.h"
/*
* This class reads and parses a configuration
View
9 src/dynamic_bucket_updater.cpp
@@ -1,8 +1,7 @@
#include <strstream>
#include <iostream>
-#include "thrift/lib/cpp/transport/TBufferTransports.h"
-#include "scribe/src/dynamic_bucket_updater.h"
-#include "scribe/src/scribe_server.h"
+#include "dynamic_bucket_updater.h"
+#include "scribe_server.h"
using namespace std;
using namespace apache::thrift::concurrency;
@@ -11,7 +10,7 @@ using namespace apache::thrift::transport;
using namespace facebook;
using namespace facebook::fb303;
using namespace scribe::thrift;
-
+using boost::shared_ptr;
extern shared_ptr<scribeHandler> g_Handler;
DynamicBucketUpdater* DynamicBucketUpdater::instance_ = NULL;
@@ -418,6 +417,7 @@ DynamicBucketUpdater* DynamicBucketUpdater::getInstance(
* Setup fb303 counters.
*/
void DynamicBucketUpdater::initFb303Counters() {
+#ifdef FACEBOOK
if (fbBase_) {
// initialize fb303 time series based counters
fbBase_->addStatExportType(
@@ -431,4 +431,5 @@ void DynamicBucketUpdater::initFb303Counters() {
fbBase_->addStatExportType(
DynamicBucketUpdater::FB303_ERR_NOMAPPING, stats::SUM);
}
+#endif
}
View
14 src/dynamic_bucket_updater.h
@@ -20,11 +20,11 @@
#ifndef SCRIBE_DYNAMIC_BUCKET_UPDATER_H
#define SCRIBE_DYNAMIC_BUCKET_UPDATER_H
-#include <map>
#include "common.h"
-#include "common/fb303/cpp/FacebookBase.h"
-#include "scribe/if/gen-cpp/BucketStoreMapping.h"
-#include "scribe/src/conf.h"
+#include "conf.h"
+
+using std::string;
+using std::map;
/**
* DynamicBucketUpdater updates a bucket store's bucket id to host:port
@@ -45,9 +45,9 @@ class DynamicBucketUpdater {
// missing a bid mapping
static const char *FB303_ERR_NOMAPPING;
- static bool getHost(const string& category, const StoreConf* pconf, std::string& host, uint32_t& port);
+ static bool getHost(const std::string& category, const StoreConf* pconf, std::string& host, uint32_t& port);
- static bool isConfigValid(const string& category, const StoreConf* pconf);
+ static bool isConfigValid(const std::string& category, const StoreConf* pconf);
/**
* Return host, port given a key and bucket id, bid, combination.
@@ -220,9 +220,11 @@ class DynamicBucketUpdater {
CatBidToHostMap catMap_;
void addStatValue(string name, uint64_t value) {
+#ifdef FACEBOOK
if (fbBase_) {
fbBase_->addStatValue(name, value);
}
+#endif
}
// make singleton
View
12 src/env_default.cpp
@@ -21,8 +21,8 @@
// @author Avinash Lakshman
// @author Anthony Giardullo
-#include "scribe/src/common.h"
-#include "scribe/src/scribe_server.h"
+#include "common.h"
+#include "scribe_server.h"
using namespace apache::thrift;
using namespace apache::thrift::protocol;
@@ -137,3 +137,11 @@ void scribe::startServer() {
server->serve();
// this function never returns
}
+
+
+/*
+ * Stopping a scribe server.
+ */
+void scribe::stopServer() {
+ exit(0);
+}
View
28 src/env_default.h
@@ -20,6 +20,29 @@
#ifndef SCRIBE_ENV
#define SCRIBE_ENV
+#include "thrift/protocol/TBinaryProtocol.h"
+#include "thrift/server/TNonblockingServer.h"
+#include "thrift/concurrency/ThreadManager.h"
+#include "thrift/concurrency/PosixThreadFactory.h"
+#include "thrift/concurrency/Mutex.h"
+#include "thrift/transport/TSocket.h"
+#include "thrift/transport/TSocketPool.h"
+#include "thrift/transport/TServerSocket.h"
+#include "thrift/transport/TTransportUtils.h"
+#include "thrift/transport/THttpClient.h"
+#include "thrift/transport/TFileTransport.h"
+#include "thrift/transport/TBufferTransports.h"
+#include "thrift/transport/TSimpleFileTransport.h"
+
+#include "fb303/FacebookBase.h"
+
+#include "src/gen-cpp/scribe.h"
+#include "src/gen-cpp/BucketStoreMapping.h"
+
+typedef boost::shared_ptr<scribe::thrift::LogEntry> logentry_ptr_t;
+typedef std::vector<logentry_ptr_t> logentry_vector_t;
+typedef std::vector<std::pair<std::string, int> > server_vector_t;
+
// scribe version
const std::string scribeversion("2.2");
#define DEFAULT_CONF_FILE_LOCATION "/usr/local/scribe/scribe.conf"
@@ -102,6 +125,11 @@ class strhash {
*/
void startServer();
+/*
+ * Stopping a scribe server.
+ */
+void stopServer();
+
} // !namespace scribe
#endif // SCRIBE_ENV
View
4 src/network_dynamic_config.cpp
@@ -17,8 +17,8 @@
//
// @author John Song
-#include "scribe/src/network_dynamic_config.h"
-#include "scribe/src/dynamic_bucket_updater.h"
+#include "network_dynamic_config.h"
+#include "dynamic_bucket_updater.h"
static NetworkDynamicConfigMod netConfigMods[] = {
{
View
2 src/network_dynamic_config.h
@@ -20,7 +20,7 @@
#ifndef SCRIBE_NETWORK_UPDATER_H
#define SCRIBE_NETWORK_UPDATER_H
-#include "scribe/src/conf.h"
+#include "conf.h"
// functional types for network dynamic updater validation and getHost calls
typedef bool (*NetworkIsConfigValidFunc)(const std::string& category, const StoreConf* pconf);
View
1 src/scribe_server.cpp
@@ -514,6 +514,7 @@ void scribeHandler::shutdown() {
stopStores();
// calling stop to allow thrift to clean up client states and exit
server->stop();
+ scribe::stopServer();
}
void scribeHandler::reinitialize() {
View
1 src/store.cpp
@@ -27,7 +27,6 @@
#include <algorithm>
#include "common.h"
#include "scribe_server.h"
-#include "thrift/lib/cpp/transport/TSimpleFileTransport.h"
#include "network_dynamic_config.h"
using namespace std;
View
8 src/store_queue.h
@@ -24,13 +24,7 @@
#ifndef SCRIBE_STORE_QUEUE_H
#define SCRIBE_STORE_QUEUE_H
-#include <string>
-#include <queue>
-#include <vector>
-#include <pthread.h>
-
-#include "src/gen-cpp/scribe.h"
-#include "store.h"
+#include "common.h"
class Store;
View
2 test/tests.php
@@ -23,7 +23,7 @@
include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocketPool.php';
-require_once $GLOBALS['SCRIBE_ROOT'].'/BucketStoreMapping.php';
+require_once $GLOBALS['SCRIBE_ROOT'].'/bucketupdater/BucketStoreMapping.php';
function reload_test($file) {
static $numTest = 0;

0 comments on commit 2a292de

Please sign in to comment.