Implement S3BinaryCacheStore::queryAllValidPaths()
This allows commands like "nix verify --all" or "nix path-info --all" to work on S3 caches. Unfortunately, this requires some ugly hackery: when querying the contents of the bucket, we don't want to have to read every .narinfo file. But the S3 bucket keys only include the hash part of each store path, not the name part. So as a special exception queryAllValidPaths() can now return store paths *without* the name part, and queryPathInfo() accepts such store paths (returning a ValidPathInfo object containing the full name).
This commit is contained in:
		
							parent
							
								
									d155d80155
								
							
						
					
					
						commit
						7d14f5c331
					
				
					 9 changed files with 113 additions and 54 deletions
				
			
		|  | @ -181,7 +181,7 @@ protected: | |||
| 
 | ||||
|     struct State | ||||
|     { | ||||
|         LRUCache<Path, std::shared_ptr<ValidPathInfo>> pathInfoCache{64 * 1024}; | ||||
|         LRUCache<std::string, std::shared_ptr<ValidPathInfo>> pathInfoCache{64 * 1024}; | ||||
|     }; | ||||
| 
 | ||||
|     Sync<State> state; | ||||
|  | @ -206,10 +206,15 @@ public: | |||
|     /* Query which of the given paths is valid. */ | ||||
|     virtual PathSet queryValidPaths(const PathSet & paths) = 0; | ||||
| 
 | ||||
|     /* Query the set of all valid paths. */ | ||||
|     /* Query the set of all valid paths. Note that for some store
 | ||||
|        backends, the name part of store paths may be omitted | ||||
|        (i.e. you'll get /nix/store/<hash> rather than | ||||
|        /nix/store/<hash>-<name>). Use queryPathInfo() to obtain the | ||||
|        full store path. */ | ||||
|     virtual PathSet queryAllValidPaths() = 0; | ||||
| 
 | ||||
|     /* Query information about a valid path. */ | ||||
|     /* Query information about a valid path. It is permitted to omit
 | ||||
|        the name part of the store path. */ | ||||
|     ref<const ValidPathInfo> queryPathInfo(const Path & path); | ||||
| 
 | ||||
| protected: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue