#define STREAM_SCHEMA 2
#define OPERATOR_VIEW_SCHEMA 3
#define UNPACK_FCNS_SCHEMA 4
+#define WATCHLIST_SCHEMA 5
+
// Represent a STREAM, PROTOCOL, OPERATOR_VIEW, or UNPACK_FCN list.
param_list *base_tables; // if PROTOCOL, the PROTOCOLS that
// this PROTOCOL inherits fields from.
int schema_type; // STREAM_SCHEMA, PROTOCOL_SCHEMA, OPERATOR_VIEW_SCHEMA
+ int schema_id; // the id associated with the protocol
+ std::set<int> all_schema_ids; // schema_id plus the inherited ones
// For operator_view tables
param_list *op_properties;
std::vector<subquery_spec *> qspec_list;
param_list *selpush;
+ std::vector<std::string> key_flds; // keys of a watchlist
public:
// for unpacking function group specs.
// get the PROTOCOL-wide unpack functions.
table_def(const char *name, param_list *plist, param_list *ufcn_l, field_entry_list *fel, int sch_t){
int f;
- if(plist == NULL)
+ schema_id = -1;
base_tables = new param_list();
- else
- base_tables = plist;
+ if(plist != NULL){
+ std::vector<std::string> pkeys = plist->get_key_vec();
+ for(int p=0;p<pkeys.size();++p){
+ std::string val = plist->val_of(pkeys[p]);
+ if(val!=""){
+ if(pkeys[p] == "schema_id" || pkeys[p] == "schemaId"){
+ schema_id = atoi(val.c_str());
+ if(schema_id <= 0){
+ fprintf(stderr,"Error, Protocol %s has a schema_id value of %d, must be larger than 0.\n",name, schema_id);
+ exit(1);
+ }
+ all_schema_ids.insert(schema_id);
+ }
+ }else{
+ base_tables->append(pkeys[p]);
+ }
+ }
+ }
table_name =name;
fields = fel->get_list();
schema_type = sch_t;
return op_properties->val_of(s);
};
+ void set_keys(const std::vector<std::string> &kf){
+ key_flds = kf;
+ }
+ std::vector<std::string> get_keys(){
+ return key_flds;
+ }
+
// Used in generating the LFTA prefilter
std::string get_field_basetable(std::string f);
int get_schema_type(){return schema_type;};
+ int get_schema_id(){return schema_id;};
+
+ std::set<int> get_all_schema_ids(){ return all_schema_ids;}
+ void add_to_all_schema_ids(int sid){
+ all_schema_ids.insert(sid);
+ }
+
+
std::vector<subquery_spec *> get_subqueryspecs(){return qspec_list;};
std::string to_string();
schema_type = tmp_sch;
return ret;
}
+
+ bool is_stream(){
+ return(schema_type == PROTOCOL_SCHEMA || schema_type == STREAM_SCHEMA || schema_type == OPERATOR_VIEW_SCHEMA);
+ }
};
return(tbl_list[t]->get_schema_type());
};
+ int get_schema_id(int t){
+ return(tbl_list[t]->get_schema_id());
+ };
+
+ bool is_stream(int t){
+ return tbl_list[t]->is_stream();
+ }
+
std::string get_op_prop(int t, std::string s){
return(tbl_list[t]->get_op_prop(s));
};