mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 20:20:58 +01:00
Added state marshall functions in RemoteStore.cc (still unfinished in Nix-worker.cc)
This commit is contained in:
parent
bdcce95a39
commit
2e7539bd27
18 changed files with 423 additions and 224 deletions
|
|
@ -1308,7 +1308,7 @@ bool DerivationGoal::prepareBuild()
|
|||
}
|
||||
|
||||
/* The state output is a referenceable path */
|
||||
if(store->isStateDrv(drv))
|
||||
if(isStateDrv(drv))
|
||||
allStatePaths.insert(drv.stateOutputs.find("state")->second.statepath);
|
||||
|
||||
/* Determine the full set of input paths. */
|
||||
|
|
@ -1754,7 +1754,7 @@ void DerivationGoal::computeClosure()
|
|||
* If state is enabled for the path we:
|
||||
* [scan for and state references and component references in the state path] //3,4
|
||||
*/
|
||||
if(isStateDrvTxn(noTxn, drv)){ //TODO
|
||||
if(isStateDrv(drv)){ //TODO
|
||||
|
||||
Path sharedState = drv.stateOutputs.find("state")->second.sharedState;
|
||||
if(sharedState != ""){
|
||||
|
|
@ -1799,7 +1799,7 @@ void DerivationGoal::computeClosure()
|
|||
}
|
||||
|
||||
//Register the state path valid
|
||||
if(isStateDrvTxn(txn, drv))
|
||||
if(isStateDrv(drv))
|
||||
{
|
||||
Path statePath = drv.stateOutputs.find("state")->second.statepath;
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ static TableId dbStateRevisions = 0;
|
|||
*/
|
||||
static TableId dbStateRevisionsComments = 0;
|
||||
|
||||
/* dbStateSnapshots :: StatePath -> RevisionNumbers
|
||||
/* dbStateSnapshots :: StatePath -> IntVector
|
||||
*
|
||||
* This table stores the snapshot numbers the sub state files/folders
|
||||
* at a certain timestamp. These snapshot numbers are just timestamps
|
||||
|
|
@ -541,20 +541,6 @@ void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet
|
|||
nix::queryXReferencesTxn(noTxn, componentOrstatePath, stateReferences, revision, false);
|
||||
}
|
||||
|
||||
void queryAllReferencesTxn(const Transaction & txn, const Path & path, PathSet & allReferences, const int revision)
|
||||
{
|
||||
PathSet references;
|
||||
PathSet stateReferences;
|
||||
queryXReferencesTxn(txn, path, references, true, revision);
|
||||
queryXReferencesTxn(txn, path, stateReferences, false, revision);
|
||||
allReferences = pathSets_union(references, stateReferences);
|
||||
}
|
||||
|
||||
void LocalStore::queryAllReferences(const Path & path, PathSet & allReferences, const int revision)
|
||||
{
|
||||
queryAllReferencesTxn(noTxn, path, allReferences, revision);
|
||||
}
|
||||
|
||||
static PathSet getXReferrers(const Transaction & txn, const Path & store_or_statePath, const bool component_or_state, const int revision)
|
||||
{
|
||||
TableId table = 0;
|
||||
|
|
@ -788,25 +774,12 @@ bool LocalStore::isStateComponent(const Path & storePath)
|
|||
bool isStateDrvPathTxn(const Transaction & txn, const Path & drvPath)
|
||||
{
|
||||
Derivation drv = derivationFromPathTxn(txn, drvPath);
|
||||
return isStateDrvTxn(txn, drv);
|
||||
return isStateDrv(drv);
|
||||
}
|
||||
|
||||
bool LocalStore::isStateDrvPath(const Path & isStateDrv)
|
||||
bool isStateDrv(const Derivation & drv)
|
||||
{
|
||||
return nix::isStateDrvPathTxn(noTxn, isStateDrv);
|
||||
}
|
||||
|
||||
bool isStateDrvTxn(const Transaction & txn, const Derivation & drv)
|
||||
{
|
||||
if (drv.stateOutputs.size() != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LocalStore::isStateDrv(const Derivation & drv)
|
||||
{
|
||||
return nix::isStateDrvTxn(noTxn, drv);
|
||||
return (drv.stateOutputs.size() != 0);
|
||||
}
|
||||
|
||||
static Path queryDeriver(const Transaction & txn, const Path & storePath)
|
||||
|
|
@ -818,7 +791,7 @@ static Path queryDeriver(const Transaction & txn, const Path & storePath)
|
|||
bool b = nixDB.queryString(txn, dbDerivers, storePath, deriver);
|
||||
|
||||
Derivation drv = derivationFromPathTxn(txn, deriver);
|
||||
if (isStateDrvTxn(txn, drv))
|
||||
if (isStateDrv(drv))
|
||||
throw Error(format("This deriver `%1%' is a state deriver, u should use queryDerivers instead of queryDeriver") % deriver);
|
||||
|
||||
if (b)
|
||||
|
|
@ -1573,7 +1546,7 @@ void verifyStore(bool checkContents)
|
|||
txn.commit();
|
||||
}
|
||||
|
||||
void setStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths, const vector<int> & intervals, bool allZero)
|
||||
void setStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths, const IntVector & intervals, bool allZero)
|
||||
{
|
||||
if(!allZero && statePaths.size() != intervals.size()){
|
||||
throw Error("the number of statepaths and intervals must be equal");
|
||||
|
|
@ -1587,25 +1560,25 @@ void setStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePath
|
|||
int interval=0;
|
||||
if(!allZero)
|
||||
interval = intervals.at(n);
|
||||
|
||||
|
||||
nixDB.setString(txn, dbStateCounters, *i, int2String(interval));
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalStore::setStatePathsInterval(const PathSet & statePaths, const vector<int> & intervals, bool allZero)
|
||||
void LocalStore::setStatePathsInterval(const PathSet & statePaths, const IntVector & intervals, bool allZero)
|
||||
{
|
||||
Transaction txn(nixDB);
|
||||
nix::setStatePathsIntervalTxn(txn, statePaths, intervals, allZero);
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
vector<int> getStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths)
|
||||
IntVector getStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths)
|
||||
{
|
||||
string data;
|
||||
Paths referers;
|
||||
|
||||
vector<int> intervals;
|
||||
IntVector intervals;
|
||||
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i)
|
||||
{
|
||||
nixDB.queryString(txn, dbStateCounters, *i, data);
|
||||
|
|
@ -1620,7 +1593,7 @@ vector<int> getStatePathsIntervalTxn(const Transaction & txn, const PathSet & st
|
|||
return intervals;
|
||||
}
|
||||
|
||||
vector<int> LocalStore::getStatePathsInterval(const PathSet & statePaths)
|
||||
IntVector LocalStore::getStatePathsInterval(const PathSet & statePaths)
|
||||
{
|
||||
return nix::getStatePathsIntervalTxn(noTxn, statePaths);
|
||||
}
|
||||
|
|
@ -1645,12 +1618,12 @@ vector<int> LocalStore::getStatePathsInterval(const PathSet & statePaths)
|
|||
|
||||
TODO Change comment, this can also take state paths
|
||||
*/
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision)
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision)
|
||||
{
|
||||
nix::storePathRequisitesTxn(noTxn, storeOrstatePath, includeOutputs, paths, withComponents, withState, revision);
|
||||
}
|
||||
|
||||
void storePathRequisitesTxn(const Transaction & txn, const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision)
|
||||
void storePathRequisitesTxn(const Transaction & txn, const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision)
|
||||
{
|
||||
computeFSClosureTxn(txn, storeOrstatePath, paths, withComponents, withState, revision);
|
||||
|
||||
|
|
@ -1667,7 +1640,7 @@ void storePathRequisitesTxn(const Transaction & txn, const Path & storeOrstatePa
|
|||
}
|
||||
}
|
||||
|
||||
void LocalStore::storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision)
|
||||
void LocalStore::storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision)
|
||||
{
|
||||
nix::storePathRequisites(storeOrstatePath, includeOutputs, paths, withComponents, withState, revision);
|
||||
}
|
||||
|
|
@ -1848,7 +1821,7 @@ PathSet getSharedWithPathSetRecTxn(const Transaction & txn, const Path & statePa
|
|||
}
|
||||
|
||||
|
||||
void LocalStore::revertToRevision(Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive)
|
||||
void LocalStore::revertToRevision(const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive)
|
||||
{
|
||||
Transaction txn(nixDB);
|
||||
revertToRevisionTxn(txn, componentPath, derivationPath, statePath, revision_arg, recursive);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ public:
|
|||
|
||||
void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision);
|
||||
|
||||
void queryAllReferences(const Path & path, PathSet & allReferences, const int revision);
|
||||
|
||||
void queryReferrers(const Path & path, PathSet & referrers, const int revision);
|
||||
|
||||
void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision);
|
||||
|
|
@ -90,17 +88,13 @@ public:
|
|||
|
||||
/////////////////////////////
|
||||
|
||||
void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false);
|
||||
void setStatePathsInterval(const PathSet & statePath, const IntVector & intervals, bool allZero = false);
|
||||
|
||||
vector<int> getStatePathsInterval(const PathSet & statePaths);
|
||||
IntVector getStatePathsInterval(const PathSet & statePaths);
|
||||
|
||||
bool isStateComponent(const Path & storePath);
|
||||
|
||||
bool isStateDrvPath(const Path & drvpath);
|
||||
|
||||
bool isStateDrv(const Derivation & drv);
|
||||
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision);
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision);
|
||||
|
||||
void setStateRevisions(const RevisionClosure & revisions, const Path & rootStatePath, const string & comment);
|
||||
|
||||
|
|
@ -110,7 +104,7 @@ public:
|
|||
|
||||
Snapshots commitStatePath(const Path & statePath);
|
||||
|
||||
Path queryDeriver(const Path & path); //should these be in here ????
|
||||
Path queryDeriver(const Path & path);
|
||||
|
||||
PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user); //should these be in here ????
|
||||
|
||||
|
|
@ -118,7 +112,7 @@ public:
|
|||
|
||||
PathSet toNonSharedPathSet(const PathSet & statePaths);
|
||||
|
||||
void revertToRevision(Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive);
|
||||
void revertToRevision(const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -219,7 +213,7 @@ bool isStateComponentTxn(const Transaction & txn, const Path & path);
|
|||
|
||||
bool isStateDrvPathTxn(const Transaction & txn, const Path & drvPath);
|
||||
|
||||
bool isStateDrvTxn(const Transaction & txn, const Derivation & drv);
|
||||
bool isStateDrv(const Derivation & drv);
|
||||
|
||||
//TODO can this ?????
|
||||
void queryAllValidPathsTxn(const Transaction & txn, PathSet & allComponentPaths, PathSet & allStatePaths);
|
||||
|
|
@ -235,7 +229,7 @@ void queryReferrersTxn(const Transaction & txn, const Path & storePath, PathSet
|
|||
void queryStateReferrersTxn(const Transaction & txn, const Path & storePath, PathSet & stateReferrers, const int revision);
|
||||
|
||||
Path queryStatePathDrvTxn(const Transaction & txn, const Path & statePath);
|
||||
void storePathRequisitesTxn(const Transaction & txn, const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision);
|
||||
void storePathRequisitesTxn(const Transaction & txn, const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision);
|
||||
void setStateRevisionsTxn(const Transaction & txn, const RevisionClosure & revisions, const Path & rootStatePath, const string & comment);
|
||||
|
||||
bool isValidPathTxn(const Transaction & txn, const Path & path);
|
||||
|
|
@ -250,10 +244,10 @@ Path toNonSharedPathTxn(const Transaction & txn, const Path & statePath);
|
|||
PathSet getSharedWithPathSetRecTxn(const Transaction & txn, const Path & statePath);
|
||||
|
||||
void ensurePathTxn(const Transaction & txn, const Path & path);
|
||||
vector<int> getStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths);
|
||||
IntVector getStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths);
|
||||
|
||||
bool queryStateRevisionsTxn(const Transaction & txn, const Path & statePath, RevisionClosure & revisions, RevisionClosureTS & timestamps, const int revision);
|
||||
void setStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePath, const vector<int> & intervals, bool allZero = false);
|
||||
void setStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePath, const IntVector & intervals, bool allZero = false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,8 +212,7 @@ Path RemoteStore::queryStatePathDrv(const Path & statePath)
|
|||
writeInt(wopQueryStatePathDrv, to);
|
||||
writeString(statePath, to);
|
||||
processStderr();
|
||||
Path p = readString(from); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!! check wheter from is the state path ????
|
||||
return p;
|
||||
return readString(from);
|
||||
}
|
||||
|
||||
void RemoteStore::queryReferences(const Path & path,
|
||||
|
|
@ -221,10 +220,10 @@ void RemoteStore::queryReferences(const Path & path,
|
|||
{
|
||||
writeInt(wopQueryReferences, to);
|
||||
writeString(path, to);
|
||||
writeInt(revision, to);
|
||||
processStderr();
|
||||
PathSet references2 = readStorePaths(from);
|
||||
references.insert(references2.begin(), references2.end());
|
||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
|
||||
}
|
||||
|
||||
void RemoteStore::queryStateReferences(const Path & path,
|
||||
|
|
@ -232,29 +231,23 @@ void RemoteStore::queryStateReferences(const Path & path,
|
|||
{
|
||||
writeInt(wopQueryStateReferences, to);
|
||||
writeString(path, to);
|
||||
writeInt(revision, to);
|
||||
processStderr();
|
||||
PathSet stateReferences2 = readStorePaths(from);
|
||||
stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
|
||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
|
||||
}
|
||||
|
||||
|
||||
void RemoteStore::queryAllReferences(const Path & path,
|
||||
PathSet & allReferences, const int revision)
|
||||
{
|
||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
}
|
||||
|
||||
void RemoteStore::queryReferrers(const Path & path,
|
||||
PathSet & referrers, const int revision)
|
||||
{
|
||||
writeInt(wopQueryReferrers, to);
|
||||
writeString(path, to);
|
||||
writeInt(revision, to);
|
||||
processStderr();
|
||||
PathSet referrers2 = readStorePaths(from);
|
||||
referrers.insert(referrers2.begin(), referrers2.end());
|
||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
|
||||
|
||||
}
|
||||
|
||||
void RemoteStore::queryStateReferrers(const Path & path,
|
||||
|
|
@ -262,10 +255,10 @@ void RemoteStore::queryStateReferrers(const Path & path,
|
|||
{
|
||||
writeInt(wopQueryStateReferrers, to);
|
||||
writeString(path, to);
|
||||
writeInt(revision, to);
|
||||
processStderr();
|
||||
PathSet stateReferrers2 = readStorePaths(from);
|
||||
stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end());
|
||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! include revision?
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -319,7 +312,7 @@ Path RemoteStore::importPath(bool requireSignature, Source & source)
|
|||
anyway. */
|
||||
|
||||
processStderr(0, &source);
|
||||
Path path = readStorePath(from);
|
||||
//Path path = readStorePath(from); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! remove
|
||||
return readStorePath(from);
|
||||
}
|
||||
|
||||
|
|
@ -403,6 +396,136 @@ void RemoteStore::collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
|||
bytesFreed = (((unsigned long long) hi) << 32) | lo;
|
||||
}
|
||||
|
||||
PathSet RemoteStore::queryDerivers(const Path & storePath, const string & identifier, const string & user)
|
||||
{
|
||||
writeInt(wopQueryDerivers, to);
|
||||
writeString(storePath, to);
|
||||
writeString(identifier, to);
|
||||
writeString(user, to);
|
||||
processStderr();
|
||||
return readStorePaths(from); //TODO is this ok ??
|
||||
}
|
||||
|
||||
void RemoteStore::setStatePathsInterval(const PathSet & statePaths, const IntVector & intervals, bool allZero)
|
||||
{
|
||||
writeInt(wopSetStatePathsInterval, to);
|
||||
writeStringSet(statePaths, to);
|
||||
writeIntVector(intervals, to);
|
||||
writeInt(allZero ? 1 : 0, to);
|
||||
processStderr();
|
||||
readInt(from);
|
||||
}
|
||||
|
||||
IntVector RemoteStore::getStatePathsInterval(const PathSet & statePaths)
|
||||
{
|
||||
writeInt(wopGetStatePathsInterval, to);
|
||||
writeStringSet(statePaths, to);
|
||||
processStderr();
|
||||
return readIntVector(from);
|
||||
}
|
||||
|
||||
bool RemoteStore::isStateComponent(const Path & path)
|
||||
{
|
||||
writeInt(wopIsStateComponent, to);
|
||||
writeString(path, to);
|
||||
processStderr();
|
||||
unsigned int reply = readInt(from);
|
||||
return reply != 0;
|
||||
}
|
||||
|
||||
void RemoteStore::storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision)
|
||||
{
|
||||
writeInt(wopStorePathRequisites, to);
|
||||
writeString(storeOrstatePath, to);
|
||||
writeInt(includeOutputs ? 1 : 0, to);
|
||||
writeStringSet(paths, to);
|
||||
writeInt(withComponents ? 1 : 0, to);
|
||||
writeInt(withState ? 1 : 0, to);
|
||||
writeInt(revision, to);
|
||||
processStderr();
|
||||
readInt(from);
|
||||
}
|
||||
|
||||
void RemoteStore::setStateRevisions(const RevisionClosure & revisions, const Path & rootStatePath, const string & comment)
|
||||
{
|
||||
writeInt(wopSetStateRevisions, to);
|
||||
writeRevisionClosure(revisions, to);
|
||||
writeString(rootStatePath, to);
|
||||
writeString(comment, to);
|
||||
processStderr();
|
||||
readInt(from);
|
||||
}
|
||||
|
||||
bool RemoteStore::queryStateRevisions(const Path & statePath, RevisionClosure & revisions, RevisionClosureTS & timestamps, const int revision)
|
||||
{
|
||||
writeInt(wopQueryStateRevisions, to);
|
||||
writeString(statePath, to);
|
||||
writeInt(revision, to);
|
||||
RevisionClosure revisions2 = readRevisionClosure(from);
|
||||
RevisionClosureTS timestamps2 = readRevisionClosureTS(from);
|
||||
revisions = revisions2; //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
timestamps = timestamps2; //TODO !!!!!!!!!!!!!!!!!!!! COPY BY VALUE I THINK
|
||||
processStderr();
|
||||
unsigned int reply = readInt(from);
|
||||
return reply != 0;
|
||||
}
|
||||
|
||||
bool RemoteStore::queryAvailableStateRevisions(const Path & statePath, RevisionInfos & revisions)
|
||||
{
|
||||
writeInt(wopQueryAvailableStateRevisions, to);
|
||||
writeString(statePath, to);
|
||||
RevisionInfos revisions2 = readRevisionInfos(from);
|
||||
revisions = revisions2; //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
processStderr();
|
||||
unsigned int reply = readInt(from);
|
||||
return reply != 0;
|
||||
}
|
||||
|
||||
Snapshots RemoteStore::commitStatePath(const Path & statePath)
|
||||
{
|
||||
writeInt(wopCommitStatePath, to);
|
||||
writeString(statePath, to);
|
||||
processStderr();
|
||||
return readSnapshots(from);
|
||||
}
|
||||
|
||||
void RemoteStore::scanAndUpdateAllReferences(const Path & statePath, const bool recursive)
|
||||
{
|
||||
writeInt(wopScanAndUpdateAllReferences, to);
|
||||
writeString(statePath, to);
|
||||
writeInt(recursive ? 1 : 0, to);
|
||||
processStderr();
|
||||
readInt(from);
|
||||
}
|
||||
|
||||
Path RemoteStore::queryDeriver(const Path & path)
|
||||
{
|
||||
writeInt(wopQueryDeriver, to);
|
||||
writeString(path, to);
|
||||
processStderr();
|
||||
return readStorePath(from);
|
||||
}
|
||||
|
||||
PathSet RemoteStore::toNonSharedPathSet(const PathSet & statePaths)
|
||||
{
|
||||
writeInt(wopToNonSharedPathSet, to);
|
||||
writeStringSet(statePaths, to);
|
||||
processStderr();
|
||||
return readStringSet(from); //TODO !!!!!!!!!!!!!!! create a readStatePaths just like readStorePaths
|
||||
}
|
||||
|
||||
void RemoteStore::revertToRevision(const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive)
|
||||
{
|
||||
writeInt(wopRevertToRevision, to);
|
||||
writeString(componentPath, to);
|
||||
writeString(derivationPath, to);
|
||||
writeString(statePath, to);
|
||||
writeInt(revision_arg, to);
|
||||
writeInt(recursive ? 1 : 0, to);
|
||||
processStderr();
|
||||
readInt(from);
|
||||
}
|
||||
|
||||
|
||||
void RemoteStore::processStderr(Sink * sink, Source * source)
|
||||
{
|
||||
|
|
@ -433,100 +556,6 @@ void RemoteStore::processStderr(Sink * sink, Source * source)
|
|||
throw Error("protocol error processing standard error");
|
||||
}
|
||||
|
||||
//TODO
|
||||
void RemoteStore::setStatePathsInterval(const PathSet & statePaths, const vector<int> & intervals, bool allZero)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
vector<int> RemoteStore::getStatePathsInterval(const PathSet & statePaths)
|
||||
{
|
||||
vector<int> intervals;
|
||||
return intervals;
|
||||
}
|
||||
|
||||
//TODO
|
||||
bool RemoteStore::isStateComponent(const Path & path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
bool RemoteStore::isStateDrvPath(const Path & drvpath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
bool RemoteStore::isStateDrv(const Derivation & drv)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
void RemoteStore::storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
void RemoteStore::setStateRevisions(const RevisionClosure & revisions, const Path & rootStatePath, const string & comment)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
bool RemoteStore::queryStateRevisions(const Path & statePath, RevisionClosure & revisions, RevisionClosureTS & timestamps, const int revision)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
bool RemoteStore::queryAvailableStateRevisions(const Path & statePath, RevisionInfos & revisions)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
Snapshots RemoteStore::commitStatePath(const Path & statePath)
|
||||
{
|
||||
Snapshots ss;
|
||||
return ss;
|
||||
}
|
||||
|
||||
void RemoteStore::scanAndUpdateAllReferences(const Path & statePath, const bool recursive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Path RemoteStore::queryDeriver(const Path & path)
|
||||
{
|
||||
writeInt(wopQueryDeriver, to);
|
||||
writeString(path, to);
|
||||
processStderr();
|
||||
return readStorePath(from);
|
||||
}
|
||||
|
||||
PathSet RemoteStore::queryDerivers(const Path & storePath, const string & identifier, const string & user)
|
||||
{
|
||||
writeInt(wopQueryDerivers, to);
|
||||
writeString(storePath, to);
|
||||
writeString(identifier, to);
|
||||
writeString(user, to);
|
||||
processStderr();
|
||||
return readStorePaths(from); //TODO is this ok ??
|
||||
}
|
||||
|
||||
PathSet RemoteStore::toNonSharedPathSet(const PathSet & statePaths)
|
||||
{
|
||||
PathSet p;
|
||||
return p;
|
||||
}
|
||||
|
||||
void RemoteStore::revertToRevision(Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ public:
|
|||
|
||||
void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision);
|
||||
|
||||
void queryAllReferences(const Path & path, PathSet & allReferences, const int revision);
|
||||
|
||||
void queryReferrers(const Path & path, PathSet & referrers, const int revision);
|
||||
|
||||
void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision);
|
||||
|
|
@ -76,17 +74,13 @@ public:
|
|||
void collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
||||
bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed);
|
||||
|
||||
void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false);
|
||||
void setStatePathsInterval(const PathSet & statePath, const IntVector & intervals, bool allZero = false);
|
||||
|
||||
vector<int> getStatePathsInterval(const PathSet & statePaths);
|
||||
IntVector getStatePathsInterval(const PathSet & statePaths);
|
||||
|
||||
bool isStateComponent(const Path & path);
|
||||
|
||||
bool isStateDrvPath(const Path & drvpath);
|
||||
|
||||
bool isStateDrv(const Derivation & drv);
|
||||
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision);
|
||||
void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision);
|
||||
|
||||
void setStateRevisions(const RevisionClosure & revisions, const Path & rootStatePath, const string & comment);
|
||||
|
||||
|
|
@ -104,7 +98,7 @@ public:
|
|||
|
||||
PathSet toNonSharedPathSet(const PathSet & statePaths);
|
||||
|
||||
void revertToRevision(Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive);
|
||||
void revertToRevision(const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive);
|
||||
|
||||
private:
|
||||
AutoCloseFD fdSocket;
|
||||
|
|
|
|||
|
|
@ -87,8 +87,6 @@ public:
|
|||
The result is not cleared. */
|
||||
virtual void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision) = 0;
|
||||
|
||||
virtual void queryAllReferences(const Path & path, PathSet & allReferences, const int revision) = 0;
|
||||
|
||||
/* Queries the set of incoming FS references for a store path.
|
||||
The result is not cleared. */
|
||||
virtual void queryReferrers(const Path & path,
|
||||
|
|
@ -202,22 +200,16 @@ public:
|
|||
bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false) = 0;
|
||||
virtual void setStatePathsInterval(const PathSet & statePath, const IntVector & intervals, bool allZero = false) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual vector<int> getStatePathsInterval(const PathSet & statePaths) = 0;
|
||||
virtual IntVector getStatePathsInterval(const PathSet & statePaths) = 0;
|
||||
|
||||
/* Checks whether a path is a component path that has a statePath. */
|
||||
virtual bool isStateComponent(const Path & path) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual bool isStateDrvPath(const Path & drvpath) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual bool isStateDrv(const Derivation & drv) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision) = 0;
|
||||
virtual void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool withComponents, const bool withState, const int revision) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual void setStateRevisions(const RevisionClosure & revisions, const Path & rootStatePath, const string & comment) = 0;
|
||||
|
|
@ -234,14 +226,18 @@ public:
|
|||
/* Query the deriver of a store path. Return the empty string if
|
||||
no deriver has been set. */
|
||||
virtual Path queryDeriver(const Path & path) = 0;
|
||||
|
||||
|
||||
/* TODO */
|
||||
virtual PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user) = 0;
|
||||
|
||||
|
||||
/* TODO */
|
||||
virtual void scanAndUpdateAllReferences(const Path & statePath, const bool recursive) = 0;
|
||||
|
||||
/* TODO */
|
||||
virtual PathSet toNonSharedPathSet(const PathSet & statePaths) = 0;
|
||||
|
||||
virtual void revertToRevision(Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive) = 0;
|
||||
/* TODO */
|
||||
virtual void revertToRevision(const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void createStateDirsTxn(const Transaction & txn, const DerivationStateOutputDirs
|
|||
}
|
||||
|
||||
//Initialize the counters for the statePaths that have an interval to 0
|
||||
vector<int> empty;
|
||||
IntVector empty;
|
||||
setStatePathsIntervalTxn(txn, intervalPaths, empty, true);
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ PathSet getAllStateDerivationsRecursivelyTxn(const Transaction & txn, const Path
|
|||
|
||||
|
||||
|
||||
void revertToRevisionTxn(const Transaction & txn, Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive)
|
||||
void revertToRevisionTxn(const Transaction & txn, const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive)
|
||||
{
|
||||
|
||||
PathSet statePaths;
|
||||
|
|
@ -222,7 +222,7 @@ Snapshots commitStatePathTxn(const Transaction & txn, const Path & statePath)
|
|||
intervalPaths.insert(fullstatedir);
|
||||
}
|
||||
}
|
||||
vector<int> intervals = getStatePathsIntervalTxn(txn, intervalPaths);
|
||||
IntVector intervals = getStatePathsIntervalTxn(txn, intervalPaths);
|
||||
|
||||
Snapshots revisions_list;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa
|
|||
|
||||
void scanAndUpdateAllReferencesRecusivelyTxn(const Transaction & txn, const Path & statePath);
|
||||
|
||||
void revertToRevisionTxn(const Transaction & txn, Path & componentPath, Path & derivationPath, Path & statePath, int revision_arg, bool recursive);
|
||||
void revertToRevisionTxn(const Transaction & txn, const Path & componentPath, const Path & derivationPath, const Path & statePath, const int revision_arg, const bool recursive);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,19 @@ typedef enum {
|
|||
wopExportPath,
|
||||
wopImportPath,
|
||||
wopQueryDeriver,
|
||||
|
||||
wopQueryDerivers,
|
||||
wopSetStatePathsInterval,
|
||||
wopGetStatePathsInterval,
|
||||
wopIsStateComponent,
|
||||
wopStorePathRequisites,
|
||||
wopSetStateRevisions,
|
||||
wopQueryStateRevisions,
|
||||
wopQueryAvailableStateRevisions,
|
||||
wopCommitStatePath,
|
||||
wopScanAndUpdateAllReferences,
|
||||
wopToNonSharedPathSet,
|
||||
wopRevertToRevision,
|
||||
} WorkerOp;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue