Skip to content

Commit

Permalink
Merge pull request #13 from mambaru/mambaru
Browse files Browse the repository at this point in the history
Mambaru
  • Loading branch information
migashko authored Mar 13, 2019
2 parents 54306b2 + c5e6398 commit e95125b
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 17 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ if ( WFC_ENABLE_STAT OR BUILD_TESTING)
add_definitions(-DWFC_ENABLE_STAT)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(ci)

include(cmake/ci.cmake)
rootlibs(faslib wjson wlog wflow iow wjrpc wrtstat)

include_directories(.)
Expand All @@ -18,7 +16,9 @@ add_subdirectory(wfc)
if ( BUILD_TESTING )
enable_testing()
add_subdirectory(tests)
add_subdirectory(examples)
if ( WITH_SAMPLES )
add_subdirectory(examples)
endif()
endif()


Expand Down
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,25 @@ build:
mkdir -p build
static: external build
cd build && cmake .. -DBUILD_SHARED_LIBS=OFF
cmake --build ./build
cmake --build ./build -- -j4
shared: external build
mkdir -p build
cd build && cmake .. -DBUILD_SHARED_LIBS=ON
cmake --build ./build
cd build && cmake .. -DBUILD_SHARED_LIBS=ON
cmake --build ./build -- -j4
tests: external build
cd build && cmake .. -DBUILD_TESTING=ON
cmake --build ./build
cmake --build ./build -- -j4
cd build && ctest
paranoid: external build
cd build && cmake .. -DBUILD_TESTING=ON -DPARANOID_WARNING=ON
cmake --build ./build -- -j4
debug: external build
cd build && cmake .. -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE="Debug"
cmake --build ./build -- -j4
coverage: external build doc
cd build && cmake .. -DCODE_COVERAGE=ON
cmake --build ./build -- -j4
cd build && ctest
if [ -f "./.ci/coverage-report.sh" ]; then ./.ci/coverage-report.sh docs/html/cov-report ; fi
clean:
rm -rf docs
cd build && make clean
Expand Down
8 changes: 6 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[![pipeline status](http://github.lan/cpp/wfc/badges/wip-devel/pipeline.svg)](http://github.lan/cpp/wfc/commits/wip-devel)
[![coverage report](http://github.lan/cpp/wfc/badges/wip-devel/coverage.svg)](http://github.lan/cpp/wfc/commits/wip-devel)

WFC - это фреймворк для разработки высконагруженных JSON-RPC сервисов (демонов) под различные профили нагрузки. Данный проект является частью этого фреймворка, но не им самим.
Если вас интересует как быстро сделать свой первый проект на базе этого фреймворка обратитесь к документации [wfcroot](https://github.com/mambaru/wfcroot) или изучите
[Демо-проект](https://github.com/mambaru/demod).

Документация [doxygen](https://mambaru.github.io/wfc/index.html).
Репозитарий на [github.com](https://github.com/mambaru/wfc).
* Репозитарий на [github.com](https://github.com/mambaru/wfc).
* Документация [doxygen](https://mambaru.github.io/wfc/index.html).
* Отчет [coverage](https://mambaru.github.io/wfc/cov-report/index.html)

# Сборка и установка

Expand Down
2 changes: 1 addition & 1 deletion cmake/ci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ if ( STANDALONE )
EXIT_CODE
)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/cmake-ci/cmake)
include(opt)
include(repos)
include(getlibs)

endif()
2 changes: 1 addition & 1 deletion external/cmake-ci
51 changes: 47 additions & 4 deletions wfc/module/testing_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,58 @@ class testing_domain
auto inst = std::make_shared< instance<D> >();
inst->create(opt.name, _g);
inst->configure(opt);
inst->initialize();
inst->start("");
for (auto pobj: _inst_list)
pobj->initialize();
_inst_list.push_back(inst);
return inst->object();
}

void initialize()
{
auto li = startup_sorted_();
initialized = true;
for (auto pobj: li)
pobj->initialize();
}

void start(const std::string& args = std::string())
{
if (!initialized)
this->initialize();
started = true;
auto li = startup_sorted_();
for (auto pobj: li)
pobj->start(args);
}

void stop(const std::string& args = std::string())
{
auto li = shutdown_sorted_();
for (auto pobj: li)
pobj->stop(args);
started = false;
initialized = false;
}

std::shared_ptr<wfcglobal> global() const { return _g; }
private:
std::vector<iinterface_ptr> startup_sorted_()
{
std::vector<iinterface_ptr> il(_inst_list.begin(), _inst_list.end() );
std::sort(il.begin(), il.end(), [](const iinterface_ptr& l, const iinterface_ptr& r){
return l->startup_priority() < r->startup_priority();
});
return il;
}
std::vector<iinterface_ptr> shutdown_sorted_()
{
std::vector<iinterface_ptr> il(_inst_list.begin(), _inst_list.end() );
std::sort(il.begin(), il.end(), [](const iinterface_ptr& l, const iinterface_ptr& r){
return l->shutdown_priority() < r->shutdown_priority();
});
return il;
}
private:
bool initialized = false;
bool started = false;
std::shared_ptr<wfcglobal> _g;
asio::io_service _io;
std::list<iinterface_ptr> _inst_list;
Expand Down

0 comments on commit e95125b

Please sign in to comment.