使用版本控制系统作为数据后端 [英] Using a version control system as a data backend

查看:35
本文介绍了使用版本控制系统作为数据后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参与了一个项目,其中包括存储对大型分层文档(HTML 格式文本)的编辑和更改.我们希望包括文本更改和结构更改的版本控制.

I'm involved in a project that, among other things, involves storing edits and changes to a large hierarchical document (HTML-formatted text). We want to include versioning of textual changes and of structural changes.

目前我们在关系数据库中维护文档部分的树,但是当我们开始研究如何管理结构更改的版本时,很明显我们面临着不得不编写大量功能的危险版本控制系统提供.

Currently we're maintaining the tree of document sections in a relational database, but as we start working on how to manage versioning of structural changes, it's clear that we're in danger of having to write a lot of the functionality that a version control system provides.

我们不想重新发明轮子.我们是否有可能使用现有的版本控制系统作为数据存储,至少对于文档本身而言?据推测,我们可以通过将新版本写入文件系统,并将该目录保持在版本控制之下(并以编程方式进行提交等)来实现,但如果我们可以通过代码直接与存储库交互会更好.

We don't want to reinvent the wheel. Is it possible that we could use an existing version control system as the data store, at least for the document itself? Presumably we could do so by writing out new versions to the filesystem, and keeping that directory under version control (and programmatically doing commits and so forth) but it would be better if we could directly interact with the repository via code.

我们最熟悉的 VCS 是 Subversion,但我对 Subversion 如何表示目录结构的变化并不感到兴奋——如果我们能看到一个特定的修订版包括从第 2 章中移动一个部分,那就太好了到第 6 章,而不仅仅是看到树的新版本.这听起来更像是 Mercurial 这样的系统处理结构更改的方式.

The VCS that we are most familiar with is Subversion, but I'm not thrilled with how Subversion represents changes to the directory structure -- it would be nice if we could see that a particular revision included moving a section from Chapter 2 to Chapter 6, rather than just seeing a new version of the tree. This sounds more like the way a system like Mercurial handles changes to the structure.

有什么建议吗?VCS 是否有公共 API 等等?如果重要的话,该项目使用 Java(使用 Spring).

Any advice? Do VCS's have public APIs and so forth? The project is in Java (with Spring) if it matters.

推荐答案

也许您可以使用符合 JCR (JSR-170) 的存储库,例如 Jackrabbit 代替.对我来说,您所描述的正是 JCR 的用途.看看这篇文章.

Maybe you could use a JCR (JSR-170) compliant repository like Jackrabbit instead. To me, what you're describing is exactly what JCR is for. Have a look at this article.

这篇关于使用版本控制系统作为数据后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆