Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local includes for Cascade files #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/cascade/cascade.hpp
Expand Up @@ -32,7 +32,7 @@
* TODO:
*/

#include <cascade/config.h>
#include "cascade/config.h"
#include "cascade_interface.hpp"
#include "volatile_store.hpp"
#include "persistent_store.hpp"
Expand Down
10 changes: 5 additions & 5 deletions include/cascade/cascade_interface.hpp
Expand Up @@ -5,7 +5,7 @@
* @brief Declarations of the interfaces of core Cascade types as Derecho Subgroup type.
*/

#include <cascade/config.h>
#include "cascade/config.h"

#include <derecho/core/derecho.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
Expand Down Expand Up @@ -147,7 +147,7 @@ class ICascadeStore {
* If `stable == false`, we only return the data reflecting the latest locally delivered atomic
* broadcast. Otherwise, stable data will be returned, meaning that the persisted states returned
* is safe: they will survive after whole system recovery.
* @param[in] exact
* @param[in] exact
* The exact match flag: this function try to return the value of that key at the 'ver'. If such a
* value does not exists and exact is true, it will throw an exception. If such a value does not
* exists and exact is false, it will return the latest state of the value for 'key' before 'ver'.
Expand Down Expand Up @@ -270,7 +270,7 @@ class ICascadeStore {
* @param[in] key The key
* @param[in] ver Version, if `ver == CURRENT_VERSION`, get the latest value.
* @param[in] stable
* @param[in] exact
* @param[in] exact
* The exact match flag: this function try to return the value of that key at the 'ver'. If such a
* value does not exists and exact is true, it will throw an exception. If such a value does not
* exists and exact is false, it will return the latest state of the value for 'key' before 'ver'.
Expand Down Expand Up @@ -423,7 +423,7 @@ VT create_null_object_cb(const KT& key = *IK);
* We use both the concepts of null and valid object in Cascade. A null object precisely means 'no data'; while a
* valid object literarily means an object is 'valid'. Technically, a null object has a valid key while invalid
* object does not.
*
*
* @tparam KT The key type.
* @tparam VT The value type.
*/
Expand Down Expand Up @@ -485,7 +485,7 @@ class IKeepVersion {

/**
* @brief The version getter
*
*
* Get the version
*
* @return The K/V object's version.
Expand Down
1 change: 1 addition & 0 deletions include/cascade/detail/debug_util.hpp
Expand Up @@ -3,6 +3,7 @@
#include "cascade/utils.hpp"

#include <derecho/conf/conf.hpp>

#include <map>
#include <memory>
#include <type_traits>
Expand Down
1 change: 1 addition & 0 deletions include/cascade/detail/persistent_store_impl.hpp
Expand Up @@ -9,6 +9,7 @@
#include <derecho/conf/conf.hpp>
#include <derecho/persistent/PersistentInterface.hpp>
#include <derecho/persistent/detail/PersistLog.hpp>

#include <fstream>
#include <map>
#include <memory>
Expand Down
5 changes: 3 additions & 2 deletions include/cascade/detail/prefix_registry.hpp
@@ -1,12 +1,13 @@
#pragma once

#include "cascade/config.h"

#include <functional>
#include <memory>
#include <unordered_map>
#include <vector>
#include <mutex>
#include <iostream>
#include <cascade/config.h>

namespace derecho {
namespace cascade {
Expand Down Expand Up @@ -116,7 +117,7 @@ class PrefixRegistry {
* @param path - the full path.
* @param collector - the lambda function to collect values for all prefixes of a string.
*
* @return
* @return
*/
void collect_values_for_prefixes(const std::string& path,
const std::function<void(const std::string& prefix,const std::shared_ptr<T>& value)>& collector) const;
Expand Down
9 changes: 5 additions & 4 deletions include/cascade/detail/prefix_registry_impl.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "cascade/utils.hpp"

#include <stdexcept>
#include <cstring>
#include <cascade/utils.hpp>

namespace derecho {
namespace cascade {
Expand Down Expand Up @@ -94,7 +95,7 @@ void PrefixRegistry<T, separator>::atomically_modify(const std::string& prefix,

auto components = str_tokenizer(prefix,true,separator);
std::lock_guard<std::mutex> lck(prefix_tree_mutex);

TreeNode* ptn = &prefix_tree;
for (const auto& comp:components) {
if (ptn->children.find(comp) == ptn->children.end()) {
Expand Down Expand Up @@ -143,7 +144,7 @@ void PrefixRegistry<T, separator>::TreeNode::dump(std::ostream& out, const std::
out << "nullptr";
}
out <<"; children:" << children.size() << ";}";
}
}

#ifdef PREFIX_REGISTRY_DEBUG
template <typename T, char separator>
Expand Down Expand Up @@ -202,7 +203,7 @@ void PrefixRegistry<T, separator>::collect_values_for_prefixes(
prefix = prefix + comp + separator;
if (ptn->children.find(comp) == ptn->children.end()) {
break;
}
}
ptn = ptn->children.at(comp).get();
if (ptn->value) {
collector(prefix,ptn->value);
Expand Down
12 changes: 7 additions & 5 deletions include/cascade/detail/service_impl.hpp
@@ -1,14 +1,16 @@
#include "cascade/config.h"
#include "cascade/data_flow_graph.hpp"

#include <derecho/core/derecho.hpp>
#include <derecho/core/derecho_exception.hpp>
#include <derecho/core/detail/rpc_utils.hpp>
#include <derecho/core/notification.hpp>
#include <vector>

#include <chrono>
#include <map>
#include <typeindex>
#include <variant>
#include <derecho/core/derecho.hpp>
#include <cascade/config.h>
#include <cascade/data_flow_graph.hpp>
#include <chrono>
#include <vector>

using namespace std::chrono_literals;

Expand Down
3 changes: 2 additions & 1 deletion include/cascade/detail/volatile_store_impl.hpp
Expand Up @@ -8,6 +8,7 @@
#include <derecho/conf/conf.hpp>
#include <derecho/persistent/PersistentInterface.hpp>
#include <derecho/persistent/detail/PersistLog.hpp>

#include <map>
#include <memory>
#include <string>
Expand Down Expand Up @@ -135,7 +136,7 @@ const VT VolatileCascadeStore<KT, VT, IK, IV>::get(const KT& key, const persiste
#else
#error Lockless support is currently for GCC only
#endif
/*
/*
* An out_of_range exception can be thrown even if 'key' exists in
* kv_map. Since std::map is not thread-safe, and there is another
* thread modifying kv_map concurrently, the internal data structure can
Expand Down
35 changes: 18 additions & 17 deletions include/cascade/object.hpp
@@ -1,21 +1,22 @@
#pragma once
#include "cascade/cascade_interface.hpp"
#include "cascade/config.h"

#include <derecho/conf/conf.hpp>
#include <derecho/core/derecho.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/persistent/Persistent.hpp>

#include <chrono>
#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
#include <optional>
#include <tuple>

#include <derecho/conf/conf.hpp>
#include <derecho/core/derecho.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/persistent/Persistent.hpp>

#include <cascade/cascade.hpp>
#include <vector>

using namespace persistent;
using namespace std::chrono_literals;
Expand Down Expand Up @@ -113,7 +114,7 @@ class ObjectWithUInt64Key : public mutils::ByteRepresentable,
// bool operator==(const ObjectWithUInt64Key& other);

// constructor 0 : copy constructor
ObjectWithUInt64Key(const uint64_t _key,
ObjectWithUInt64Key(const uint64_t _key,
const Blob& _blob);

// constructor 0.5 : copy/emplace constructor
Expand Down Expand Up @@ -225,11 +226,11 @@ inline std::ostream& operator<<(std::ostream& out, const Blob& b) {
}

inline std::ostream& operator<<(std::ostream& out, const ObjectWithUInt64Key& o) {
out << "ObjectWithUInt64Key{ver: 0x" << std::hex << o.version << std::dec
<< ", ts(us): " << o.timestamp_us
out << "ObjectWithUInt64Key{ver: 0x" << std::hex << o.version << std::dec
<< ", ts(us): " << o.timestamp_us
<< ", prev_ver: " << std::hex << o.previous_version << std::dec
<< ", prev_ver_by_key: " << std::hex << o.previous_version_by_key << std::dec
<< ", id:" << o.key
<< ", id:" << o.key
<< ", data:" << o.blob << "}";
return out;
}
Expand All @@ -256,7 +257,7 @@ class ObjectWithStringKey : public mutils::ByteRepresentable,
// bool operator==(const ObjectWithStringKey& other);

// constructor 0 : copy constructor
ObjectWithStringKey(const std::string& _key,
ObjectWithStringKey(const std::string& _key,
const Blob& _blob);

// constructor 0.5 : copy/in-place constructor
Expand Down Expand Up @@ -352,15 +353,15 @@ class ObjectWithStringKey : public mutils::ByteRepresentable,
};

inline std::ostream& operator<<(std::ostream& out, const ObjectWithStringKey& o) {
out << "ObjectWithStringKey{"
out << "ObjectWithStringKey{"
#ifdef ENABLE_EVALUATION
<< "msg_id: " << o.message_id
#endif
<< "ver: 0x" << std::hex << o.version << std::dec
<< "ver: 0x" << std::hex << o.version << std::dec
<< ", ts: " << o.timestamp_us
<< ", prev_ver: " << std::hex << o.previous_version << std::dec
<< ", prev_ver_by_key: " << std::hex << o.previous_version_by_key << std::dec
<< ", id:" << o.key
<< ", id:" << o.key
<< ", data:" << o.blob << "}";
return out;
}
Expand Down
7 changes: 4 additions & 3 deletions include/cascade/object_pool_metadata.hpp
@@ -1,8 +1,9 @@
#pragma once
#include <hs/hs.h>
#include "object.hpp"
#include "utils.hpp"

#include <hs/hs.h>

namespace derecho {
namespace cascade {

Expand Down Expand Up @@ -33,7 +34,7 @@ class ObjectPoolMetadata : public mutils::ByteRepresentable
,public ICascadeObject<std::string,ObjectPoolMetadata<CascadeTypes...>>
,public IKeepTimestamp
,public IValidator<std::string,ObjectPoolMetadata<CascadeTypes...>>
,public IVerifyPreviousVersion
,public IVerifyPreviousVersion
#ifdef ENABLE_EVALUATION
,public IHasMessageID
#endif
Expand Down Expand Up @@ -408,7 +409,7 @@ bool ObjectPoolMetadata<CascadeTypes...>::check_pathname_format(const std::strin
if (pathname.empty()) {
return true; // empty string is allowed to represent an invalid Metadata object.
}
if ((pathname.front() != PATH_SEPARATOR) ||
if ((pathname.front() != PATH_SEPARATOR) ||
(pathname.back() == PATH_SEPARATOR) ||
(pathname.find(' ') != std::string::npos) ||
(pathname.find('\t') != std::string::npos) ||
Expand Down
32 changes: 17 additions & 15 deletions include/cascade/service.hpp
Expand Up @@ -15,31 +15,33 @@
* server will load them on restart.
*/

#include <cstdint>
#include "cascade.hpp"
#include "data_flow_graph.hpp"
#include "detail/prefix_registry.hpp"
#include "object_pool_metadata.hpp"
#include "user_defined_logic_manager.hpp"
#include "utils.hpp"

#include <derecho/conf/conf.hpp>
#include <derecho/core/notification.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/persistent/PersistentInterface.hpp>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <typeinfo>
#include <tuple>
#include <derecho/utils/time.h>
#include <list>

#include <condition_variable>
#include <thread>
#include <cstdint>
#include <functional>
#include <iostream>
#include <list>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <thread>
#include <tuple>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <derecho/conf/conf.hpp>
#include "cascade.hpp"
#include "utils.hpp"
#include "object_pool_metadata.hpp"
#include "user_defined_logic_manager.hpp"
#include "data_flow_graph.hpp"
#include "detail/prefix_registry.hpp"

namespace derecho {
namespace cascade {
Expand Down
9 changes: 5 additions & 4 deletions include/cascade/service_types.hpp
@@ -1,8 +1,9 @@
#pragma once
#include <cascade/cascade.hpp>
#include <cascade/object.hpp>
#include <cascade/object_pool_metadata.hpp>
#include <cascade/service.hpp>
#include "cascade/cascade.hpp"
#include "cascade/object.hpp"
#include "cascade/object_pool_metadata.hpp"
#include "cascade/service.hpp"

#include <derecho/conf/conf.hpp>

#include <type_traits>
Expand Down
5 changes: 3 additions & 2 deletions include/cascade/utils.hpp
@@ -1,5 +1,7 @@
#pragma once

#include "cascade/config.h"

#include <functional>
#include <memory>
#include <map>
Expand All @@ -10,7 +12,6 @@
#include <time.h>
#include <thread>
#include <unordered_set>
#include <cascade/config.h>

namespace derecho {
namespace cascade {
Expand Down Expand Up @@ -163,7 +164,7 @@ class OpenLoopLatencyCollector: public OpenLoopLatencyCollectorClient {
#ifdef ENABLE_EVALUATION
/*
* time logger tags (TLTs)
*
*
* We support a wide range of timestamps in cascade for performance tests.
* For Service Client (Please note that the END time is not logged because the return clause should be included.
* The callers should measure it by themselves):
Expand Down