{"thread":{"id":"19621","subject":"[OT] Using object store for other (java) applications","startedAt":"2009-05-31T21:16:10Z","lastAt":"2009-06-01T14:34:48Z","messageCount":2,"participants":["Johannes Schneider","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"115166","messageId":"4A22F39A.9010900@cedarsoft.com","threadId":"19621","inReplyTo":null,"subject":"[OT] Using object store for other (java) applications","fromName":"Johannes Schneider","fromEmail":"mailings@cedarsoft.com","sentAt":"2009-05-31T21:16:10Z","receivedAt":"2009-05-31T21:16:10Z","isPatch":false,"sender":{"key":"mailings@cedarsoft.com","avatar":null},"body":"Hi,\n\nwhat do you think: Is it possible to use the object store (hash based \nand optimized storage) within another Java application?\nMaybe the JGIT implementation contains anything that could be used?\nI need to store many different images within a repository, so I would \nlike to try to reuse the Git storage.\n\nCould anyone give me a hint whether it is possible (and a good idea) and \nwhich classes I should take a look at first.\n\n\nThanks,\n\nJohannes\n"},{"id":"115205","messageId":"20090601143448.GF30527@spearce.org","threadId":"19621","inReplyTo":"4A22F39A.9010900@cedarsoft.com","subject":"Re: [OT] Using object store for other (java) applications","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-06-01T14:34:48Z","receivedAt":"2009-06-01T14:34:48Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schneider <mailings@cedarsoft.com> wrote:\n> what do you think: Is it possible to use the object store (hash based  \n> and optimized storage) within another Java application?\n\nSure.  So long as your storage model fits well onto the Git object\nstore.  If all you want is a content keyed lookup, Git is possibly\noverkill, but you could use it.\n\n> Maybe the JGIT implementation contains anything that could be used?\n\nYes.  Use the Repository class to access the local repository, use\nan ObjectWriter to store blobs and compute their names.  Use the\nopenBlob method on Repository to obtain an ObjectLoader for a blob\ncontent you previously had stored.\n\nObjectWriter stores everything as loose files.  Eventually, you may\nwant to pack them.  Use a PackWriter.  JGit lacks `git prune-packed`\nsupport, but this probably could be coded up in Java and contributed\nto JGit with fairly little effort.\n\nIf you store data, you probably should connect the blobs into a\ntree and into commits, so that the blobs are considered reachable\nand can't be cleaned out by `git gc`.\n\nBut, if you only ever use your own application against the\nrepository, and use JGit to manage it, you would never be invoking\nGC and thus would never need to worry about it.\n\n-- \nShawn.\n"}]}