Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Using InMemoryRepository

Thanks for the input. 
Yes. That's my end goal using a Key-value store like elastic search or cassandra to store objects and refs.
-M

On Mon, Mar 30, 2015 at 1:28 AM, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
You should do timing tests first of all before exploring other storage types. JGit performs a lot of internal caching for pack files on disk so check assumptions before testing. 

However the in memory version will completely lose state when the process dies - if you're going to maintain a query then it would be better to build external indexes and use those in eg an elastic search instance. 

Alex 

Sent from my iPhat 6

On 29 Mar 2015, at 16:22, Monmohan Singh <monmohan@xxxxxxxxx> wrote:

My goal is not necessarily to use InMemoryRepository but I am exploring JGit in an attempt to solve below problem
  1. I have a data store which may be disk or something else. 
  2. Need to provide branching and other revision management functionality on top of this data. 
  3. I am using JGit to manage "pointers" to this data. Now, There is a need to support user queries which can be answered by looking/walking/inspectingthe git objects and refs. In order to support those queries, it might be better to persist the objects and refs in a different KV store than disk

-M

On Sun, Mar 29, 2015 at 10:30 PM, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
Not all repositories support a work tree - in fact, at the moment the FileRepository is the only one that does as far as I know. You’d have to write custom implementations to achieve the effect you want.

You should be able to use the RevWalk and TreeWalk to process a repository without needing a work tree though. That’s how the UI for things like the Google source page is generated:


What are you trying to do and why do you want to use InMemoryRepository to do it?

Alex


On 29 Mar 2015, at 13:22, Monmohan Singh <monmohan@xxxxxxxxx> wrote:

Thanks Alex for taking time to answer these.
I guess my understanding of InMemoryRepository wasn't right. 
What I was trying to get to is to have a repository with a work tree on disk but git objects and refs stored differently, in-memory or some other store. 

Also, will the Rev and Tree Walks work fine on InMemoryRepository?

-M
 


On Sun, Mar 29, 2015 at 4:59 PM, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:


Sent from my iPhat 6

On 29 Mar 2015, at 00:58, Monmohan Singh <monmohan@xxxxxxxxx> wrote:

So for adding and commiting a file to inmemrepo, one would have 
1) Insert the object

Yes. 

2) update the index

There is no index, since there is no working directory in an in memory layout.

3) create the tree and commit

Yes

4) update the refs

Yes

Is that correct? Or is there an easier way to go about this?

You can have a look at the tests Mathias mentioned but the above steps are the same. 

Any particular reason that setting a work tree is not supported for such a repository?

The clue is in the name - in memory != on disk. 


Regards
Monmohan


 

On Sat, Mar 28, 2015 at 8:27 PM, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
The porcelain commands assume a File basis in some cases, particularly when it comes to the working tree. You can perform inserts into an in-memory repository if you do the work yourself, but the porcelain commands do not work in that way.

Alex

On 28 Mar 2015, at 11:12, Monmohan Singh <monmohan@xxxxxxxxx> wrote:

Thanks for the response.
Even if that was the case, shouldn't it support the case where a file can be added and committed to the repos (which in turn would create object, tree, commit refs etc. in memory)? 

Regards
Monmohan

On Sat, Mar 28, 2015 at 5:56 PM, Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Sat, Mar 28, 2015 at 10:32 AM, Monmohan Singh <monmohan@xxxxxxxxx> wrote:
Hi,
When using FileRepository, I see we can use JGit porcelain equivalent of Git commands like add file, commit etc. 
But there doesn't seem a way to set a WorkTree for InMemoryRepository. My understanding was that this (in-memory) storage is equivalent of .git folder in case of FileRepository .  What is the way to add files to such a repo, using ObjectInserter?

Thanks in advance for the help :) 

AFAIK InMemoryRepository is only used by tests. See DfsInserterTest for some examples.

-Matthias 

_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jgit-dev







Back to the top