forked from NixOS/nix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from obsidiansystems/ipfs-git-method
Add git file ingestion method
- Loading branch information
Showing
18 changed files
with
287 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "binary-cache-store.hh" | ||
|
||
namespace nix { | ||
|
||
class IpfsStore : public BinaryCacheStore | ||
{ | ||
Path daemonUri; | ||
|
||
public: | ||
|
||
IpfsStore( | ||
const Params & params, const Path & _daemonUri) | ||
: BinaryCacheStore(params) | ||
, daemonUri(_daemonUri) | ||
{ | ||
if (daemonUri.back() == '/') | ||
daemonUri.pop_back(); | ||
} | ||
|
||
std::string getUri() override | ||
{ | ||
return daemonUri; | ||
} | ||
|
||
void init() override | ||
{ | ||
} | ||
|
||
bool fileExists(const std::string & path) override | ||
{ | ||
return false; | ||
} | ||
|
||
void upsertFile(const std::string & path, | ||
const std::string & data, | ||
const std::string & mimeType) override | ||
{ | ||
} | ||
|
||
void getFile(const std::string & path, Sink & sink) override | ||
{ | ||
} | ||
|
||
void getFile(const std::string & path, Callback<std::shared_ptr<std::string>> callback) noexcept override | ||
{ | ||
} | ||
|
||
}; | ||
|
||
static RegisterStoreImplementation regStore([]( | ||
const std::string & uri, const Store::Params & params) | ||
-> std::shared_ptr<Store> | ||
{ | ||
if (std::string(uri, 0, 12) != "ipfs+http://") | ||
return 0; | ||
auto store = std::make_shared<IpfsStore>(params, std::string(uri, 5)); | ||
store->init(); | ||
return store; | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.