PartitionStorage FilePartitionsPresets

pull/4/head
Ogoun 2 years ago
parent 0b26d2e486
commit a52a2083dd

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

@ -6,16 +6,16 @@
</Description>
<Authors>ogoun</Authors>
<Company>ogoun</Company>
<AssemblyVersion>3.3.7.3</AssemblyVersion>
<PackageReleaseNotes>PartitionStorage append indexes</PackageReleaseNotes>
<AssemblyVersion>3.3.7.4</AssemblyVersion>
<PackageReleaseNotes>PartitionStorage FilePartitionsPresets</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl>
<Copyright>Copyright Ogoun 2022</Copyright>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageIconUrl></PackageIconUrl>
<RepositoryUrl>https://github.com/ogoun/Zero</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>3.3.7.3</Version>
<FileVersion>3.3.7.3</FileVersion>
<Version>3.3.7.4</Version>
<FileVersion>3.3.7.4</FileVersion>
<Platforms>AnyCPU;x64;x86</Platforms>
<PackageIcon>zero.png</PackageIcon>
<DebugType>full</DebugType>

Loading…
Cancel
Save

Powered by TurnKey Linux.