Skip to content

Commit

Permalink
add some code
Browse files Browse the repository at this point in the history
  • Loading branch information
wangtao07 committed Aug 27, 2018
1 parent 7411cd8 commit cf166d8
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.8)

project (photon)

include_directories(./src)

aux_source_directory(./src SRCS)

link_libraries(brpc protobuf gflags leveldb pthread ssl crypto dl rt)

add_definitions(-std=c++11 -static)

add_executable(photon ${SRCS})

add_custom_target(output command echo "hello")
51 changes: 51 additions & 0 deletions idl/photon.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package photon

option cc_generic_services = true;

message Key {
optional bytes key = 1;
};

message KeySet {
repeated bytes keys = 1;
};

message Value {
optional bytes value = 1;
};

message ValueSet {
repeated bytes values = 1;
};

message Record {
optional bytes key = 1;
optional bytes value = 2;
};

message RecordSet {
repeated bytes keys = 1;
repeated bytes values = 2;
};

message Status {
optional int32 ret = 1;
optional string msg = 2;
optional Value value = 3;
};

message StatusSet {
optional int32 ret = 1;
optional string msg = 2;
repeated Status statuses = 3;
};

rpc PhotonDBService {
rpc get(Key) returns(Status)
rpc mget(KeySet) returns(StatusSet)
rpc set(Record) returns(Status)
rpc mset(RecordSet) returns(StatusSet)
};

rpc PhotonCMDService {
};
14 changes: 14 additions & 0 deletions src/entry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//**********************************************************
// File: table.h
// Author: [email protected]
// Description:
//**********************************************************

#pragma once

namespace photon {

class Entry {
}; // class Entry

} // namespace photon
13 changes: 13 additions & 0 deletions src/error.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//**********************************************************
// File: error.h
// Author: [email protected]
// Description:
//**********************************************************

namespace photon {

enum class ErrorCode {

}; // enum class ErrorCode

} // namespace photon
21 changes: 21 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//**********************************************************
// File: main.cpp
// Author: [email protected]
// Description: Main Entry of Photon
//**********************************************************

#include <gflags/gflags.h>

namespace photon {

int run(int argc, char** argv) {
google::ParseCommandLineFlags(&argc, &argv, true);

return 0;
}

} // namespace photon

int main(int argc, char** argv) {
return ::photon::run(argc, argv);
}
14 changes: 14 additions & 0 deletions src/options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//**********************************************************
// File: options.h
// Author: [email protected]
// Description:
//**********************************************************

#pragma once

namespace photon {

class Options {
}; // class Options

} // namespace photon
17 changes: 17 additions & 0 deletions src/segment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//**********************************************************
// File: segment.cpp
// Author: [email protected]
// Description:
//**********************************************************

#include "segment.h"

namespace photon {

Segment::Segment() {
}

Segment::~Segment() {
}

} // namespace photon
18 changes: 18 additions & 0 deletions src/segment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//**********************************************************
// File: segment.h
// Author: [email protected]
// Description:
//**********************************************************

#pragma once

namespace photon {

class Segment {
public:
Segment();

~Segment();
}; // class Segment

} // namespace photon
24 changes: 24 additions & 0 deletions src/service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//**********************************************************
// File: service.h
// Author: [email protected]
// Description: Main Entry of Photon
//**********************************************************

#pragma once

namespace photon {

class Service {
public:
Service();

~Service();

int start();

int stop();

int join();
}; // class Service

} // namespace photon
17 changes: 17 additions & 0 deletions src/table.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//**********************************************************
// File: table.cpp
// Author: [email protected]
// Description:
//**********************************************************

#include "table.h"

namespace photon {

Table::Table() {
}

Table::~Table() {
}

} // namespace photon
18 changes: 18 additions & 0 deletions src/table.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//**********************************************************
// File: table.h
// Author: [email protected]
// Description:
//**********************************************************

#pragma once

namespace photon {

class Table {
public:
Table();

~Table();
}; // class Table

} // namespace photon

0 comments on commit cf166d8

Please sign in to comment.