mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 12:10:59 +01:00
Fixed referrer issue
This commit is contained in:
parent
5e0716bbbb
commit
bd25de8d88
1 changed files with 22 additions and 8 deletions
|
|
@ -495,15 +495,26 @@ void setReferences(const Transaction & txn, const Path & store_or_statePath,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & references, const int revision, int timestamp)
|
void queryXReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & references, const int revision, int timestamp, const bool component_or_state)
|
||||||
{
|
{
|
||||||
Paths references2;
|
Paths references2;
|
||||||
|
Table table1;
|
||||||
|
Table table2;
|
||||||
|
|
||||||
|
if(component_or_state){
|
||||||
|
table1 = dbComponentComponentReferences;
|
||||||
|
table2 = dbStateComponentReferences;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
table1 = dbComponentStateReferences;
|
||||||
|
table2 = dbStateStateReferences;
|
||||||
|
}
|
||||||
|
|
||||||
if(isRealisablePath(txn, store_or_statePath))
|
if(isRealisablePath(txn, store_or_statePath))
|
||||||
nixDB.queryStrings(txn, dbComponentComponentReferences, store_or_statePath, references2);
|
nixDB.queryStrings(txn, table1, store_or_statePath, references2);
|
||||||
else if(isRealisableStatePath(txn, store_or_statePath)){
|
else if(isRealisableStatePath(txn, store_or_statePath)){
|
||||||
Path statePath_ns = toNonSharedPathTxn(txn, store_or_statePath); //Lookup its where it points to if its shared
|
Path statePath_ns = toNonSharedPathTxn(txn, store_or_statePath); //Lookup its where it points to if its shared
|
||||||
nixDB.queryStateReferences(txn, dbStateComponentReferences, dbStateRevisions, statePath_ns, references2, revision, timestamp);
|
nixDB.queryStateReferences(txn, table2, dbStateRevisions, statePath_ns, references2, revision, timestamp);
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|
@ -511,12 +522,9 @@ void queryReferencesTxn(const Transaction & txn, const Path & store_or_statePath
|
||||||
references.insert(references2.begin(), references2.end());
|
references.insert(references2.begin(), references2.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalStore::queryReferences(const Path & storePath, PathSet & references, const int revision)
|
|
||||||
{
|
|
||||||
nix::queryReferencesTxn(noTxn, storePath, references, revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO this is just a copy of queryReferencesTxn with small differences */
|
/* TODO this is just a copy of queryReferencesTxn with small differences */
|
||||||
|
/*
|
||||||
void queryStateReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & stateReferences, const int revision, int timestamp)
|
void queryStateReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & stateReferences, const int revision, int timestamp)
|
||||||
{
|
{
|
||||||
Paths stateReferences2;
|
Paths stateReferences2;
|
||||||
|
|
@ -532,10 +540,16 @@ void queryStateReferencesTxn(const Transaction & txn, const Path & store_or_stat
|
||||||
|
|
||||||
stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
|
stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void LocalStore::queryReferences(const Path & storePath, PathSet & references, const int revision)
|
||||||
|
{
|
||||||
|
nix::queryXReferencesTxn(noTxn, storePath, references, revision, true);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences, const int revision)
|
void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences, const int revision)
|
||||||
{
|
{
|
||||||
nix::queryStateReferencesTxn(noTxn, componentOrstatePath, stateReferences, revision);
|
nix::queryXReferencesTxn(noTxn, componentOrstatePath, stateReferences, revision, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryAllReferencesTxn(const Transaction & txn, const Path & path, PathSet & allReferences, const int revision)
|
void queryAllReferencesTxn(const Transaction & txn, const Path & path, PathSet & allReferences, const int revision)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue