Separate store configs from the implems
Rework the `Store` hierarchy so that there's now one hierarchy for the
store configs and one for the implementations (where each implementation
extends the corresponding config). So a class hierarchy like
```
StoreConfig-------->Store
| |
v v
SubStoreConfig----->SubStore
| |
v v
SubSubStoreConfig-->SubSubStore
```
(with virtual inheritance to prevent DDD).
The advantage of this architecture is that we can now introspect the configuration of a store without having to instantiate the store itself
This commit is contained in:
@@ -7,7 +7,12 @@ namespace nix {
|
||||
|
||||
MakeError(UploadToHTTP, Error);
|
||||
|
||||
class HttpBinaryCacheStore : public BinaryCacheStore
|
||||
struct HttpBinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
|
||||
{
|
||||
using BinaryCacheStoreConfig::BinaryCacheStoreConfig;
|
||||
};
|
||||
|
||||
class HttpBinaryCacheStore : public BinaryCacheStore, public HttpBinaryCacheStoreConfig
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -23,16 +28,11 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
HttpBinaryCacheStore(
|
||||
const Params & params)
|
||||
: HttpBinaryCacheStore("dummy", params)
|
||||
{
|
||||
}
|
||||
|
||||
HttpBinaryCacheStore(
|
||||
const Path & _cacheUri,
|
||||
const Params & params)
|
||||
: BinaryCacheStore(params)
|
||||
, HttpBinaryCacheStoreConfig(params)
|
||||
, cacheUri(_cacheUri)
|
||||
{
|
||||
if (cacheUri.back() == '/')
|
||||
@@ -176,6 +176,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
static RegisterStoreImplementation<HttpBinaryCacheStore> regStore;
|
||||
static RegisterStoreImplementation<HttpBinaryCacheStore, HttpBinaryCacheStoreConfig> regStore;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user