Sfoglia il codice sorgente

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 anni fa
parent
commit
095cb7a818
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  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")
 )
 
+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.
 // This is used to retrieve image and container IDs by more convenient shorthand prefixes.
 type TruncIndex struct {