diff --git a/ZeroLevel/Services/PartitionStorage/FilePartitionsPresets.cs b/ZeroLevel/Services/PartitionStorage/FilePartitionsPresets.cs new file mode 100644 index 0000000..55f425d --- /dev/null +++ b/ZeroLevel/Services/PartitionStorage/FilePartitionsPresets.cs @@ -0,0 +1,38 @@ +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); + } + } +} \ No newline at end of file diff --git a/ZeroLevel/ZeroLevel.csproj b/ZeroLevel/ZeroLevel.csproj index 815787d..12c9293 100644 --- a/ZeroLevel/ZeroLevel.csproj +++ b/ZeroLevel/ZeroLevel.csproj @@ -6,16 +6,16 @@ ogoun ogoun - 3.3.7.3 - PartitionStorage append indexes + 3.3.7.4 + PartitionStorage FilePartitionsPresets https://github.com/ogoun/Zero/wiki Copyright Ogoun 2022 https://github.com/ogoun/Zero git - 3.3.7.3 - 3.3.7.3 + 3.3.7.4 + 3.3.7.4 AnyCPU;x64;x86 zero.png full