merged speedy makefile
This commit is contained in:
commit
571d6ea541
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@
|
||||
.ycm_extra_conf.py
|
||||
.ycm_extra_conf.pyc
|
||||
*.swp
|
||||
*.swo
|
||||
*.out
|
||||
*.dSYM/
|
||||
|
37
data_structures/map/hashmap.hpp
Normal file
37
data_structures/map/hashmap.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef MEMGRAPH_DATA_STRUCTURES_LOCKFREE_HASHMAP_HPP
|
||||
#define MEMGRAPH_DATA_STRUCTURES_LOCKFREE_HASHMAP_HPP
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "threading/sync/lockable.hpp"
|
||||
#include "threading/sync/spinlock.hpp"
|
||||
|
||||
namespace lockfree
|
||||
{
|
||||
|
||||
template <class K, class V>
|
||||
class HashMap: Lockable<SpinLock>
|
||||
{
|
||||
public:
|
||||
|
||||
V at(const K& key)
|
||||
{
|
||||
auto guard = acquire();
|
||||
|
||||
return hashmap[key];
|
||||
}
|
||||
|
||||
void put(const K& key, const K& value)
|
||||
{
|
||||
auto quard = acquire();
|
||||
|
||||
hashmap[key] = value;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<K, V> hashmap;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
2
speedy/.gitignore
vendored
2
speedy/.gitignore
vendored
@ -2,3 +2,5 @@
|
||||
*.dSYM/
|
||||
*.gdb
|
||||
.gdb_history
|
||||
*.swp
|
||||
*.swo
|
||||
|
@ -1,6 +1,6 @@
|
||||
CXX=clang++
|
||||
CFLAGS=-std=c++11 -Wall -O2
|
||||
LDFLAGS=-luv -lhttp_parser ./r3/.libs/libr3.a /usr/lib/x86_64-linux-gnu/libpcre.a
|
||||
LDFLAGS=-luv -lhttp_parser ./r3/.libs/libr3.a -L/usr/local/lib -lpcre
|
||||
# debug only
|
||||
INC=-I../
|
||||
SOURCES=$(wildcard *.cpp)
|
||||
|
@ -18,13 +18,21 @@ make install -stdlib=libstdc++ -lstdc++ (OSX)
|
||||
make install
|
||||
```
|
||||
|
||||
* https://github.com/c9s/r3
|
||||
* https://github.com/c9s/r3 (git submodule)
|
||||
|
||||
```
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
* http://pcre.org/ (version 8.35, R3 dependency)
|
||||
|
||||
```
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
```
|
||||
|
||||
## NOTE
|
||||
|
@ -1,8 +1,16 @@
|
||||
/** @file speedy.hpp
|
||||
* @brief Speedy - Cpp Web Application Framework
|
||||
*
|
||||
* Blazingly fast web application framework. Designed like
|
||||
* http://expressjs.com, one of its mail goal is also simple usage.
|
||||
*
|
||||
* @author Dominik Tomicevic (domko)
|
||||
* @author Marko Budiselic (buda)
|
||||
*/
|
||||
#ifndef MEMGRAPH_SPEEDY_HPP
|
||||
#define MEMGRAPH_SPEEDY_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "io/uv/uv.hpp"
|
||||
#include "http/http.hpp"
|
||||
#include "r3_include.h"
|
||||
@ -15,10 +23,38 @@ typedef unsigned int uint;
|
||||
class Speedy
|
||||
{
|
||||
private:
|
||||
/*
|
||||
* http server instance that contains all logic related
|
||||
* to the http protocol
|
||||
*/
|
||||
http::HttpServer server;
|
||||
|
||||
/*
|
||||
* ip address of the server
|
||||
*/
|
||||
http::Ipv4 ip;
|
||||
|
||||
/*
|
||||
* root node of r3 decision tree
|
||||
*/
|
||||
node *n;
|
||||
|
||||
/*
|
||||
* callbacks container
|
||||
*/
|
||||
std::vector<http::request_cb_t> callbacks;
|
||||
|
||||
/** @brief Store a http callback.
|
||||
*
|
||||
* Every callback for now has receiving method and path (url).
|
||||
* So, the implementation of this method saves callback for
|
||||
* the method and the path.
|
||||
*
|
||||
* @param method int http defined method
|
||||
* @param path std::string path (url)
|
||||
* @param callback http::request_cb_t callback which will be called
|
||||
* on a http request
|
||||
*/
|
||||
void store_callback(int method,
|
||||
const std::string &path,
|
||||
http::request_cb_t callback);
|
||||
|
3
test/README.md
Normal file
3
test/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# NOTE
|
||||
Files with .old extension are old test files. They have to be rewritten because of changes in the appropriate project files.
|
||||
bitblock.hpp is going to be replaced with the dynamic_bitset
|
18
test/dynamic_bitset.cpp
Normal file
18
test/dynamic_bitset.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "catch.hpp"
|
||||
#include "data_structures/bitset/dynamic_bitset.hpp"
|
||||
|
||||
TEST_CASE("Dynamic bitset basic functionality")
|
||||
{
|
||||
DynamicBitset<> db;
|
||||
db.set(222555, 1);
|
||||
bool value = db.at(222555, 1);
|
||||
REQUIRE(value == true);
|
||||
|
||||
db.set(32, 1);
|
||||
value = db.at(32, 1);
|
||||
REQUIRE(value == true);
|
||||
|
||||
db.clear(32, 1);
|
||||
value = db.at(32, 1);
|
||||
REQUIRE(value == false);
|
||||
}
|
9
test/lockfree_hashmap.cpp
Normal file
9
test/lockfree_hashmap.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "catch.hpp"
|
||||
#include "data_structures/map/hashmap.hpp"
|
||||
|
||||
TEST_CASE("Lockfree HashMap basic functionality")
|
||||
{
|
||||
lockfree::HashMap<int, int> hashmap;
|
||||
hashmap.put(32, 10);
|
||||
REQUIRE(hashmap.at(32) == 10);
|
||||
}
|
Loading…
Reference in New Issue
Block a user