git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [OT] Using object store for other (java) applications
@ 2009-05-31 21:16 Johannes Schneider
  2009-06-01 14:34 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Schneider @ 2009-05-31 21:16 UTC (permalink / raw
  To: Git Mailing List

Hi,

what do you think: Is it possible to use the object store (hash based 
and optimized storage) within another Java application?
Maybe the JGIT implementation contains anything that could be used?
I need to store many different images within a repository, so I would 
like to try to reuse the Git storage.

Could anyone give me a hint whether it is possible (and a good idea) and 
which classes I should take a look at first.


Thanks,

Johannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [OT] Using object store for other (java) applications
  2009-05-31 21:16 [OT] Using object store for other (java) applications Johannes Schneider
@ 2009-06-01 14:34 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-06-01 14:34 UTC (permalink / raw
  To: Johannes Schneider; +Cc: Git Mailing List

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-01 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-31 21:16 [OT] Using object store for other (java) applications Johannes Schneider
2009-06-01 14:34 ` Shawn O. Pearce

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).