diff --git a/ZeroLevel/Services/Location/WSG84/WSG84Constants.cs b/ZeroLevel/Services/Location/WSG84/WSG84Constants.cs new file mode 100644 index 0000000..bd74e5d --- /dev/null +++ b/ZeroLevel/Services/Location/WSG84/WSG84Constants.cs @@ -0,0 +1,34 @@ +namespace ZeroLevel.Services.Location.WSG84 +{ + internal class WSG84Constants + { + /// + /// Большая полуось (в метрах) + /// + public const float a = 6378137; + /// + /// Полярное сжатие 1/f + /// + public const float f = 298.257223563f; + /// + /// Угловая скорость рад/с-1 + /// + public const float w = 7.292115f * .00001f; + /// + /// Геоцентрическая гравитационная постоянная (с учетом массы атмосферы Земли) + /// + public const float GM = 398600.5f; + /// + /// Второй гармонический коэффициент + /// + public const float C20 = -484.16685f * 0.000001f; + /// + /// Нормальный потенциал м2/с2 + /// + public const float U0 = 62636861.074f; + /// + /// Скорость света м/с + /// + public const float c = 299792458f; + } +} diff --git a/ZeroLevel/Services/PartitionStorage/Interfaces/IStore.cs b/ZeroLevel/Services/PartitionStorage/Interfaces/IStore.cs index c25fbee..4696104 100644 --- a/ZeroLevel/Services/PartitionStorage/Interfaces/IStore.cs +++ b/ZeroLevel/Services/PartitionStorage/Interfaces/IStore.cs @@ -35,6 +35,10 @@ namespace ZeroLevel.Services.PartitionStorage /// IAsyncEnumerable> Bypass(TMeta meta); /// + /// bypass all keys by meta + /// + IAsyncEnumerable BypassKeys(TMeta meta); + /// /// true - if key exists /// Task Exists(TMeta meta, TKey key); diff --git a/ZeroLevel/Services/PartitionStorage/Interfaces/IStorePartitionAccessor.cs b/ZeroLevel/Services/PartitionStorage/Interfaces/IStorePartitionAccessor.cs index 6d0574a..bd25465 100644 --- a/ZeroLevel/Services/PartitionStorage/Interfaces/IStorePartitionAccessor.cs +++ b/ZeroLevel/Services/PartitionStorage/Interfaces/IStorePartitionAccessor.cs @@ -25,12 +25,15 @@ namespace ZeroLevel.Services.PartitionStorage /// Search in a partition for a specified keys /// IAsyncEnumerable> Find(IEnumerable keys); - /// /// Iterating over all recorded data /// IAsyncEnumerable> Iterate(); /// + /// Iterating over all recorded data and return keys only + /// + IAsyncEnumerable IterateKeys(); + /// /// Iterating over all recorded data of the file with the specified key /// IAsyncEnumerable> IterateKeyBacket(TKey key); diff --git a/ZeroLevel/Services/PartitionStorage/Partition/StorePartitionAccessor.cs b/ZeroLevel/Services/PartitionStorage/Partition/StorePartitionAccessor.cs index 1a8b49b..0b3a251 100644 --- a/ZeroLevel/Services/PartitionStorage/Partition/StorePartitionAccessor.cs +++ b/ZeroLevel/Services/PartitionStorage/Partition/StorePartitionAccessor.cs @@ -134,6 +134,38 @@ namespace ZeroLevel.Services.PartitionStorage } } } + + public async IAsyncEnumerable 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> IterateKeyBacket(TKey key) { var fileName = _options.GetFileName(key, _info); diff --git a/ZeroLevel/Services/PartitionStorage/Store.cs b/ZeroLevel/Services/PartitionStorage/Store.cs index 3a8ba19..19c4487 100644 --- a/ZeroLevel/Services/PartitionStorage/Store.cs +++ b/ZeroLevel/Services/PartitionStorage/Store.cs @@ -113,6 +113,21 @@ namespace ZeroLevel.Services.PartitionStorage } } + public async IAsyncEnumerable 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 Exists(TMeta meta, TKey key) { var accessor = CreateAccessor(meta); diff --git a/ZeroLevel/ZeroLevel.csproj b/ZeroLevel/ZeroLevel.csproj index 010c872..fc60328 100644 --- a/ZeroLevel/ZeroLevel.csproj +++ b/ZeroLevel/ZeroLevel.csproj @@ -6,16 +6,16 @@ ogoun ogoun - 3.4.0.7 - KVDB fixes + 3.4.0.8 + https://github.com/ogoun/Zero/wiki Copyright Ogoun 2023 https://github.com/ogoun/Zero git - 3.4.0.7 - 3.4.0.7 + 3.4.0.8 + 3.4.0.8 AnyCPU;x64;x86 zero.png full