Changing the stream subscription structure
This commit is contained in:
1 parent
ab32055416
commit
619b49ee6c
1 file changed
+30
-7
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <typeindex>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
// this file has all the classes that represent streaming tabular data
|
||||
// schema ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -134,8 +135,8 @@ class StreamTable {
|
||||
|
||||
private:
|
||||
const StreamSchema &_schema;
|
||||
}; // namespace bts::streams
|
||||
// stream updates and subscription ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
// stream updates and subscription ////////////////////////////////////////////
|
||||
class StreamUpdate {
|
||||
public:
|
||||
const StreamTable &complete_state;
|
||||
@@ -148,15 +149,37 @@ class StreamUpdate {
|
||||
: complete_state(complete_state_), deleted_ids(deleted_ids_),
|
||||
added_rows(added_rows_) {}
|
||||
};
|
||||
|
||||
class DirectSubsription {};
|
||||
class CloudSubscirption {};
|
||||
// template <
|
||||
// typename T,
|
||||
// typename = std::enable_if_t<
|
||||
// std::is_same<T, DirectSubsription>::value ||
|
||||
// std::is_same<T, CloudSubscirption>::value>>
|
||||
|
||||
class StreamSubscription {
|
||||
private:
|
||||
std::variant<DirectSubsription, CloudSubscirption> subscription;
|
||||
const size_t _sub_id;
|
||||
|
||||
public:
|
||||
StreamSubscription(const DirectSubsription &, size_t subscription_id_)
|
||||
: _sub_id(subscription_id_) {}
|
||||
StreamSubscription(const CloudSubscirption &, size_t subscription_id_)
|
||||
: _sub_id(subscription_id_) {}
|
||||
size_t sub_id() const { return _sub_id; }
|
||||
};
|
||||
|
||||
class IStreamSync {
|
||||
public:
|
||||
virtual void on_stream_update(
|
||||
size_t sub_id, const StreamUpdate &stream_update) = 0;
|
||||
const StreamSubscription &, const StreamUpdate &stream_update) = 0;
|
||||
};
|
||||
|
||||
class StreamSource {
|
||||
public:
|
||||
void subscribe_stream_expression(
|
||||
std::string &, size_t, bool, IStreamSync &) {}
|
||||
void subscribe_cloud_stream(std::string &, size_t, IStreamSync &) {}
|
||||
void subscribe_stream_expression(const StreamSubscription &, IStreamSync &) {
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace bts::streams
|
||||
Reference in new issue
Block a user