-
-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Backends? #76
Comments
Hello, I don't have plans to implement it any time soon. Right now I am busy
|
As you might have noticed, Rugged has removed their implementation for custom backends. It seems to be super slow due context switches. If you want to use a custom backend you should do it in libgit2 (see https://github.com/libgit2/libgit2-backends) |
Rugged does have some left-over backends support, but it was removed because it's simply too slow to implement the backend in a scripting language. You have to move the data from C to python, convert it and then do the whole dance in reverse. By the time the data makes it to whatever database you want to store the data, you've grown old and don't care about it any more. What would be good is a way to connect the backend written in native code with the library directly, but be able to control that through python, so you don't have to write system code. How simple or doable that is, however, is a different matter. |
What about native backend support? Would there be a way for me to use pygit2 with one of these existing backends? https://github.com/libgit2/libgit2-backends |
I have never looked into this. We need some courageous adventurer to explore it... Share here if you try. |
Hi, I've taken a look at this matter and prototyped some code linking up libgit2/libgit2-backends with pygit2. It'd be great to get some feedback on whether there's interest in merging it, whether I've missed something etc. libgit2 neatly separates it's operations from how data is stored through storage backend API's, published in git2/sys/*.h. To use a custom backend with libgit2, one has to build a git_repository around odb / refdb objects configured to use the custom backend rather than the default filesystem backends. Once the git_repository is initialized, the backend is completely transparant to the libgit2 API. Thus, pygit2 would only need to build custom git_repository's to support custom backends. In the work at jmorse/pygit2@6edb77f5 I've added support for creating pygit2 repo's straight from pre-made git_repository's wrapped in a PyCapsule. I've then put code in a different repo/package (jmorse/pygit2-backends@e1597808) that builds the mysql custom backend, creates or opens a storage backend in a database, constructs a git_repository and wraps it in a pygit2.Repository. Some code to exercise this is in 'testscript.py' in that repo. Assumptions I've made:
Caveats:
Opinions would be most appreicated. |
@jdavid it looks like the docs haven't been updated on the website. Do you not have auto-update from master? |
No, I update them manually with every release. I'll try to do the release this weekend. |
Is there any plan to add custom backends into pygit2? What Rugged has (Rugged::Backend) looks really nice; it would be great to be able to do that in pygit2, but the entire pygit2 Repository API seems to depend on everything working on a local filesystem.
The text was updated successfully, but these errors were encountered: