Skip to content

Commit 1f97ee5

Browse files
committed
Fix: lowercase predefined collection names
1 parent 0b52d6d commit 1f97ee5

File tree

2 files changed

+42
-48
lines changed

2 files changed

+42
-48
lines changed

source/jaindb/jaindb.cs

+21-21
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ public static bool WriteHash(string Hash, string Data, string Collection)
299299
}
300300
break;
301301

302-
case "chain":
302+
case "_chain":
303303
var jObj3 = JObject.Parse(Data);
304304
JSort(jObj3);
305305

306306
cache3.StringSetAsync(Hash, jObj3.ToString(Newtonsoft.Json.Formatting.None));
307307
break;
308308

309-
case "assets":
309+
case "_assets":
310310
var jObj4 = JObject.Parse(Data);
311311
JSort(jObj4);
312312

@@ -704,7 +704,7 @@ public static string ReadHash(string Hash, string Collection)
704704
public static Blockchain GetChain(string DeviceID)
705705
{
706706
Blockchain oChain;
707-
string sData = ReadHash(DeviceID, "_Chain");
707+
string sData = ReadHash(DeviceID, "_chain");
708708
if (string.IsNullOrEmpty(sData))
709709
{
710710
oChain = new Blockchain("", "root", 0);
@@ -890,9 +890,9 @@ public static string UploadFull(string JSON, string DeviceID, string blockType =
890890
}
891891

892892
if (!UseCosmosDB)
893-
WriteHashAsync(DeviceID, JsonConvert.SerializeObject(oChain), "_Chain").ConfigureAwait(false);
893+
WriteHashAsync(DeviceID, JsonConvert.SerializeObject(oChain), "_chain").ConfigureAwait(false);
894894
else
895-
WriteHashAsync(DeviceID, JsonConvert.SerializeObject(oChain), "_Chain").Wait();
895+
WriteHashAsync(DeviceID, JsonConvert.SerializeObject(oChain), "_chain").Wait();
896896

897897

898898
//Add missing attributes
@@ -920,9 +920,9 @@ public static string UploadFull(string JSON, string DeviceID, string blockType =
920920
if (!UseCosmosDB)
921921
{
922922
if (blockType == BlockType)
923-
WriteHashAsync(DeviceID, jTemp.ToString(Formatting.None), "_Full").ConfigureAwait(false);
923+
WriteHashAsync(DeviceID, jTemp.ToString(Formatting.None), "_full").ConfigureAwait(false);
924924
else
925-
WriteHashAsync(DeviceID + "_" + blockType, jTemp.ToString(Formatting.None), "_Full").ConfigureAwait(false);
925+
WriteHashAsync(DeviceID + "_" + blockType, jTemp.ToString(Formatting.None), "_full").ConfigureAwait(false);
926926
}
927927
else
928928
{
@@ -940,9 +940,9 @@ public static string UploadFull(string JSON, string DeviceID, string blockType =
940940
if (!UseCosmosDB)
941941
{
942942
if (blockType == BlockType)
943-
WriteHashAsync(sResult, oStatic.ToString(Newtonsoft.Json.Formatting.None), "_Assets").ConfigureAwait(false);
943+
WriteHashAsync(sResult, oStatic.ToString(Newtonsoft.Json.Formatting.None), "_assets").ConfigureAwait(false);
944944
else
945-
WriteHashAsync(sResult + "_" + blockType, oStatic.ToString(Newtonsoft.Json.Formatting.None), "_Assets").ConfigureAwait(false);
945+
WriteHashAsync(sResult + "_" + blockType, oStatic.ToString(Newtonsoft.Json.Formatting.None), "_assets").ConfigureAwait(false);
946946
}
947947
else
948948
{
@@ -976,9 +976,9 @@ public static JObject GetFull(string DeviceID, int Index = -1, string blockType
976976
{
977977
string sFull = "";
978978
if (blockType == BlockType)
979-
sFull = ReadHash(DeviceID, "_Full");
979+
sFull = ReadHash(DeviceID, "_full");
980980
else
981-
sFull = ReadHash(DeviceID + "_" + blockType, "_Full");
981+
sFull = ReadHash(DeviceID + "_" + blockType, "_full");
982982

983983
if (!string.IsNullOrEmpty(sFull))
984984
{
@@ -990,9 +990,9 @@ public static JObject GetFull(string DeviceID, int Index = -1, string blockType
990990

991991
string sData = "";
992992
if (blockType == BlockType)
993-
sData = ReadHash(oRaw["_hash"].ToString(), "_Assets");
993+
sData = ReadHash(oRaw["_hash"].ToString(), "_assets");
994994
else
995-
sData = ReadHash(oRaw["_hash"].ToString() + "_" + blockType, "_Assets");
995+
sData = ReadHash(oRaw["_hash"].ToString() + "_" + blockType, "_assets");
996996

997997
if (!UseCosmosDB)
998998
{
@@ -1227,7 +1227,7 @@ public static JObject GetHistory(string DeviceID, string blockType = "")
12271227
try
12281228
{
12291229

1230-
string sChain = ReadHash(DeviceID, "_Chain");
1230+
string sChain = ReadHash(DeviceID, "_chain");
12311231
var oChain = JsonConvert.DeserializeObject<Blockchain>(sChain);
12321232
foreach (block oBlock in oChain.Chain.Where(t => t.blocktype == blockType))
12331233
{
@@ -1276,7 +1276,7 @@ public static JArray GetJHistory(string DeviceID, string blockType = "")
12761276

12771277
try
12781278
{
1279-
string sChain = ReadHash(DeviceID, "_Chain");
1279+
string sChain = ReadHash(DeviceID, "_chain");
12801280
var oChain = JsonConvert.DeserializeObject<Blockchain>(sChain);
12811281
foreach (block oBlock in oChain.Chain.Where(t => t.blocktype == blockType))
12821282
{
@@ -1788,7 +1788,7 @@ public static JArray QueryAll(string paths, string select, string exclude)
17881788
{
17891789
bool foundData = false;
17901790

1791-
JObject jObj = GetRaw(ReadHash(oObj, "assets"), paths);
1791+
JObject jObj = GetRaw(ReadHash(oObj, "_assets"), paths);
17921792

17931793
if (paths.Contains("*") || paths.Contains(".."))
17941794
{
@@ -2090,7 +2090,7 @@ public static JArray GetChanges(TimeSpan age, int changeType = -1)
20902090
{
20912091
Change oRes = new Change();
20922092
oRes.id = sID;
2093-
var jObj = JObject.Parse(ReadHash(sID, "_Chain"));
2093+
var jObj = JObject.Parse(ReadHash(sID, "_chain"));
20942094
oRes.lastChange = new DateTime(jObj["Chain"].Last["timestamp"].Value<long>());
20952095
if (DateTime.Now.Subtract(oRes.lastChange) > age)
20962096
{
@@ -2339,7 +2339,7 @@ public static bool Export(string URL, string RemoveObjects)
23392339
try
23402340
{
23412341

2342-
var jObj = JObject.Parse(ReadHash(sID, "chain"));
2342+
var jObj = JObject.Parse(ReadHash(sID, "_chain"));
23432343
//var jObj = JObject.Parse(cache3.StringGet(sID));
23442344

23452345
foreach (var sBlock in jObj.SelectTokens("Chain[*].data"))
@@ -2349,7 +2349,7 @@ public static bool Export(string URL, string RemoveObjects)
23492349
string sBlockID = sBlock.Value<string>();
23502350
if (!string.IsNullOrEmpty(sBlockID))
23512351
{
2352-
var jBlock = GetRaw(ReadHash(sBlockID, "assets"));
2352+
var jBlock = GetRaw(ReadHash(sBlockID, "_assets"));
23532353
//var jBlock = GetRaw(cache4.StringGet(sBlockID));
23542354
jBlock.Remove("#id"); //old Version of jainDB
23552355
//jBlock.Remove("_date");
@@ -2402,15 +2402,15 @@ public static bool Export(string URL, string RemoveObjects)
24022402
{
24032403
try
24042404
{
2405-
var jObj = JObject.Parse(ReadHash(sID, "_Chain"));
2405+
var jObj = JObject.Parse(ReadHash(sID, "_chain"));
24062406
foreach (var sBlock in jObj.SelectTokens("Chain[*].data"))
24072407
{
24082408
try
24092409
{
24102410
string sBlockID = sBlock.Value<string>();
24112411
if (!string.IsNullOrEmpty(sBlockID))
24122412
{
2413-
var jBlock = GetRaw(ReadHash(sBlockID, "_Assets"));
2413+
var jBlock = GetRaw(ReadHash(sBlockID, "_assets"));
24142414
jBlock.Remove("#id"); //old Version of jainDB
24152415
//jBlock.Remove("_date");
24162416
jBlock.Remove("_index");

source/jaindb/jaindb.csproj

+21-27
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<PackageProjectUrl>https://github.com/rzander/jaindb</PackageProjectUrl>
1313
<RepositoryUrl>https://github.com/rzander/jaindb</RepositoryUrl>
1414
<PackageTags>blockchain json</PackageTags>
15-
<Version>1.0.1</Version>
16-
<AssemblyVersion>1.0.1.81</AssemblyVersion>
17-
<FileVersion>1.0.1.81</FileVersion>
15+
<Version>1.0.2</Version>
16+
<AssemblyVersion>1.0.1.82</AssemblyVersion>
17+
<FileVersion>1.0.1.82</FileVersion>
1818
<StartupObject></StartupObject>
1919
<UserSecretsId>fcfd6c0a-e53c-46cb-8a9d-b786c0579861</UserSecretsId>
2020
<ApplicationIcon>JainDB_Logo.ico</ApplicationIcon>
@@ -28,12 +28,6 @@
2828

2929
<ItemGroup>
3030
<Content Remove="wwwroot\bin\bin.zip" />
31-
<Content Remove="wwwroot\bin\redis-benchmark" />
32-
<Content Remove="wwwroot\bin\redis-check-aof" />
33-
<Content Remove="wwwroot\bin\redis-check-rdb" />
34-
<Content Remove="wwwroot\bin\redis-cli" />
35-
<Content Remove="wwwroot\bin\redis-sentinel" />
36-
<Content Remove="wwwroot\bin\redis-server" />
3731
<Content Remove="wwwroot\redis.sh" />
3832
</ItemGroup>
3933

@@ -90,24 +84,6 @@
9084
<None Include="AuthProvider\CustomAuthExtensions.cs" />
9185
<None Include="AuthProvider\CustomAuthHandler.cs" />
9286
<None Include="AuthProvider\CustomAuthOptions.cs" />
93-
<None Include="wwwroot\bin\redis-benchmark">
94-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
95-
</None>
96-
<None Include="wwwroot\bin\redis-check-aof">
97-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
98-
</None>
99-
<None Include="wwwroot\bin\redis-check-rdb">
100-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
101-
</None>
102-
<None Include="wwwroot\bin\redis-cli">
103-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
104-
</None>
105-
<None Include="wwwroot\bin\redis-sentinel">
106-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
107-
</None>
108-
<None Include="wwwroot\bin\redis-server">
109-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
110-
</None>
11187
</ItemGroup>
11288

11389
<ItemGroup>
@@ -119,6 +95,24 @@
11995
</ItemGroup>
12096

12197
<ItemGroup>
98+
<Content Update="wwwroot\bin\redis-benchmark">
99+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
100+
</Content>
101+
<Content Update="wwwroot\bin\redis-check-aof">
102+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
103+
</Content>
104+
<Content Update="wwwroot\bin\redis-check-rdb">
105+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
106+
</Content>
107+
<Content Update="wwwroot\bin\redis-cli">
108+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
109+
</Content>
110+
<Content Update="wwwroot\bin\redis-sentinel">
111+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
112+
</Content>
113+
<Content Update="wwwroot\bin\redis-server">
114+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
115+
</Content>
122116
<Content Update="wwwroot\formatters-styles\annotated.css">
123117
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
124118
</Content>

0 commit comments

Comments
 (0)