mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
introduce reader-info struct analogous to writer-info.
All tests still pass.
This commit is contained in:
parent
f820ee9f5c
commit
3559a39d59
11 changed files with 162 additions and 70 deletions
|
@ -71,7 +71,7 @@ declare(PDict, InputHash);
|
|||
class Manager::Stream {
|
||||
public:
|
||||
string name;
|
||||
string source;
|
||||
ReaderBackend::ReaderInfo info;
|
||||
bool removed;
|
||||
|
||||
ReaderMode mode;
|
||||
|
@ -81,7 +81,6 @@ public:
|
|||
EnumVal* type;
|
||||
ReaderFrontend* reader;
|
||||
TableVal* config;
|
||||
std::map<string, string> configmap;
|
||||
|
||||
RecordVal* description;
|
||||
|
||||
|
@ -330,8 +329,11 @@ bool Manager::CreateStream(Stream* info, RecordVal* description)
|
|||
info->reader = reader_obj;
|
||||
info->type = reader->AsEnumVal(); // ref'd by lookupwithdefault
|
||||
info->name = name;
|
||||
info->source = source;
|
||||
info->config = config->AsTableVal(); // ref'd by LookupWithDefault
|
||||
|
||||
ReaderBackend::ReaderInfo readerinfo;
|
||||
readerinfo.source = source;
|
||||
|
||||
Ref(description);
|
||||
info->description = description;
|
||||
|
||||
|
@ -345,13 +347,15 @@ bool Manager::CreateStream(Stream* info, RecordVal* description)
|
|||
ListVal* index = info->config->RecoverIndex(k);
|
||||
string key = index->Index(0)->AsString()->CheckString();
|
||||
string value = v->Value()->AsString()->CheckString();
|
||||
info->configmap.insert(std::make_pair(key, value));
|
||||
info->info.config.insert(std::make_pair(key, value));
|
||||
Unref(index);
|
||||
delete k;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
info->info = readerinfo;
|
||||
|
||||
|
||||
DBG_LOG(DBG_INPUT, "Successfully created new input stream %s",
|
||||
name.c_str());
|
||||
|
@ -477,7 +481,7 @@ bool Manager::CreateEventStream(RecordVal* fval)
|
|||
|
||||
assert(stream->reader);
|
||||
|
||||
stream->reader->Init(stream->source, stream->mode, stream->num_fields, logf, stream->configmap );
|
||||
stream->reader->Init(stream->info, stream->mode, stream->num_fields, logf );
|
||||
|
||||
readers[stream->reader] = stream;
|
||||
|
||||
|
@ -654,7 +658,7 @@ bool Manager::CreateTableStream(RecordVal* fval)
|
|||
|
||||
|
||||
assert(stream->reader);
|
||||
stream->reader->Init(stream->source, stream->mode, fieldsV.size(), fields, stream->configmap );
|
||||
stream->reader->Init(stream->info, stream->mode, fieldsV.size(), fields );
|
||||
|
||||
readers[stream->reader] = stream;
|
||||
|
||||
|
@ -1234,7 +1238,7 @@ void Manager::EndCurrentSend(ReaderFrontend* reader)
|
|||
#endif
|
||||
|
||||
// Send event that the current update is indeed finished.
|
||||
SendEvent(update_finished, 2, new StringVal(i->name.c_str()), new StringVal(i->source.c_str()));
|
||||
SendEvent(update_finished, 2, new StringVal(i->name.c_str()), new StringVal(i->info.source.c_str()));
|
||||
}
|
||||
|
||||
void Manager::Put(ReaderFrontend* reader, Value* *vals)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue