Proposal: Extension Point for Pluggable Repository Storage Backends in EGit** #145
carstenartur
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I would like to propose the addition of an extension point in EGit that allows third-party plugins to contribute alternative JGit
Repositoryimplementations — specifically to enable database-backed storage layers that run alongside EGit's defaultFileRepository.Background & Motivation
I maintain the Eclipse Sandbox project, which includes two modules relevant to this discussion:
sandbox-jgit-storage-hibernate— A complete JGit storage backend that stores Git objects, refs, pack data, and reflogs in a relational database via Hibernate ORM. The implementation (HibernateRepository) extendsDfsRepositoryand providesHibernateObjDatabase,HibernateRefDatabase, andHibernateReflogWriter. It also offers aGitDatabaseQueryServicewith full-text search (via Hibernate Search / Lucene) for commit messages, file paths, Java type hierarchies, annotations, symbols, and even semantic/hybrid vector search.sandbox_extra_search— An Eclipse plugin that provides advanced search views (commit search, type history, commit analytics) intended to work within the Eclipse IDE alongside EGit.The goal is to install
sandbox_extra_searchas a companion plugin to EGit so that whenever EGit performs Git operations (clone, fetch, commit, push), the data is simultaneously indexed into the database layer. This would unlock powerful queries that are impossible with filesystem-based Git storage alone — for example:The Problem: No Way to Plug In
Currently, EGit hardcodes
FileRepositoryas the only repository type:RepositoryCache.open()always producesFileRepositoryinstancesorg.eclipse.egit.core.repositoryProvider) that would allow a plugin to contribute an alternativeRepositoryimplementation or to wrap/decorate the repository lifecycleHibernateRepositoryextendsDfsRepository, which is a completely different class hierarchy fromFileRepository— they share theRepositorybase class but diverge below thatThis means my plugin cannot transparently redirect or mirror EGit's data layer to the database. The only workaround I have found so far is a "parallel index" approach:
While this works for read-only indexing (listening to EGit events and independently walking the Git history), it has significant limitations:
commitorfetch).FileRepository.Technical Proposal
I propose an extension point mechanism that would allow plugins to participate in the repository lifecycle. There are several possible approaches, ranging from minimal to comprehensive:
Option A: Repository Lifecycle Listener (Minimal)
An extension point like
org.eclipse.egit.core.repositoryLifecycleListenerthat is notified whenever EGit opens, connects, or disconnects a repository:This would allow companion plugins to set up their own data structures (database indexes, caches) in sync with EGit's repository lifecycle, without needing to discover repositories independently.
Option B: Repository Decorator / Wrapper (Medium)
An extension point that allows wrapping the
Repositoryobject returned byRepositoryCache:This would allow a plugin to intercept reads/writes by wrapping the
ObjectDatabase,RefDatabase, etc. with decorating implementations that mirror data to a secondary store.Option C: Pluggable Storage Backend via RepositoryBuilder (Comprehensive)
An extension point that contributes a
RepositoryBuilderfactory, allowing EGit to use alternativeRepositoryimplementations entirely:This would allow a plugin to say "for this repository, use
HibernateRepositoryinstead ofFileRepository" — enabling a complete storage backend swap.What I Am NOT Proposing
DfsRepositoryabstraction)FileRepositoryremaining the default when no extensions are contributedPrior Art
DfsRepository/DfsObjDatabaseabstraction — Gerrit's in-memory repositories use this. EGit simply does not expose this flexibility.I have a working JGit DFS backend (
HibernateRepositorywith full ObjDatabase, RefDatabase, ReflogReader/Writer implementations) and an Eclipse plugin that already integrates with EGit at theIResourceChangeListenerlevel.I would appreciate feedback on:
RepositoryCacheassumptions, thread safety, performance)Thank you for your time!
— Carsten Hammer
sandbox project
Beta Was this translation helpful? Give feedback.
All reactions