Event driven engine, further work.

This commit is contained in:
2021-10-05 12:54:37 -04:00
parent bc22dc89af
commit bce756d1fd
11 changed files with 61 additions and 115 deletions

View File

@@ -112,34 +112,6 @@ static void calculate_loadresult(LuaStack &LS0, LuaSlot info, const std::string
}
}
static void source_updatefile(LuaStack &LS0, LuaSlot source, LuaSlot fn, LuaSlot info) {
lua_State *L = LS0.state();
LuaVar fingerprint;
LuaStack LS(L, fingerprint);
// Get the existing info table from the source DB.
if (LS.istable(source)) {
LS.rawget(info, source, fn);
if (!LS.istable(info)) {
LS.newtable(info);
}
} else {
LS.newtable(info);
}
// If the file modification is wrong, update
// these fields: code, hash, fingerprint, closure, error
// Otherwise, update nothing.
std::string cfn = LS.ckstring(fn);
LS.rawget(fingerprint, info, "fingerprint");
std::string old_fingerprint;
if (LS.isstring(fingerprint)) {
old_fingerprint = LS.ckstring(fingerprint);
}
// std::cerr << "Probing " << cfn << std::endl;
LS.result();
}
void SourceDB::diff(const SourceDB &auth, StreamBuffer *sb) {
LuaVar sdb, sfn, sinfo, shash, sseq;
@@ -267,7 +239,7 @@ std::string SourceDB::get(const std::string &fn) {
return oss.str();
}
void SourceDB::update(const util::LuaSource &source) {
void SourceDB::update(const util::LuaSourceVec &source) {
lua_State *L = lua_state_;
LuaVar sourcedb, info;
LuaStack LS(L, sourcedb, info);