Skip to content

Commit

Permalink
all right version for set operator, delete unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
baotiao committed Feb 6, 2015
1 parent 1840557 commit ca2b47f
Show file tree
Hide file tree
Showing 190 changed files with 154 additions and 28,356 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CXX = g++
CXXFLAGS = -Wall -W -DDEBUG -g -O0 -D__XDEBUG__ -fPIC -Wno-unused-function
CXXFLAGS = -Wall -W -DDEBUG -g -O0 -D__XDEBUG1__ -fPIC -Wno-unused-function
OBJECT = tick
SRC_DIR = ./src
THIRD_PATH = ./third/
Expand All @@ -8,19 +8,16 @@ OUTPUT = ./output

INCLUDE_PATH = -I./include/ \
-I./src/ \
-I$(THIRD_PATH)/qbus/include/ \
-I$(THIRD_PATH)/glog-0.3.3/src/ \
-I$(THIRD_PATH)/leveldb/include/

LIB_PATH = -L./ \
-L$(THIRD_PATH)/qbus/lib/ \
-L$(THIRD_PATH)/glog-0.3.3/ \
-L/usr/local/lib/ \
-L$(THIRD_PATH)/leveldb/


LIBS = -lpthread \
-lqbusclient \
-lprotobuf \
-lleveldb

Expand All @@ -43,7 +40,6 @@ all: $(OBJECT)
mkdir $(OUTPUT)/third
cp -r ./conf $(OUTPUT)/
cp $(OBJECT) $(OUTPUT)/bin/
cp -r $(THIRD_PATH)/qbus/ $(OUTPUT)/third/
rm -rf $(OBJECT)
@echo "Success, go, go, go..."

Expand Down
8 changes: 1 addition & 7 deletions conf/pika.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Bada port
port : 9221
# Thread Number
thread_num : 16
thread_num : 3
# Tick log path
log_path : ./log/
# Tick glog level
log_level : 1
# QBus cluster
qbus_cluster : test
# Qbus conf path
qbus_conf_path : ./third/qbus/qbus-client.conf
# Qbus topic
qbus_topic : bada_statistics
6 changes: 0 additions & 6 deletions include/tick_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ class TickConf : public BaseConf
int thread_num() { return thread_num_; }
char* log_path() { return log_path_; }
int log_level() { return log_level_; }
char* qbus_cluster() { return qbus_cluster_; }
char* qbus_topic() { return qbus_topic_; }
char* qbus_conf_path() { return qbus_conf_path_; }

private:
int port_;
int thread_num_;
char log_path_[TICK_WORD_SIZE];
int log_level_;
char qbus_cluster_[TICK_WORD_SIZE];
char qbus_topic_[TICK_WORD_SIZE];
char qbus_conf_path_[TICK_WORD_SIZE];
};

#endif
8 changes: 5 additions & 3 deletions include/tick_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class TickConn
Status TickReadBuf();
Status TickWriteBuf();
void DriveMachine();
Status TickAReadHeader();
Status TickGetRequest();
int TickSendReply();

private:

Expand All @@ -32,7 +33,7 @@ class TickConn
Status TickReadPacket(rio_t *rio);


Status BuildObuf();
Status BuildObuf(int32_t opcode, const int packet_len);
/*
* The Variable need by read the buf,
* We allocate the memory when we start the server
Expand All @@ -43,10 +44,11 @@ class TickConn
int32_t cur_pos_;
int32_t rbuf_len_;

ConnStatus connStatus;
ConnStatus connStatus_;

char* wbuf_;
int32_t wbuf_len_;
int32_t wbuf_pos_;
TickThread *thread_;
};

Expand Down
3 changes: 2 additions & 1 deletion include/tick_epoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TickEpoll
TickEpoll();
~TickEpoll();
Status TickAddEvent(int fd, int mask);
Status TickDelEvent(int fd);
void TickDelEvent(int fd);
Status TickModEvent(int fd, int oMask, int mask);

int TickPoll();

Expand Down
4 changes: 1 addition & 3 deletions include/tick_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ class TickItem
public:
TickItem() {};
TickItem(int fd);
/*
* ~TickItem();
*/
~TickItem();

int fd() { return fd_; }

Expand Down
2 changes: 2 additions & 0 deletions include/tick_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

Status SetBufferParse(const int32_t opcode, const char *rbuf, const int32_t rbuf_len, std::string *key, std::string *value);

void SetBufferBuild(bool status, SdkSetRet *sdkSetRet);

#endif
7 changes: 3 additions & 4 deletions include/tick_server.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __TICK_H__
#define __TICK_H__
#ifndef __TICK_SERVER_H__
#define __TICK_SERVER_H__

#include <stdio.h>
#include <sys/epoll.h>
Expand All @@ -21,6 +21,7 @@

class TickThread;
class TickEpoll;
class TickConn;

class TickServer
{
Expand All @@ -33,8 +34,6 @@ class TickServer
static void* StartThread(void* arg);

private:


friend class TickConn;
Status SetBlockType(BlockType type);

Expand Down
19 changes: 2 additions & 17 deletions include/tick_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#include <pthread.h>
#include <sys/epoll.h>
#include <queue>
#include <map>

#include "port.h"
#include "tick_item.h"
#include "Qbus.h"
#include "status.h"
#include "csapp.h"

Expand Down Expand Up @@ -37,13 +38,6 @@ class TickThread

friend class TickServer;

/*
* Send msg to qbus
*/
bool SendMessage(const char *msg, int32_t len);



/*
* These two fd receive the notify from master thread
*/
Expand All @@ -63,15 +57,6 @@ class TickThread
std::map<int, TickConn *> conns_;


/*
* The QBus Client handler
*/
const char *qbus_cluster_;
const char *qbus_conf_path_;
std::string qbus_topic_;
KafkaProducer *producer_;


port::Mutex mutex_;

// No copy || assigned operator allowed
Expand Down
3 changes: 0 additions & 3 deletions src/tick_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ TickConf::TickConf(const char* path) :
getConfInt("thread_num", &thread_num_);
getConfStr("log_path", log_path_);
getConfInt("log_level", &log_level_);
getConfStr("qbus_cluster", qbus_cluster_);
getConfStr("qbus_topic", qbus_topic_);
getConfStr("qbus_conf_path", qbus_conf_path_);
}
Loading

0 comments on commit ca2b47f

Please sign in to comment.