style(grid-db): address code review — rename constant, improve BTree comment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
524abb4c97
commit
0060a33d69
|
|
@ -16,7 +16,7 @@
|
|||
* 命名空间名称规则:非空字符串,仅允许字母、数字、连字符、下划线。
|
||||
*/
|
||||
|
||||
const NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
||||
const NAMESPACE_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
||||
|
||||
class NamespaceManager {
|
||||
/**
|
||||
|
|
@ -128,7 +128,7 @@ class NamespaceManager {
|
|||
if (!name || typeof name !== 'string') {
|
||||
throw new Error('NamespaceManager: 命名空间名称必须是非空字符串');
|
||||
}
|
||||
if (!NAME_PATTERN.test(name)) {
|
||||
if (!NAMESPACE_NAME_PATTERN.test(name)) {
|
||||
throw new Error(`NamespaceManager: 命名空间名称只能包含字母、数字、连字符和下划线,收到: '${name}'`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class BTree {
|
|||
const newNode = new BTreeNode(child.isLeaf);
|
||||
|
||||
if (child.isLeaf) {
|
||||
// 叶子节点分裂:右半部分复制到新节点,提升中间键的副本
|
||||
// 叶子节点分裂:splice 从 mid 处截断 child,返回值作为 newNode 内容
|
||||
newNode.keys = child.keys.splice(mid);
|
||||
newNode.children = child.children.splice(mid);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue