KVDB. Bypass keys

pull/4/head
Ogoun 1 year ago
parent be5ee404a0
commit 05a9b779ba

@ -0,0 +1,34 @@
namespace ZeroLevel.Services.Location.WSG84
{
internal class WSG84Constants
{
/// <summary>
/// Большая полуось (в метрах)
/// </summary>
public const float a = 6378137;
/// <summary>
/// Полярное сжатие 1/f
/// </summary>
public const float f = 298.257223563f;
/// <summary>
/// Угловая скорость рад/с-1
/// </summary>
public const float w = 7.292115f * .00001f;
/// <summary>
/// Геоцентрическая гравитационная постоянная (с учетом массы атмосферы Земли)
/// </summary>
public const float GM = 398600.5f;
/// <summary>
/// Второй гармонический коэффициент
/// </summary>
public const float C20 = -484.16685f * 0.000001f;
/// <summary>
/// Нормальный потенциал м2/с2
/// </summary>
public const float U0 = 62636861.074f;
/// <summary>
/// Скорость света м/с
/// </summary>
public const float c = 299792458f;
}
}

@ -35,6 +35,10 @@ namespace ZeroLevel.Services.PartitionStorage
/// </summary> /// </summary>
IAsyncEnumerable<KV<TKey, TValue>> Bypass(TMeta meta); IAsyncEnumerable<KV<TKey, TValue>> Bypass(TMeta meta);
/// <summary> /// <summary>
/// bypass all keys by meta
/// </summary>
IAsyncEnumerable<TKey> BypassKeys(TMeta meta);
/// <summary>
/// true - if key exists /// true - if key exists
/// </summary> /// </summary>
Task<bool> Exists(TMeta meta, TKey key); Task<bool> Exists(TMeta meta, TKey key);

@ -25,12 +25,15 @@ namespace ZeroLevel.Services.PartitionStorage
/// Search in a partition for a specified keys /// Search in a partition for a specified keys
/// </summary> /// </summary>
IAsyncEnumerable<KV<TKey, TValue>> Find(IEnumerable<TKey> keys); IAsyncEnumerable<KV<TKey, TValue>> Find(IEnumerable<TKey> keys);
/// <summary> /// <summary>
/// Iterating over all recorded data /// Iterating over all recorded data
/// </summary> /// </summary>
IAsyncEnumerable<KV<TKey, TValue>> Iterate(); IAsyncEnumerable<KV<TKey, TValue>> Iterate();
/// <summary> /// <summary>
/// Iterating over all recorded data and return keys only
/// </summary>
IAsyncEnumerable<TKey> IterateKeys();
/// <summary>
/// Iterating over all recorded data of the file with the specified key /// Iterating over all recorded data of the file with the specified key
/// </summary> /// </summary>
IAsyncEnumerable<KV<TKey, TValue>> IterateKeyBacket(TKey key); IAsyncEnumerable<KV<TKey, TValue>> IterateKeyBacket(TKey key);

@ -134,6 +134,38 @@ namespace ZeroLevel.Services.PartitionStorage
} }
} }
} }
public async IAsyncEnumerable<TKey> IterateKeys()
{
if (Directory.Exists(_catalog))
{
var files = Directory.GetFiles(_catalog);
if (files != null && files.Length > 0)
{
foreach (var file in files)
{
var accessor = PhisicalFileAccessorCachee.GetDataAccessor(file, 0);
if (accessor != null)
{
using (var reader = new MemoryStreamReader(accessor))
{
while (reader.EOS == false)
{
var kv = await Serializer.KeyDeserializer.Invoke(reader);
if (kv.Success == false) break;
var vv = await Serializer.ValueDeserializer.Invoke(reader);
if (vv.Success == false) break;
yield return kv.Value;
}
}
}
}
}
}
}
public async IAsyncEnumerable<KV<TKey, TValue>> IterateKeyBacket(TKey key) public async IAsyncEnumerable<KV<TKey, TValue>> IterateKeyBacket(TKey key)
{ {
var fileName = _options.GetFileName(key, _info); var fileName = _options.GetFileName(key, _info);

@ -113,6 +113,21 @@ namespace ZeroLevel.Services.PartitionStorage
} }
} }
public async IAsyncEnumerable<TKey> BypassKeys(TMeta meta)
{
var accessor = CreateAccessor(meta);
if (accessor != null)
{
using (accessor)
{
await foreach (var kv in accessor.IterateKeys())
{
yield return kv;
}
}
}
}
public async Task<bool> Exists(TMeta meta, TKey key) public async Task<bool> Exists(TMeta meta, TKey key)
{ {
var accessor = CreateAccessor(meta); var accessor = CreateAccessor(meta);

@ -6,16 +6,16 @@
</Description> </Description>
<Authors>ogoun</Authors> <Authors>ogoun</Authors>
<Company>ogoun</Company> <Company>ogoun</Company>
<AssemblyVersion>3.4.0.7</AssemblyVersion> <AssemblyVersion>3.4.0.8</AssemblyVersion>
<PackageReleaseNotes>KVDB fixes</PackageReleaseNotes> <PackageReleaseNotes></PackageReleaseNotes>
<PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl> <PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl>
<Copyright>Copyright Ogoun 2023</Copyright> <Copyright>Copyright Ogoun 2023</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.4.0.7</Version> <Version>3.4.0.8</Version>
<FileVersion>3.4.0.7</FileVersion> <FileVersion>3.4.0.8</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.