如何命名同时充当其他集合容器的B+树键/值映射集合
How to name a B+Tree key/value map collection that also acts as the container for other collections
我正在寻求一些建议,因为我目前对集合抽象的命名一无所知。这可能是一个稍微偏离主题的问题,所以如果认为是这样的话,请道歉。
我正在开发一个库,该库提供B+树存储,并支持该B+树上的几种集合接口,例如键/值映射和排序集。
一种特殊类型的集合除了允许常规映射键/值存储外,还显式支持嵌套子集合。这提供了名称空间/表空间/键空间支持的方法。
我目前对这个集合抽象的工作名称是"MultiMap"。但这感觉不对,也与STL多映射不太一致。但到目前为止,我还没能想出更好的办法。
任何关于更好的名字的建议都将不胜感激。
作为额外信息,请参阅我现在正在考虑的接口定义如下:
/** Represents a map that can be the container for nested collections.
* This allows having arbitrarily deep nesting for collections to support
* organization into (hierarchies of) separate name, key or table spaces.
* So instead of for example having a map that contains variable length
* keys such as "users/1", "users/2", etc. a nested collection "users"
* could be created that has fixed size integer keys (1, 2, ...). Note
* that storage for collections can be expensive. If not stored as a
* small embedded collection with only a few items, it will take up at
* least one physical storage page. Like in a regular map, all keys must
* be unique and items are stored in sorted key order. */
class IMultiMapCursor : public virtual IMapCursor {
public:
/** Positions the cursor at the first nested child collection, if any */
virtual bool SeekFirstNestedCollection() = 0;
/** Moves the cursor to the next nested child collection, if any */
virtual bool SeekNextNestedCollection() = 0;
/** Opens or creates a key/value map with the given @map_id under the
* map for this cursor, and returns a cursor to the nested map. */
virtual IMapCursor* OpenNestedMap(
const Slice& map_id,
const MapOptions& map_options = MapOptions::kOpenExisting) = 0;
/** Opens or creates a key/value map with the given @path_to_map,
* relative to the map for this cursor, and returns a cursor to the
* nested map. */
virtual IMapCursor* OpenNestedMap(
const CollectionPath& path_to_map,
const MapOptions& map_options = MapOptions::kOpenExisting) = 0;
/** Opens or creates a key/value multi-map with the given @map_id under
* the map for this cursor, and returns a cursor to the nested map. */
virtual IMultiMapCursor* OpenNestedMultiMap(
const Slice& map_id,
const MapOptions& map_options = MapOptions::kOpenExisting) = 0;
/** Opens or creates a key/value multi-map with the given @path_to_map,
* relative to the map for this cursor, and returns a cursor to the
* nested map. */
virtual IMultiMapCursor* OpenNestedMultiMap(
const CollectionPath& path_to_map,
const MapOptions& map_options = MapOptions::kOpenExisting) = 0;
/** Opens or creates a sorted set with the given @set_id under the map
* for this cursor, and returns a cursor to the nested set. */
virtual ISortedSetCursor* OpenNestedSortedSet(
const Slice& set_id,
const SetOptions& set_options = SetOptions::kOpenExisting) = 0;
/** Opens or creates a sorted set with the given @path_to_set,
* relative to the map for this cursor, and returns a cursor to the
* nested set. */
virtual ISortedSetCursor* OpenNestedSortedSet(
const CollectionPath& path_to_set,
const SetOptions& set_options = SetOptions::kOpenExisting) = 0;
/** Opens or creates a non-sorted set with the given @set_id under the
* map for this cursor, and returns a cursor to the nested set. */
virtual ISetCursor* OpenNestedSet(
const Slice& set_id,
const SetOptions& set_options = SetOptions::kOpenExisting) = 0;
/** Opens or creates a non-sorted set with the given @path_to_set, relative to the
* map for this cursor, and returns a cursor to the nested set. */
virtual ISetCursor* OpenNestedSet(
const CollectionPath& path_to_set,
const SetOptions& set_options = SetOptions::kOpenExisting) = 0;
/** Opens or creates a list with the given @list_id under this map, and
* returns a cursor to the nested list. */
virtual IListCursor* OpenNestedList(
const Slice& list_id,
const ListOptions& list_options = ListOptions::kOpenExisting) = 0;
/** Opens or creates a list with the given @path_to_list under this map,
* and returns a cursor to the nested list. */
virtual IListCursor* OpenNestedList(
const CollectionPath& path_to_list,
const ListOptions& list_options = ListOptions::kOpenExisting) = 0;
/** Renames the existing collection with id @current_id to @new_id.
* Requires (a) @new_id to be available. (b) the collection not to
* have an open cursor. */
virtual bool RenameNestedChildCollection(const Slice& current_id, const Slice& new_id) = 0;
};
根据问题的措辞,显而易见的NestedMap
如何?
脑海中浮现的另一个是HyperMap
。根据定义,hyper意味着超越;在上面超过;过度;高于正常,所有这些都可以用来描述映射存储的不仅仅是正常的键/值对。
TreeMap
怎么样?映射的值可以是表示键/值对的单节点树(叶),也可以是表示其他值的非单节点树。每个值都将完全满足树的定义,允许一致的命名,前提是这些结构实际上是树(即没有到兄弟的互连)。请注意,即使是没有值的键也是有效的树。
基于此集合允许的空间嵌套,HierarchicalMap、HierarchyMap或HierMap如何?
因为它映射树中的键/值:KeyTree/MapTree,CollectionTree或者由于值可以被认为是离散的:DiscreteTree/DiscreteStructureTree
会随着更多的思考而更新。
这是一个SuperMap
!
由于它是一个可以映射其他Maps/Collections的Map,因此根据您的实现,您会想到一些名称是CollectionMap
、BucketMap
,甚至可能是BucketTree
。
FlexMap
作为您的集合抽象具有灵活性。
或者AlexMap
或ALXmap
,就像你发明的那样。
- 从 AVL 树中删除指向 1 个或多个值的键
- 如何获取二叉树(集合或映射)的根
- 当用户在键盘上按住 CTRL 键时,如何在树视图中的 Qt 中实现多选?
- 使用常量键从集合中擦除元素
- AVL 树是否可以对不同节点中的键具有相同的值?
- 如何输出用作地图键的集合
- 哪个集合/数据结构可以处理键、值、值
- 映射/集合迭代器不兼容-检查映射中是否存在键
- 如何命名同时充当其他集合容器的B+树键/值映射集合
- 如何在 C++/STL 中表示键值树
- 标准::映射 标准::集合包含重复的键
- 使用集合作为映射键的机制
- 使用 int 数组作为键的二叉树(欧几里得距离)
- 具有按类型键控的变量类型的C++集合
- set::find()找不到集合中的键
- 如果有任何注释附加到键值,Boost属性树ini解析会出错
- c++如何将迭代器映射的集合作为键
- 二叉搜索树键/值对-我知道值,但不知道关键的c++
- 如何在c++中存储一个字符串集合作为键,json作为值
- 对集合的键类型使用比较函数会导致运行时错误