refactor(small): change default port of ghttp from 8080 to 9000
change default port; add infos of structure to kvstore; by zengli
This commit is contained in:
parent
ab9e6e9b45
commit
a1ed886364
|
@ -18,12 +18,21 @@
|
||||||
//add a \0 in tail: only add 1 char
|
//add a \0 in tail: only add 1 char
|
||||||
//QUERY: but to count the length each time maybe very costly?
|
//QUERY: but to count the length each time maybe very costly?
|
||||||
//No, because triple num is stored in char* now!!!! we do not need to save it again
|
//No, because triple num is stored in char* now!!!! we do not need to save it again
|
||||||
//TODO: entity_border in s2values list is not needed!!! not waste memory here
|
|
||||||
//
|
//
|
||||||
//QUERY: but to implement vlist, we need a unsigned flag
|
//QUERY: but to implement vlist, we need a unsigned flag
|
||||||
//What is more, we need to store the string in disk, how can we store it if without the length?
|
//What is more, we need to store the string in disk, how can we store it if without the length?
|
||||||
//unsigned type stored as chars, maybe will have '\0'
|
//unsigned type stored as chars, maybe will have '\0'
|
||||||
//In memory, we do not know when the oidlist ends if without the original length (butthe triple num will answer this!)
|
//In memory, we do not know when the oidlist ends if without the original length (butthe triple num will answer this!)
|
||||||
|
//
|
||||||
|
//TODO: entity_border in s2values list is not needed!!! not waste memory here
|
||||||
|
|
||||||
|
//STRUCT:
|
||||||
|
//1. s2xx
|
||||||
|
//Triple Num Pre Num Entity Num p1 offset1 p2 offset2 ... pn offsetn (olist-p1) (olist-p2) ... (olist-pn)
|
||||||
|
//2. o2xx
|
||||||
|
//Triple Num Pre Num p1 offset1 p2 offset2 ... pn offsetn (slist-p1) (slist-p2) ... (slist-pn)
|
||||||
|
//3. p2xx
|
||||||
|
//Triple Num (sid list) (oid list) (not sorted, matched with sid one by one)
|
||||||
|
|
||||||
class KVstore
|
class KVstore
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,21 +39,21 @@ int connection_num = 0;
|
||||||
//NOTICE: no need to close connection here due to the usage of shared_ptr
|
//NOTICE: no need to close connection here due to the usage of shared_ptr
|
||||||
//http://www.tuicool.com/articles/3Ub2y2
|
//http://www.tuicool.com/articles/3Ub2y2
|
||||||
//
|
//
|
||||||
//TODO: the URL format is terrible, i.e. 127.0.0.1:8080/build/lubm/data/LUBM_10.n3
|
//TODO: the URL format is terrible, i.e. 127.0.0.1:9000/build/lubm/data/LUBM_10.n3
|
||||||
//we should define some keys like operation, database, dataset, query, path ...
|
//we should define some keys like operation, database, dataset, query, path ...
|
||||||
//127.0.0.1:8080?operation=build&database=lubm&dataset=data/LUBM_10.n3
|
//127.0.0.1:9000?operation=build&database=lubm&dataset=data/LUBM_10.n3
|
||||||
//
|
//
|
||||||
//TODO: control the authority, check it if requesting for build/load/unload
|
//TODO: control the authority, check it if requesting for build/load/unload
|
||||||
//for sparql endpoint, just load database when starting, and comment out all functions except for query()
|
//for sparql endpoint, just load database when starting, and comment out all functions except for query()
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
Util util;
|
Util util;
|
||||||
//HTTP-server at port 8080 using 1 thread
|
//HTTP-server at port 9000 using 1 thread
|
||||||
//Unless you do more heavy non-threaded processing in the resources,
|
//Unless you do more heavy non-threaded processing in the resources,
|
||||||
//1 thread is usually faster than several threads
|
//1 thread is usually faster than several threads
|
||||||
HttpServer server;
|
HttpServer server;
|
||||||
server.config.port=8080;
|
//server.config.port=8080;
|
||||||
//server.config.port=9000;
|
server.config.port=9000;
|
||||||
//cout<<"after server built"<<endl;
|
//cout<<"after server built"<<endl;
|
||||||
|
|
||||||
//GET-example for the path /build/[db_name]/[db_path], responds with the matched string in path
|
//GET-example for the path /build/[db_name]/[db_path], responds with the matched string in path
|
||||||
|
@ -350,7 +350,7 @@ int main() {
|
||||||
this_thread::sleep_for(chrono::seconds(1));
|
this_thread::sleep_for(chrono::seconds(1));
|
||||||
|
|
||||||
// //Client examples
|
// //Client examples
|
||||||
// HttpClient client("localhost:8080");
|
// HttpClient client("localhost:9000");
|
||||||
// auto r1=client.request("GET", "/match/123");
|
// auto r1=client.request("GET", "/match/123");
|
||||||
// cout << r1->content.rdbuf() << endl;
|
// cout << r1->content.rdbuf() << endl;
|
||||||
|
|
||||||
|
|
25
NOTES.md
25
NOTES.md
|
@ -1,3 +1,28 @@
|
||||||
|
git commit: http://www.cnblogs.com/ctaodream/p/6066694.html
|
||||||
|
<type>(<scope>) : <subject>
|
||||||
|
<空行>
|
||||||
|
<body>
|
||||||
|
<空行>
|
||||||
|
<footer>
|
||||||
|
type:
|
||||||
|
+ fix :修复bug
|
||||||
|
+ doc : 文档改变
|
||||||
|
+ style : 代码格式改变
|
||||||
|
+ refactor :某个已有功能重构
|
||||||
|
+ perf :性能优化
|
||||||
|
+ test :增加测试
|
||||||
|
+ build :改变了build工具 如 grunt换成了 npm
|
||||||
|
+ revert: 撤销上一次的 commit
|
||||||
|
scope:用来说明此次修改的影响范围 可以随便填写任何东西,commitizen也给出了几个 如:location 、browser、compile,不过我推荐使用
|
||||||
|
all :表示影响面大 ,如修改了网络框架 会对真个程序产生影响
|
||||||
|
loation: 表示影响小,某个小小的功能
|
||||||
|
module:表示会影响某个模块 如登录模块、首页模块 、用户管理模块等等
|
||||||
|
subject: 用来简要描述本次改动,概述就好了
|
||||||
|
body:具体的修改信息 应该尽量详细
|
||||||
|
footer:放置写备注啥的,如果是 bug ,可以把bug id放入
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# NOTICE
|
# NOTICE
|
||||||
|
|
||||||
一般在实践应用中不是单机,而是CS模式,因为API也是基于CS模式的。
|
一般在实践应用中不是单机,而是CS模式,因为API也是基于CS模式的。
|
||||||
|
|
|
@ -388,7 +388,7 @@ namespace SimpleWeb {
|
||||||
if(config.proxy_server.empty())
|
if(config.proxy_server.empty())
|
||||||
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(host, std::to_string(port)));
|
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(host, std::to_string(port)));
|
||||||
else {
|
else {
|
||||||
auto proxy_host_port=parse_host_port(config.proxy_server, 8080);
|
auto proxy_host_port=parse_host_port(config.proxy_server, 9000);
|
||||||
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(proxy_host_port.first, std::to_string(proxy_host_port.second)));
|
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(proxy_host_port.first, std::to_string(proxy_host_port.second)));
|
||||||
}
|
}
|
||||||
resolver.async_resolve(*query, [this](const boost::system::error_code &ec,
|
resolver.async_resolve(*query, [this](const boost::system::error_code &ec,
|
||||||
|
|
Loading…
Reference in New Issue