git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [OT] Using object store for other (java) applications

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 1, 2009, 14:34 UTC
Message-ID
<20090601143448.GF30527@spearce.org>
In-Reply-To
<4A22F39A.9010900@cedarsoft.com>
Johannes Schneider <mailings@cedarsoft.com> wrote:
> what do you think: Is it possible to use the object store (hash based  
> and optimized storage) within another Java application?

Sure. So long as your storage model fits well onto the Git object store. If all you want is a content keyed lookup, Git is possibly overkill, but you could use it.

> Maybe the JGIT implementation contains anything that could be used?

Yes. Use the Repository class to access the local repository, use an ObjectWriter to store blobs and compute their names. Use the openBlob method on Repository to obtain an ObjectLoader for a blob content you previously had stored.

ObjectWriter stores everything as loose files. Eventually, you may want to pack them. Use a PackWriter. JGit lacks `git prune-packed` support, but this probably could be coded up in Java and contributed to JGit with fairly little effort.

If you store data, you probably should connect the blobs into a tree and into commits, so that the blobs are considered reachable and can't be cleaned out by `git gc`.

But, if you only ever use your own application against the repository, and use JGit to manage it, you would never be invoking GC and thus would never need to worry about it.

-- 
Shawn.
Previous: Johannes Schneider
Message 2 of 2 in “[OT] Using object store for other (java) applications”
  1. Johannes SchneiderMay 31, 2009
  2. Shawn O. PearceJun 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.