using System; using ZeroLevel.Services.HashFunctions; namespace ZeroLevel.Services.PartitionStorage { public static class FilePartitionsPresets { public static StoreFilePartition StringDivideIntoParts(string name, int parts) { Func extractor = (key, _) => ((int)Math.Abs(StringHash.DotNetFullHash(key) % parts)).ToString(); return new StoreFilePartition(name, extractor); } public static StoreFilePartition ULongDivideIntoParts(string name, int parts) { Func extractor = (key, _) => (key % (ulong)parts).ToString(); return new StoreFilePartition(name, extractor); } public static StoreFilePartition LongDivideIntoParts(string name, int parts) { Func extractor = (key, _) => (key % (long)parts).ToString(); return new StoreFilePartition(name, extractor); } public static StoreFilePartition UIntDivideIntoParts(string name, int parts) { Func extractor = (key, _) => (key % (uint)parts).ToString(); return new StoreFilePartition(name, extractor); } public static StoreFilePartition IntDivideIntoParts(string name, int parts) { Func extractor = (key, _) => (key % parts).ToString(); return new StoreFilePartition(name, extractor); } } }