【发布时间】:2016-03-26 21:33:10
【问题描述】:
给定一个可以随时间演变其版本和分支的实体(例如文件或库/包), 寻找一种优化的数据结构,让我可以在版本中导航到实体的特定实例。
例如(有点做作的例子)给定条目,例如:
MySIMDIntristicsLib.v1~archMIPS.v1~fbsd.v1
MySIMDIntristicsLib.v1~archMIPS.v2~fbsd.v1
MySIMDIntristicsLib.v1~archX86.v1~win.v1
MySIMDIntristicsLib.v1~archX86.v2~win.v1
MySIMDIntristicsLib.v1~archX86.v2~win.v2
MySIMDIntristicsLib.v2~archX86.v1~win.v1
// get latest across all branches
get( Entity="MySIMDIntristicsLib", branch[(latest) "~"] )
returns: "MySIMDIntristicsLib.v2~archX86.v1~win.v1"
// get latest across archMips/fbsd branch
get( Entity="MySIMDIntristicsLib", branch[(latest) "archMIPS~fbsd"] )
returns: "MySIMDIntristicsLib.v1~archMIPS.v2~fbsd.v1"
// get earliest for archX86 v2 branch
get( Entity="MySIMDIntristicsLib", branch[(earliest) "archX86.v2~"] )
returns "MySIMDIntristicsLib.v1~archX86.v2~win.v1"
我怀疑已经存在类似的东西(因为包管理或源代码管理利用类似于上述访问语义)。
我一直在寻找具有良好最新/最早访问时间以及下降插入/删除速度的上述内存数据结构。
在残酷的强制方法中,我认为可以对每个可以有版本的分支使用Min Max heap 来实现上述内容。
但是,可能已经有更好的东西了。 我还检查了这些类型的东西的常用来源,Redisson——但没有看到上述数据结构的显式实现
上面的DSL是我自己构建的,可能也有一些漏洞,所以如果有更好的DSL/API来进行这种数据访问——也想学习一下。
【问题讨论】:
标签: algorithm heap guava finger-tree redisson