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

Loading…
Cancel
Save

Powered by TurnKey Linux.