瀏覽代碼

Increase patricia.MaxPrefixPerNode

It allows to avoid redundant prefix splits
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
LK4D4 11 年之前
父節點
當前提交
095cb7a818
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      pkg/truncindex/truncindex.go

+ 6 - 0
pkg/truncindex/truncindex.go

@@ -13,6 +13,12 @@ var (
 	ErrNoID = errors.New("prefix can't be empty")
 	ErrNoID = errors.New("prefix can't be empty")
 )
 )
 
 
+func init() {
+	// Change patricia max prefix per node length,
+	// because our len(ID) always 64
+	patricia.MaxPrefixPerNode = 64
+}
+
 // TruncIndex allows the retrieval of string identifiers by any of their unique prefixes.
 // TruncIndex allows the retrieval of string identifiers by any of their unique prefixes.
 // This is used to retrieve image and container IDs by more convenient shorthand prefixes.
 // This is used to retrieve image and container IDs by more convenient shorthand prefixes.
 type TruncIndex struct {
 type TruncIndex struct {