1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

runProgram backup

This commit is contained in:
Wouter den Breejen 2007-07-06 15:12:20 +00:00
parent eb1f179eac
commit 4f483aad0f
16 changed files with 338 additions and 174 deletions

View file

@ -1083,7 +1083,7 @@ static string makeValidityRegistration(const PathSet & paths,
s += deriver + "\n"; s += deriver + "\n";
PathSet references; PathSet references;
store->queryReferences(*i, references); store->queryReferences(*i, references, -1); //TODO check if this is ok
s += (format("%1%\n") % references.size()).str(); s += (format("%1%\n") % references.size()).str();
@ -2018,7 +2018,7 @@ void SubstitutionGoal::init()
/* To maintain the closure invariant, we first have to realise the /* To maintain the closure invariant, we first have to realise the
paths referenced by this one. */ paths referenced by this one. */
store->queryReferences(storePath, references); store->queryReferences(storePath, references, -1);
for (PathSet::iterator i = references.begin(); for (PathSet::iterator i = references.begin();
i != references.end(); ++i) i != references.end(); ++i)

View file

@ -444,11 +444,47 @@ void Database::enumTable(const Transaction & txn, TableId table,
} catch (DbException e) { rethrow(e); } } catch (DbException e) { rethrow(e); }
} }
/* State specific db functions */
Path Database::makeStatePathRevision(const Path & statePath, const int revision)
{
string prefix = "-REV-";
return statePath + prefix + int2String(revision);
}
void Database::splitStatePathRevision(const Path & revisionedStatePath, Path & statePath, int & revision)
{
string prefix = "-REV-";
int pos = revisionedStatePath.find_last_not_of(prefix);
statePath = revisionedStatePath.substr(0, pos - prefix.length());
//printMsg(lvlError, format("'%1%' '%2%'") % statePath % revisionedStatePath.substr(pos, revisionedStatePath.size()));
bool succeed = string2Int(revisionedStatePath.substr(pos, revisionedStatePath.size()), revision);
if(!succeed)
throw Error(format("Malformed revision value of path '%1%'") % revisionedStatePath);
}
void Database::setStateReferences(const Transaction & txn, TableId table, void Database::setStateReferences(const Transaction & txn, TableId table,
const Path & statePath, const int revision, const Strings & references) const Path & statePath, const int revision, const Strings & references)
{ {
//printMsg(lvlError, format("setStateReferences/Referrers %1%") % table);
if(revision == -1)
throw Error("-1 is not a valid revision value for SET-references/referrers");
/*
for (Strings::const_iterator i = references.begin(); i != references.end(); ++i)
printMsg(lvlError, format("setStateReferences::: '%1%'") % *i);
*/
//Warning if it already exists
Strings empty;
if( queryStateReferences(txn, table, statePath, empty, revision) )
printMsg(lvlError, format("Warning: The revision '%1%' already exists for set-references/referrers of path '%2%' with db '%3%'") % revision % statePath % table);
//Create the key //Create the key
string key = statePath + "-" + int2String(revision); string key = makeStatePathRevision(statePath, revision);
//Insert //Insert
setStrings(txn, table, key, references); setStrings(txn, table, key, references);
@ -457,6 +493,8 @@ void Database::setStateReferences(const Transaction & txn, TableId table,
bool Database::queryStateReferences(const Transaction & txn, TableId table, bool Database::queryStateReferences(const Transaction & txn, TableId table,
const Path & statePath, Strings & references, int revision) const Path & statePath, Strings & references, int revision)
{ {
//printMsg(lvlError, format("queryStateReferences/Referrers %1%") % table);
Strings keys; Strings keys;
enumTable(txn, table, keys); //get all revisions enumTable(txn, table, keys); //get all revisions
@ -465,36 +503,50 @@ bool Database::queryStateReferences(const Transaction & txn, TableId table,
//Lookup which key we need //Lookup which key we need
for (Strings::iterator i = keys.begin(); i != keys.end(); ++i) { for (Strings::iterator i = keys.begin(); i != keys.end(); ++i) {
string getStatePath = *i; Path getStatePath_org = *i;
Path getStatePath;
int getRevision;
splitStatePathRevision(*i, getStatePath, getRevision);
if(getStatePath.substr(0, statePath.size()) == statePath){ if(getStatePath == statePath){
int getRev;
bool succeed = string2Int(getStatePath.substr(statePath.size() + 1, getStatePath.size()), getRev);
if(!succeed)
throw Error("Malformed revision value after statePath in stateRefereneces");
printMsg(lvlError, format("KEY: %1% of %2%") % getStatePath % getRev);
if(revision == -1){ //the user wants the last revision if(revision == -1){ //the user wants the last revision
if(getRev > highestRev) if(getRevision > highestRev)
highestRev = getRev; highestRev = getRevision;
} }
else if(revision == getRev){ else if(revision == getRevision){
key = getStatePath; key = getStatePath_org;
break; break;
} }
} }
} }
if(key == "" && highestRev == -1) //no records found if(key == "" && highestRev == -1) //no records found (TODO throw error?)
return false; return false;
if(revision == -1) if(revision == -1)
key = statePath + "-" + int2String(highestRev); key = makeStatePathRevision(statePath, highestRev);
return queryStrings(txn, table, key, references); //now that we have the key, we can query the references return queryStrings(txn, table, key, references); //now that we have the key, we can query the references
} }
bool Database::queryStateReferrers(const Transaction & txn, TableId table,
const Path & statePath, Strings & referrers, int revision)
{
//PathSet referrers;
Strings keys;
Path revisionedStatePath = makeStatePathRevision(statePath, revision);
enumTable(txn, table, keys, revisionedStatePath + string(1, (char) 0));
for (Strings::iterator i = keys.begin(); i != keys.end(); ++i)
printMsg(lvlError, format("queryStateReferrers %1%") % *i);
//referrers.insert(stripPrefix(storePath, *i));
return false;
}
void Database::setStateRevisions(const Transaction & txn, TableId table, void Database::setStateRevisions(const Transaction & txn, TableId table,
const Path & statePath, const int revision, const RevisionNumbers & revisions) const Path & statePath, const int revision, const RevisionNumbers & revisions)
{ {

View file

@ -90,6 +90,12 @@ public:
void enumTable(const Transaction & txn, TableId table, void enumTable(const Transaction & txn, TableId table,
Strings & keys, const string & keyPrefix = ""); Strings & keys, const string & keyPrefix = "");
/* TODO */
Path makeStatePathRevision(const Path & statePath, const int revision);
/* TODO */
void splitStatePathRevision(const Path & revisionedStatePath, Path & statePath, int & revision);
/* Set the stateReferences for a specific revision (and older until the next higher revision number in the table) */ /* Set the stateReferences for a specific revision (and older until the next higher revision number in the table) */
void setStateReferences(const Transaction & txn, TableId table, void setStateReferences(const Transaction & txn, TableId table,
const Path & statePath, const int revision, const Strings & references); const Path & statePath, const int revision, const Strings & references);
@ -98,6 +104,10 @@ public:
bool queryStateReferences(const Transaction & txn, TableId table, bool queryStateReferences(const Transaction & txn, TableId table,
const Path & statePath, Strings & references, int revision = -1); const Path & statePath, Strings & references, int revision = -1);
/* Returns the referrers for a specific revision (and older until the next higher revision number in the table) */
bool queryStateReferrers(const Transaction & txn, TableId table,
const Path & statePath, Strings & referrers, int revision = -1);
/* Set the revision number of the statePath and the revision numbers of all state paths in the references closure */ /* Set the revision number of the statePath and the revision numbers of all state paths in the references closure */
void setStateRevisions(const Transaction & txn, TableId table, void setStateRevisions(const Transaction & txn, TableId table,
const Path & statePath, const int revision, const RevisionNumbers & revisions); const Path & statePath, const int revision, const RevisionNumbers & revisions);

View file

@ -406,7 +406,7 @@ static void dfsVisit(const PathSet & paths, const Path & path,
PathSet references; PathSet references;
if (store->isValidPath(path)) if (store->isValidPath(path))
store->queryReferences(path, references); store->queryReferences(path, references, -1); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
for (PathSet::iterator i = references.begin(); for (PathSet::iterator i = references.begin();
i != references.end(); ++i) i != references.end(); ++i)

View file

@ -387,39 +387,50 @@ static string stripPrefix(const string & prefix, const string & s)
} }
static PathSet getReferrers(const Transaction & txn, const Path & storePath) //TODO move the code of get(State)Referrers into query variant ..... !!!!!!!!!!!!!!!!!!!!!!!!!!!!???
static PathSet getReferrers(const Transaction & txn, const Path & store_or_statePath, const int revision)
{ {
if(isValidPathTxn(txn, store_or_statePath)){
PathSet referrers; PathSet referrers;
Strings keys; Strings keys;
nixDB.enumTable(txn, dbComponentComponentReferrers, keys, store_or_statePath + string(1, (char) 0));
if(isValidPathTxn(txn, storePath))
nixDB.enumTable(txn, dbComponentComponentReferrers, keys, storePath + string(1, (char) 0));
else if(isValidStatePathTxn(txn, storePath))
nixDB.enumTable(txn, dbStateComponentReferrers, keys, storePath + string(1, (char) 0));
else
throw Error(format("Path '%1%' is not a valid component or state path") % storePath);
for (Strings::iterator i = keys.begin(); i != keys.end(); ++i) for (Strings::iterator i = keys.begin(); i != keys.end(); ++i)
referrers.insert(stripPrefix(storePath, *i)); referrers.insert(stripPrefix(store_or_statePath, *i));
return referrers; return referrers;
} }
else if(isValidStatePathTxn(txn, store_or_statePath)){
Paths referrers;
nixDB.queryStateReferrers(txn, dbStateComponentReferrers, store_or_statePath, referrers, revision);
PathSet p(referrers.begin(), referrers.end());
return p;
}
else
throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath);
static PathSet getStateReferrers(const Transaction & txn, const Path & storePath) //TODO this is just a copy of getReferrers with a change to dbStateReferrers, maybe make the function more generic? }
static PathSet getStateReferrers(const Transaction & txn, const Path & store_or_statePath, const int revision) //TODO this is just a copy of getReferrers with a change to dbStateReferrers, maybe make the function more generic?
{ {
if(isValidPathTxn(txn, store_or_statePath)){
PathSet referrers; PathSet referrers;
Strings keys; Strings keys;
nixDB.enumTable(txn, dbComponentStateReferrers, keys, store_or_statePath + string(1, (char) 0));
if(isValidPathTxn(txn, storePath))
nixDB.enumTable(txn, dbComponentComponentReferrers, keys, storePath + string(1, (char) 0));
else if(isValidStatePathTxn(txn, storePath))
nixDB.enumTable(txn, dbStateComponentReferrers, keys, storePath + string(1, (char) 0));
else
throw Error(format("Path '%1%' is not a valid component or state path") % storePath);
for (Strings::iterator i = keys.begin(); i != keys.end(); ++i) for (Strings::iterator i = keys.begin(); i != keys.end(); ++i)
referrers.insert(stripPrefix(storePath, *i)); referrers.insert(stripPrefix(store_or_statePath, *i));
return referrers; return referrers;
} }
else if(isValidStatePathTxn(txn, store_or_statePath)){
Paths referrers;
nixDB.queryStateReferrers(txn, dbStateStateReferrers, store_or_statePath, referrers, revision);
PathSet p(referrers.begin(), referrers.end());
return p;
}
else
throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath);
}
void setReferences(const Transaction & txn, const Path & store_or_statePath, void setReferences(const Transaction & txn, const Path & store_or_statePath,
const PathSet & references, const PathSet & stateReferences, const int revision) const PathSet & references, const PathSet & stateReferences, const int revision)
@ -467,14 +478,13 @@ void setReferences(const Transaction & txn, const Path & store_or_statePath,
Paths oldStateReferences_s_c; Paths oldStateReferences_s_c;
Paths oldStateReferences_s_s; Paths oldStateReferences_s_s;
nixDB.queryStrings(txn, dbStateComponentReferences, store_or_statePath, oldStateReferences_s_c); nixDB.queryStateReferences(txn, dbStateComponentReferences, store_or_statePath, oldStateReferences_s_c, revision);
nixDB.queryStrings(txn, dbStateStateReferences, store_or_statePath, oldStateReferences_s_s); nixDB.queryStateReferences(txn, dbStateStateReferences, store_or_statePath, oldStateReferences_s_s, revision);
oldReferences2 = PathSet(oldStateReferences_s_c.begin(), oldStateReferences_s_c.end()); oldReferences2 = PathSet(oldStateReferences_s_c.begin(), oldStateReferences_s_c.end());
oldStateReferences2 = PathSet(oldStateReferences_s_s.begin(), oldStateReferences_s_s.end()); oldStateReferences2 = PathSet(oldStateReferences_s_s.begin(), oldStateReferences_s_s.end());
if (oldReferences2 == references && oldStateReferences2 == stateReferences) return;
nixDB.setStrings(txn, dbStateComponentReferences, store_or_statePath, Paths(references.begin(), references.end())); nixDB.setStateReferences(txn, dbStateComponentReferences, store_or_statePath, revision, Paths(references.begin(), references.end()));
nixDB.setStateReferences(txn, dbStateStateReferences, store_or_statePath, revision, Paths(stateReferences.begin(), stateReferences.end())); nixDB.setStateReferences(txn, dbStateStateReferences, store_or_statePath, revision, Paths(stateReferences.begin(), stateReferences.end()));
//set vars for the referrers update code below //set vars for the referrers update code below
@ -486,102 +496,104 @@ void setReferences(const Transaction & txn, const Path & store_or_statePath,
else else
throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath); throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath);
//store_or_statePath must be postfixed in case it is a statePath
Path store_or_statePath2 = store_or_statePath;
if(isRealisableStatePath(txn, store_or_statePath))
store_or_statePath2 = nixDB.makeStatePathRevision(store_or_statePath, revision);
//The follow 4 for-loops haved been made generic with variables, they work in the case of statePaths and storePaths //The follow 4 for-loops haved been made generic with variables, they work in the case of statePaths and storePaths
/* Update the referrers mappings of all new referenced paths. */ /* Update the referrers mappings of all new referenced paths. */
for (PathSet::const_iterator i = references.begin(); i != references.end(); ++i) for (PathSet::const_iterator i = references.begin(); i != references.end(); ++i)
if (oldReferences2.find(*i) == oldReferences2.end()) if (oldReferences2.find(*i) == oldReferences2.end())
nixDB.setString(txn, dbXComponentReferrers, addPrefix(*i, store_or_statePath), ""); nixDB.setString(txn, dbXComponentReferrers, addPrefix(*i, store_or_statePath2), "");
/* Remove referrer mappings from paths that are no longer references. */ /* Remove referrer mappings from paths that are no longer references. */
for (Paths::iterator i = oldReferences_X_c.begin(); i != oldReferences_X_c.end(); ++i) for (Paths::iterator i = oldReferences_X_c.begin(); i != oldReferences_X_c.end(); ++i)
if (references.find(*i) == references.end()) if (references.find(*i) == references.end())
nixDB.delPair(txn, dbXComponentReferrers, addPrefix(*i, store_or_statePath)); nixDB.delPair(txn, dbXComponentReferrers, addPrefix(*i, store_or_statePath2));
/* Update the state referrers mappings of all new referenced paths. */ /* Update the state referrers mappings of all new referenced paths. */
for (PathSet::const_iterator i = stateReferences.begin(); i != stateReferences.end(); ++i) for (PathSet::const_iterator i = stateReferences.begin(); i != stateReferences.end(); ++i)
if (oldStateReferences2.find(*i) == oldStateReferences2.end()) if (oldStateReferences2.find(*i) == oldStateReferences2.end())
nixDB.setString(txn, dbXStateReferrers, addPrefix(*i, store_or_statePath), ""); nixDB.setString(txn, dbXStateReferrers, addPrefix(*i, store_or_statePath2), "");
/* Remove referrer mappings from paths that are no longer state references. */ /* Remove referrer mappings from paths that are no longer state references. */
for (Paths::iterator i = oldReferences_X_s.begin(); i != oldReferences_X_s.end(); ++i) for (Paths::iterator i = oldReferences_X_s.begin(); i != oldReferences_X_s.end(); ++i)
if (stateReferences.find(*i) == stateReferences.end()) if (stateReferences.find(*i) == stateReferences.end())
nixDB.delPair(txn, dbXStateReferrers, addPrefix(*i, store_or_statePath)); nixDB.delPair(txn, dbXStateReferrers, addPrefix(*i, store_or_statePath2));
} }
void queryReferences(const Transaction & txn, void queryReferences(const Transaction & txn,
const Path & storePath, PathSet & references) const Path & store_or_statePath, PathSet & references, const int revision)
{ {
Paths references2; Paths references2;
if(isRealisablePath(txn, storePath)) if(isRealisablePath(txn, store_or_statePath))
nixDB.queryStrings(txn, dbComponentComponentReferences, storePath, references2); nixDB.queryStrings(txn, dbComponentComponentReferences, store_or_statePath, references2);
else if(isRealisableStatePath(txn, storePath)) else if(isRealisableStatePath(txn, store_or_statePath))
nixDB.queryStrings(txn, dbStateComponentReferences, storePath, references2); nixDB.queryStateReferences(txn, dbStateComponentReferences, store_or_statePath, references2, revision);
else else
throw Error(format("Path '%1%' is not a valid component or state path") % storePath); throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath);
references.insert(references2.begin(), references2.end()); references.insert(references2.begin(), references2.end());
} }
void LocalStore::queryReferences(const Path & storePath, void LocalStore::queryReferences(const Path & storePath,
PathSet & references) PathSet & references, const int revision)
{ {
nix::queryReferences(noTxn, storePath, references); nix::queryReferences(noTxn, storePath, references, revision);
} }
void queryStateReferences(const Transaction & txn, void queryStateReferences(const Transaction & txn,
const Path & componentOrstatePath, PathSet & stateReferences) const Path & store_or_statePath, PathSet & stateReferences, const int revision)
{ {
Paths stateReferences2; Paths stateReferences2;
if(isRealisablePath(txn, componentOrstatePath)) if(isRealisablePath(txn, store_or_statePath))
nixDB.queryStrings(txn, dbComponentStateReferences, componentOrstatePath, stateReferences2); nixDB.queryStrings(txn, dbComponentStateReferences, store_or_statePath, stateReferences2);
else if(isRealisableStatePath(txn, componentOrstatePath)) else if(isRealisableStatePath(txn, store_or_statePath))
nixDB.queryStrings(txn, dbStateStateReferences, componentOrstatePath, stateReferences2); //TODO !!!!!!!!!!!!!!!! state-state references are not strings anymore !!!! nixDB.queryStateReferences(txn, dbStateStateReferences, store_or_statePath, stateReferences2, revision);
else else
throw Error(format("Path '%1%' is not a valid component or state path") % componentOrstatePath); throw Error(format("Path '%1%' is not a valid component or state path") % store_or_statePath);
stateReferences.insert(stateReferences2.begin(), stateReferences2.end()); stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
} }
void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences) void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences, const int revision)
{ {
nix::queryStateReferences(noTxn, componentOrstatePath, stateReferences); nix::queryStateReferences(noTxn, componentOrstatePath, stateReferences, revision);
} }
void queryReferrers(const Transaction & txn, void queryReferrers(const Transaction & txn,
const Path & storePath, PathSet & referrers) const Path & storePath, PathSet & referrers, const int revision)
{ {
if (!isRealisableComponentOrStatePath(txn, storePath)) if (!isRealisableComponentOrStatePath(txn, storePath))
throw Error(format("path `%1%' is not valid") % storePath); throw Error(format("path `%1%' is not valid") % storePath);
PathSet referrers2 = getReferrers(txn, storePath); PathSet referrers2 = getReferrers(txn, storePath, revision);
referrers.insert(referrers2.begin(), referrers2.end()); referrers.insert(referrers2.begin(), referrers2.end());
} }
void LocalStore::queryReferrers(const Path & storePath, void LocalStore::queryReferrers(const Path & storePath,
PathSet & referrers) PathSet & referrers, const int revision)
{ {
nix::queryReferrers(noTxn, storePath, referrers); nix::queryReferrers(noTxn, storePath, referrers, revision);
} }
void queryStateReferrers(const Transaction & txn, const Path & storePath, PathSet & stateReferrers) void queryStateReferrers(const Transaction & txn, const Path & storePath, PathSet & stateReferrers, const int revision)
{ {
if (!isRealisableComponentOrStatePath(txn, storePath)) if (!isRealisableComponentOrStatePath(txn, storePath))
throw Error(format("path `%1%' is not valid") % storePath); throw Error(format("path `%1%' is not valid") % storePath);
PathSet stateReferrers2 = getStateReferrers(txn, storePath); PathSet stateReferrers2 = getStateReferrers(txn, storePath, revision);
stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end()); stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end());
} }
void LocalStore::queryStateReferrers(const Path & storePath, PathSet & stateReferrers, const int revision)
void LocalStore::queryStateReferrers(const Path & storePath, PathSet & stateReferrers)
{ {
nix::queryStateReferrers(noTxn, storePath, stateReferrers); nix::queryStateReferrers(noTxn, storePath, stateReferrers, revision);
} }
@ -630,11 +642,9 @@ void addStateDeriver(const Transaction & txn, const Path & storePath, const Path
} }
//TODO Add and ..
bool isStateComponentTxn(const Transaction & txn, const Path & storePath) bool isStateComponentTxn(const Transaction & txn, const Path & storePath)
{ {
isValidPathTxn(txn, storePath); isValidPathTxn(txn, storePath);
string data; string data;
return nixDB.queryString(txn, dbStateInfo, storePath, data); return nixDB.queryString(txn, dbStateInfo, storePath, data);
} }
@ -645,12 +655,10 @@ bool LocalStore::isStateComponent(const Path & storePath)
} }
//TODO Add and ..
bool isStateDrvPathTxn(const Transaction & txn, const Path & drvPath) bool isStateDrvPathTxn(const Transaction & txn, const Path & drvPath)
{ {
printMsg(lvlError, format("Sssssssssssssssssss %1%") % drvPath); printMsg(lvlError, format("Sssssssssssssssssss %1%") % drvPath);
Derivation drv = derivationFromPath(drvPath); Derivation drv = derivationFromPath(drvPath);
printMsg(lvlError, format("uuuuuuuuuuuuuuuuuu %1%") % drvPath);
return isStateDrvTxn(txn, drv); return isStateDrvTxn(txn, drv);
} }
@ -659,7 +667,6 @@ bool LocalStore::isStateDrvPath(const Path & isStateDrv)
return nix::isStateDrvPathTxn(noTxn, isStateDrv); return nix::isStateDrvPathTxn(noTxn, isStateDrv);
} }
//TODO Add and ..
bool isStateDrvTxn(const Transaction & txn, const Derivation & drv) bool isStateDrvTxn(const Transaction & txn, const Derivation & drv)
{ {
if (drv.stateOutputs.size() != 0) if (drv.stateOutputs.size() != 0)
@ -1114,7 +1121,7 @@ void LocalStore::exportPath(const Path & path, bool sign,
writeString(path, hashAndWriteSink); writeString(path, hashAndWriteSink);
PathSet references; PathSet references;
nix::queryReferences(txn, path, references); nix::queryReferences(txn, path, references, -1); //TODO we can only now export the final revision
writeStringSet(references, hashAndWriteSink); writeStringSet(references, hashAndWriteSink);
Path deriver = queryDeriver(txn, path); Path deriver = queryDeriver(txn, path);
@ -1277,7 +1284,7 @@ void deleteFromStore(const Path & _path, unsigned long long & bytesFreed)
Transaction txn(nixDB); Transaction txn(nixDB);
if (isValidPathTxn(txn, path)) { if (isValidPathTxn(txn, path)) {
PathSet referrers = getReferrers(txn, path); PathSet referrers = getReferrers(txn, path, -1); //delete latest referrers (TODO?)
for (PathSet::iterator i = referrers.begin(); for (PathSet::iterator i = referrers.begin();
i != referrers.end(); ++i) i != referrers.end(); ++i)
if (*i != path && isValidPathTxn(txn, *i)) if (*i != path && isValidPathTxn(txn, *i))
@ -1396,7 +1403,7 @@ void verifyStore(bool checkContents)
else { else {
bool isValid = validPaths.find(*i) != validPaths.end(); bool isValid = validPaths.find(*i) != validPaths.end();
PathSet references; PathSet references;
queryReferences(txn, *i, references); queryReferences(txn, *i, references, -1); //TODO
for (PathSet::iterator j = references.begin(); for (PathSet::iterator j = references.begin();
j != references.end(); ++j) j != references.end(); ++j)
{ {
@ -1445,10 +1452,10 @@ void verifyStore(bool checkContents)
else { else {
PathSet references; PathSet references;
queryReferences(txn, from, references); queryReferences(txn, from, references, -1); //TODO
PathSet stateReferences; //already a stateReferrers here! PathSet stateReferences; //already a stateReferrers here!
queryStateReferences(txn, from, stateReferences); queryStateReferences(txn, from, stateReferences, -1); //TODO CHECK FOR ALL REVISIONS !
if (find(references.begin(), references.end(), to) == references.end()) { if (find(references.begin(), references.end(), to) == references.end()) {
printMsg(lvlError, format("adding missing referrer mapping from `%1%' to `%2%'") % from % to); printMsg(lvlError, format("adding missing referrer mapping from `%1%' to `%2%'") % from % to);
@ -1702,8 +1709,8 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa
//Retrieve old references //Retrieve old references
PathSet old_references; PathSet old_references;
PathSet old_state_references; PathSet old_state_references;
queryReferences(txn, statePath, old_references); queryReferences(txn, statePath, old_references, -1); //get the latsest references
queryStateReferences(txn, statePath, old_state_references); queryStateReferences(txn, statePath, old_state_references, -1);
//Check for added and removed paths //Check for added and removed paths
PathSet diff_references_removed; PathSet diff_references_removed;
@ -1872,7 +1879,7 @@ static void upgradeStore07()
} }
PathSet prevReferences; PathSet prevReferences;
queryReferences(txn, path, prevReferences); queryReferences(txn, path, prevReferences, -1);
if (prevReferences.size() > 0 && references != prevReferences) if (prevReferences.size() > 0 && references != prevReferences)
printMsg(lvlError, format("warning: conflicting references for `%1%'") % path); printMsg(lvlError, format("warning: conflicting references for `%1%'") % path);

View file

@ -51,13 +51,13 @@ public:
Path queryStatePathDrv(const Path & statePath); Path queryStatePathDrv(const Path & statePath);
void queryReferences(const Path & path, PathSet & references); void queryReferences(const Path & path, PathSet & references, const int revision);
void queryStateReferences(const Path & storePath, PathSet & stateReferences); void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision);
void queryReferrers(const Path & path, PathSet & referrers); void queryReferrers(const Path & path, PathSet & referrers, const int revision);
void queryStateReferrers(const Path & path, PathSet & stateReferrers); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision);
Path addToStore(const Path & srcPath, bool fixed = false, Path addToStore(const Path & srcPath, bool fixed = false,
bool recursive = false, string hashAlgo = "", bool recursive = false, string hashAlgo = "",

View file

@ -11,7 +11,9 @@ namespace nix {
Derivation derivationFromPath(const Path & drvPath) Derivation derivationFromPath(const Path & drvPath)
{ {
assertStorePath(drvPath); assertStorePath(drvPath);
printMsg(lvlError, format("tttttttttttttttttt"));
store->ensurePath(drvPath); store->ensurePath(drvPath);
printMsg(lvlError, format("uuuuuuuuuuuuuuuuuu"));
ATerm t = ATreadFromNamedFile(drvPath.c_str()); ATerm t = ATreadFromNamedFile(drvPath.c_str());
if (!t) throw Error(format("cannot read aterm from `%1%'") % drvPath); if (!t) throw Error(format("cannot read aterm from `%1%'") % drvPath);
return parseDerivation(t); return parseDerivation(t);
@ -58,12 +60,12 @@ void computeFSClosureRec(const Path & path, PathSet & paths, const bool & flipDi
PathSet stateReferences; PathSet stateReferences;
if (flipDirection){ if (flipDirection){
store->queryReferrers(path, references); store->queryReferrers(path, references, -1);
store->queryStateReferrers(path, stateReferences); store->queryStateReferrers(path, stateReferences, -1);
} }
else{ else{
store->queryReferences(path, references); store->queryReferences(path, references, -1);
store->queryStateReferences(path, stateReferences); store->queryStateReferences(path, stateReferences, -1);
} }
PathSet allReferences; PathSet allReferences;
@ -122,7 +124,7 @@ void queryMissing(const PathSet & targets,
if (store->hasSubstitutes(p)) if (store->hasSubstitutes(p))
willSubstitute.insert(p); willSubstitute.insert(p);
PathSet refs; PathSet refs;
store->queryReferences(p, todo); store->queryReferences(p, todo, -1); //TODO?
} }
} }
} }

View file

@ -18,8 +18,10 @@ Derivation derivationFromPath(const Path & drvPath);
`storePath' is returned; that is, the closures under the `storePath' is returned; that is, the closures under the
`referrers' relation instead of the `references' relation is `referrers' relation instead of the `references' relation is
withState = TODO comment withState = include the state paths into the closure
withComponents = TODO withComponents = include the component paths into the closure
We can currentky only compute the closure of the latsest revision!
returned. */ returned. */
void computeFSClosure(const Path & storePath, PathSet & paths, const bool & withComponents, const bool & withState, bool flipDirection = false); void computeFSClosure(const Path & storePath, PathSet & paths, const bool & withComponents, const bool & withState, bool flipDirection = false);

View file

@ -216,44 +216,49 @@ Path RemoteStore::queryStatePathDrv(const Path & statePath)
} }
void RemoteStore::queryReferences(const Path & path, void RemoteStore::queryReferences(const Path & path,
PathSet & references) PathSet & references, const int revision)
{ {
writeInt(wopQueryReferences, to); writeInt(wopQueryReferences, to);
writeString(path, to); writeString(path, to);
processStderr(); processStderr();
PathSet references2 = readStorePaths(from); PathSet references2 = readStorePaths(from);
references.insert(references2.begin(), references2.end()); references.insert(references2.begin(), references2.end());
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
} }
void RemoteStore::queryStateReferences(const Path & path, void RemoteStore::queryStateReferences(const Path & path,
PathSet & stateReferences) PathSet & stateReferences, const int revision)
{ {
writeInt(wopQueryStateReferences, to); writeInt(wopQueryStateReferences, to);
writeString(path, to); writeString(path, to);
processStderr(); processStderr();
PathSet stateReferences2 = readStorePaths(from); PathSet stateReferences2 = readStorePaths(from);
stateReferences.insert(stateReferences2.begin(), stateReferences2.end()); stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
} }
void RemoteStore::queryReferrers(const Path & path, void RemoteStore::queryReferrers(const Path & path,
PathSet & referrers) PathSet & referrers, const int revision)
{ {
writeInt(wopQueryReferrers, to); writeInt(wopQueryReferrers, to);
writeString(path, to); writeString(path, to);
processStderr(); processStderr();
PathSet referrers2 = readStorePaths(from); PathSet referrers2 = readStorePaths(from);
referrers.insert(referrers2.begin(), referrers2.end()); referrers.insert(referrers2.begin(), referrers2.end());
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
} }
void RemoteStore::queryStateReferrers(const Path & path, PathSet & stateReferrers) void RemoteStore::queryStateReferrers(const Path & path,
PathSet & stateReferrers, const int revision)
{ {
writeInt(wopQueryStateReferrers, to); writeInt(wopQueryStateReferrers, to);
writeString(path, to); writeString(path, to);
processStderr(); processStderr();
PathSet stateReferrers2 = readStorePaths(from); PathSet stateReferrers2 = readStorePaths(from);
stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end()); stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end());
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
} }

View file

@ -39,13 +39,13 @@ public:
Path queryStatePathDrv(const Path & statePath); Path queryStatePathDrv(const Path & statePath);
void queryReferences(const Path & path, PathSet & references); void queryReferences(const Path & path, PathSet & references, const int revision);
void queryStateReferences(const Path & storePath, PathSet & stateReferences); void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision);
void queryReferrers(const Path & path, PathSet & referrers); void queryReferrers(const Path & path, PathSet & referrers, const int revision);
void queryStateReferrers(const Path & path, PathSet & stateReferrers); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision);
Path addToStore(const Path & srcPath, bool fixed = false, Path addToStore(const Path & srcPath, bool fixed = false,
bool recursive = false, string hashAlgo = "", bool recursive = false, string hashAlgo = "",

View file

@ -81,20 +81,20 @@ public:
/* Queries the set of outgoing FS references for a store path. /* Queries the set of outgoing FS references for a store path.
The result is not cleared. */ The result is not cleared. */
virtual void queryReferences(const Path & path, virtual void queryReferences(const Path & path,
PathSet & references) = 0; PathSet & references, const int revision) = 0;
/* Queries the set of outgoing FS state-references for a store path. /* Queries the set of outgoing FS state-references for a store path.
The result is not cleared. */ The result is not cleared. */
virtual void queryStateReferences(const Path & storePath, PathSet & stateReferences) = 0; virtual void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision) = 0;
/* Queries the set of incoming FS references for a store path. /* Queries the set of incoming FS references for a store path.
The result is not cleared. */ The result is not cleared. */
virtual void queryReferrers(const Path & path, virtual void queryReferrers(const Path & path,
PathSet & referrers) = 0; PathSet & referrers, const int revision) = 0;
/* Queries the set of incoming FS state-references for a store path. /* Queries the set of incoming FS state-references for a store path.
The result is not cleared. */ The result is not cleared. */
virtual void queryStateReferrers(const Path & path, PathSet & stateReferrers) = 0; virtual void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision) = 0;
/* Copy the contents of a path to the store and register the /* Copy the contents of a path to the store and register the
validity the resulting path. The resulting path is returned. validity the resulting path. The resulting path is returned.

View file

@ -806,6 +806,7 @@ string runProgram(Path program, bool searchPath, const Strings & args)
} catch (std::exception & e) { } catch (std::exception & e) {
std::cerr << "error: " << e.what() << std::endl; std::cerr << "error: " << e.what() << std::endl;
} }
quickExit(1); quickExit(1);
} }
@ -813,7 +814,58 @@ string runProgram(Path program, bool searchPath, const Strings & args)
pipe.writeSide.close(); pipe.writeSide.close();
string result = drainFD(pipe.readSide);
// Create a pipe.
Pipe pipe2;
pipe2.create();
// Fork.
Pid pid2;
pid2 = fork();
switch (pid2) {
case -1:
throw SysError("unable to fork");
case 0: // child
try {
pipe2.readSide.close();
if (dup2(pipe2.writeSide, STDOUT_FILENO) == -1)
throw SysError("dupping from-hook write side");
dup2(pipe.readSide, STDIN_FILENO);
Path s = "grep";
Strings args2;
args2.push_back("Revision");
std::vector<const char *> cargs; // careful with c_str()!
cargs.push_back(s.c_str());
for (Strings::const_iterator i = args2.begin(); i != args2.end(); ++i)
cargs.push_back(i->c_str());
cargs.push_back(0);
if (searchPath)
execvp(s.c_str(), (char * *) &cargs[0]);
else
execv(s.c_str(), (char * *) &cargs[0]);
throw SysError(format("executing `%1%'") % s);
} catch (std::exception & e) {
std::cerr << "error: " << e.what() << std::endl;
}
quickExit(1);
}
/* Parent. */
pipe2.writeSide.close();
string result = drainFD(pipe2.readSide);
/* Wait for the child to finish. */ /* Wait for the child to finish. */
int status = pid.wait(true); int status = pid.wait(true);
@ -821,6 +873,12 @@ string runProgram(Path program, bool searchPath, const Strings & args)
throw Error(format("program `%1%' %2%") throw Error(format("program `%1%' %2%")
% program % statusToString(status)); % program % statusToString(status));
/* wait for second ........... */
int status2 = pid2.wait(true);
if (!statusOk(status2))
throw Error(format("program `%1%' %2%")
% program % statusToString(status));
return result; return result;
} }
@ -1149,44 +1207,21 @@ string getCallingUserName()
//merges two PathSets into one, removing doubles (union) //merges two PathSets into one, removing doubles (union)
PathSet pathSets_union(const PathSet & paths1, const PathSet & paths2) PathSet pathSets_union(const PathSet & paths1, const PathSet & paths2)
{ {
/*
for (PathSet::iterator i = paths1.begin(); i != paths1.end(); ++i)
printMsg(lvlError, format("paths1: '%1%'") % (*i));
for (PathSet::iterator i = paths2.begin(); i != paths2.end(); ++i)
printMsg(lvlError, format("paths2: '%1%'") % (*i));
*/
vector<Path> vector1(paths1.begin(), paths1.end()); vector<Path> vector1(paths1.begin(), paths1.end());
vector<Path> vector2(paths2.begin(), paths2.end()); vector<Path> vector2(paths2.begin(), paths2.end());
vector<Path> setResult; vector<Path> setResult;
set_union(vector1.begin(), vector1.end(),vector2.begin(), vector2.end(), back_inserter(setResult)); set_union(vector1.begin(), vector1.end(),vector2.begin(), vector2.end(), back_inserter(setResult)); //Also available: set_symmetric_difference and set_intersection
//Also available:
//set_symmetric_difference
//set_intersection
PathSet diff; PathSet diff;
for(int i=0; i<setResult.size(); i++) for(int i=0; i<setResult.size(); i++)
diff.insert(setResult[i]); diff.insert(setResult[i]);
/*
for (PathSet::iterator i = diff.begin(); i != diff.end(); ++i)
printMsg(lvlError, format("diff: '%1%'") % (*i));
*/
return diff; return diff;
} }
void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, PathSet & addedpaths, PathSet & removedpaths) void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, PathSet & addedpaths, PathSet & removedpaths)
{ {
/*
for (PathSet::iterator i = oldpaths.begin(); i != oldpaths.end(); ++i)
printMsg(lvlError, format("oldpaths: '%1%'") % (*i));
for (PathSet::iterator i = newpaths.begin(); i != newpaths.end(); ++i)
printMsg(lvlError, format("newpaths: '%1%'") % (*i));
*/
for (PathSet::iterator i = oldpaths.begin(); i != oldpaths.end(); ++i){ for (PathSet::iterator i = oldpaths.begin(); i != oldpaths.end(); ++i){
bool exists = false; bool exists = false;
for (PathSet::iterator j = newpaths.begin(); j != newpaths.end(); ++j){ for (PathSet::iterator j = newpaths.begin(); j != newpaths.end(); ++j){
@ -1210,13 +1245,6 @@ void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, Pat
if(!exists) if(!exists)
addedpaths.insert(*i); addedpaths.insert(*i);
} }
/*
for (PathSet::iterator i = addedpaths.begin(); i != addedpaths.end(); ++i)
printMsg(lvlError, format("addedpaths: '%1%'") % (*i));
for (PathSet::iterator i = removedpaths.begin(); i != removedpaths.end(); ++i)
printMsg(lvlError, format("removedpaths: '%1%'") % (*i));
*/
} }

View file

@ -170,6 +170,50 @@ static void opShowStateReposRootPath(Strings opFlags, Strings opArgs)
printMsg(lvlError, format("%1%") % repos); printMsg(lvlError, format("%1%") % repos);
} }
RevisionNumbers readRevisionNumbers(const Derivation & drv)
{
string svnbin = nixSVNPath + "/svn";
RevisionNumbers revisions;
DerivationStateOutputDirs stateOutputDirs = drv.stateOutputDirs;
string drvName = drv.env.find("name")->second;
DerivationStateOutputs stateOutputs = drv.stateOutputs;
Path statePath = stateOutputs.find("state")->second.statepath;
string getStateIdentifier = stateOutputs.find("state")->second.stateIdentifier;
for (DerivationStateOutputDirs::const_reverse_iterator i = stateOutputDirs.rbegin(); i != stateOutputDirs.rend(); ++i){
DerivationStateOutputDir d = i->second;
string thisdir = d.path;
//Get the a repository for this state location
string repos = getStateReposPath("stateOutput:staterepospath", statePath, thisdir, drvName, getStateIdentifier); //this is a copy from store-state.cc
if(IsDirectory(repos)){
printMsg(lvlError, format("'%1%'") % repos);
Strings p_args;
p_args.push_back("info");
p_args.push_back("file://" + repos);
string output = runProgram(svnbin, true, p_args);
/*
p_args.clear();
p_args.push_back("-n");
p_args.push_back("/^Revision: /p");
p_args.push_back(output);
output = runProgram("sed", true, p_args);
*/
printMsg(lvlError, format("%2%") % repos % output);
}
}
//svn info $repos | sed -n '/^Revision: /p' | sed 's/Revision: //' | tr -d "\12"
return revisions;
}
//Comment TODO //Comment TODO
PathSet getAllStateDerivationsRecursively(const Path & storePath) PathSet getAllStateDerivationsRecursively(const Path & storePath)
{ {
@ -260,8 +304,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
int intervalAt=0; int intervalAt=0;
for (DerivationStateOutputDirs::const_reverse_iterator i = stateOutputDirs.rbegin(); i != stateOutputDirs.rend(); ++i){ for (DerivationStateOutputDirs::const_reverse_iterator i = stateOutputDirs.rbegin(); i != stateOutputDirs.rend(); ++i){
DerivationStateOutputDir d = i->second; DerivationStateOutputDir d = i->second;
string thisdir = d.path;
string thisdir = d.path; //TODO CONVERT
string fullstatedir = statePath + "/" + thisdir; string fullstatedir = statePath + "/" + thisdir;
if(thisdir == "/") //exception for the root dir if(thisdir == "/") //exception for the root dir
@ -298,7 +341,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
} }
//Update the intervals again //Update the intervals again
//store->setStatePathsInterval(intervalPaths, intervals); //TODO UNCOMMENT store->setStatePathsInterval(intervalPaths, intervals);
//Call the commit script with the appropiate paramenters //Call the commit script with the appropiate paramenters
string subversionedstatepathsarray; string subversionedstatepathsarray;
@ -323,7 +366,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
commandsarray += "" + *(i) + " | "; commandsarray += "" + *(i) + " | ";
} }
//make the call //make the call to the commit script
Strings p_args; Strings p_args;
p_args.push_back(svnbin); p_args.push_back(svnbin);
p_args.push_back(subversionedstatepathsarray); p_args.push_back(subversionedstatepathsarray);
@ -333,8 +376,11 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
runProgram_AndPrintOutput(nixLibexecDir + "/nix/nix-statecommit.sh", true, p_args, "svn"); runProgram_AndPrintOutput(nixLibexecDir + "/nix/nix-statecommit.sh", true, p_args, "svn");
//TODO //TODO
//Scan again?? //Scan if needed
//scanAndUpdateAllReferencesRecusively ... //scanAndUpdateAllReferencesRecusively ...
//TODO
//Update all revision numbers in the database
} }
} }
@ -403,9 +449,6 @@ void run(Strings args)
store = openStore(); store = openStore();
//setReferences_statePath("/nix/state/afsdsdafsdaf-sdaf", 7); //setReferences_statePath("/nix/state/afsdsdafsdaf-sdaf", 7);
return;
*/
Paths p1; Paths p1;
p1.push_back("a"); p1.push_back("a");
@ -419,6 +462,21 @@ void run(Strings args)
for (PathSet::iterator i = px.begin(); i != px.end(); ++i) for (PathSet::iterator i = px.begin(); i != px.end(); ++i)
printMsg(lvlError, format("MERGED: %1%") % *i); printMsg(lvlError, format("MERGED: %1%") % *i);
Database nixDB;
Path statePath = "afsdsdafsadf-sda-fsda-f-sdaf-sdaf";
int revision = 5;
Path statePath2;
Path gets = nixDB.makeStatePathRevision(statePath, revision);
int revision2;
nixDB.splitStatePathRevision(gets, statePath2, revision2);
printMsg(lvlError, format("'%1%' '%2%'") % statePath2 % int2String(revision2));
*/
store = openStore();
Derivation drv = derivationFromPath("/nix/store/r2lvhrd8zhb877n07cqvcyp11j9ws5p0-hellohardcodedstateworld-dep1-1.0.drv");
readRevisionNumbers(drv);
return; return;
/* test */ /* test */

View file

@ -112,7 +112,7 @@ void printDotGraph(const PathSet & roots)
cout << makeNode(path, symbolicName(path), "#ff0000"); cout << makeNode(path, symbolicName(path), "#ff0000");
PathSet references; PathSet references;
store->queryReferences(path, references); store->queryReferences(path, references, -1); //TODO maybe also include state paths?
for (PathSet::iterator i = references.begin(); for (PathSet::iterator i = references.begin();
i != references.end(); ++i) i != references.end(); ++i)

View file

@ -212,7 +212,7 @@ static void printTree(const Path & path,
cout << format("%1%%2%\n") % firstPad % path; cout << format("%1%%2%\n") % firstPad % path;
PathSet references; PathSet references;
store->queryReferences(path, references); store->queryReferences(path, references, -1); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Adjust printTree, include state paths!
#if 0 #if 0
for (PathSet::iterator i = drv.inputSrcs.begin(); for (PathSet::iterator i = drv.inputSrcs.begin();
@ -307,10 +307,10 @@ static void opQuery(Strings opFlags, Strings opArgs)
if (query == qRequisites) store->storePathRequisites(path, includeOutputs, paths, true, false); if (query == qRequisites) store->storePathRequisites(path, includeOutputs, paths, true, false);
else if (query == qRequisitesState) store->storePathRequisites(path, includeOutputs, paths, false, true); else if (query == qRequisitesState) store->storePathRequisites(path, includeOutputs, paths, false, true);
else if (query == qRequisitesFull) store->storePathRequisites(path, includeOutputs, paths, true, true); else if (query == qRequisitesFull) store->storePathRequisites(path, includeOutputs, paths, true, true);
else if (query == qReferences) store->queryReferences(path, paths); else if (query == qReferences) store->queryReferences(path, paths, -1);
else if (query == qStateReferences) store->queryStateReferences(path, paths); else if (query == qStateReferences) store->queryStateReferences(path, paths, -1); //latest revision
else if (query == qReferrers) store->queryReferrers(path, paths); else if (query == qReferrers) store->queryReferrers(path, paths, -1);
else if (query == qStateReferrers) store->queryStateReferrers(path, paths); else if (query == qStateReferrers) store->queryStateReferrers(path, paths, -1); //latest revision
else if (query == qReferrersClosure) computeFSClosure(path, paths, true, false, true); else if (query == qReferrersClosure) computeFSClosure(path, paths, true, false, true);
else if (query == qReferrersClosureWithState) computeFSClosure(path, paths, true, true, true); else if (query == qReferrersClosureWithState) computeFSClosure(path, paths, true, true, true);
} }

View file

@ -296,9 +296,9 @@ static void performOp(Source & from, Sink & to, unsigned int op)
startWork(); startWork();
PathSet paths; PathSet paths;
if (op == wopQueryReferences) if (op == wopQueryReferences)
store->queryReferences(path, paths); store->queryReferences(path, paths, -1);
else else
store->queryReferrers(path, paths); store->queryReferrers(path, paths, -1);
stopWork(); stopWork();
writeStringSet(paths, to); writeStringSet(paths, to);
break; break;
@ -310,9 +310,9 @@ static void performOp(Source & from, Sink & to, unsigned int op)
startWork(); startWork();
PathSet paths; PathSet paths;
if (op == wopQueryStateReferences) if (op == wopQueryStateReferences)
store->queryStateReferences(path, paths); store->queryStateReferences(path, paths, -1);
else else
store->queryStateReferrers(path, paths); //TODO Does this work???, how about the state path????????? store->queryStateReferrers(path, paths, -1); //TODO Does this work???, how about the state path?????????
stopWork(); stopWork();
writeStringSet(paths, to); writeStringSet(paths, to);
break; break;