public void SplitByNamespace(Key[] keys) { string first = keys[offsets[0]].ns; // Optimize for single namespace. if (IsSingleNamespace(keys, first)) { batchNamespaces = new List <BatchNamespace>(1); batchNamespaces.Add(new BatchNamespace(first, offsets, offsetsSize)); return; } // Process multiple namespaces. batchNamespaces = new List <BatchNamespace>(4); for (int i = 0; i < offsetsSize; i++) { int offset = offsets[i]; string ns = keys[offset].ns; BatchNamespace batchNamespace = FindNamespace(batchNamespaces, ns); if (batchNamespace == null) { batchNamespaces.Add(new BatchNamespace(ns, offsetsSize, offset)); } else { batchNamespace.Add(offset); } } }
public void AddKey(string ns, int offset) { BatchNamespace batchNamespace = FindNamespace(ns); if (batchNamespace == null) { batchNamespaces.Add(new BatchNamespace(ns, keyCapacity, offset)); } else { batchNamespace.Add(offset); } }