Skip to content

Commit ffc8df4

Browse files
committed
Fix: update existing JSON Files when using FileStore
FileStore did not update existing chain, assets and _full .json files
1 parent 6777647 commit ffc8df4

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,4 @@ ASALocalRun/
321321
# MSBuild Binary and Structured Log
322322
*.binlog
323323

324+
wwwroot/bin/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1)
2+
$SiteCode = Get-PSDrive -PSProvider CMSITE
3+
Push-Location "$($SiteCode.Name):\"
4+
5+
Get-CMTaskSequence | ForEach-Object {
6+
$id = $_.PackageID
7+
Invoke-RestMethod -Uri "http://localhost:5000/uploadxml/$($id)" -Method Post -Body $_.Sequence -ContentType "application/json; charset=utf-8"
8+
}
9+

source/jaindb/docker.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run --name jaindb -d -e "localURL=http://192.168.2.146" -p 5000:5000/tcp -p 6379:6379/tcp -v d:/jaindb:/app/wwwroot zanderr/jaindb

source/jaindb/jaindb.cs

+22-8
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,6 @@ public static bool WriteHash(string Hash, string Data, string Collection)
305305
if (!Directory.Exists("wwwroot\\" + Collection))
306306
Directory.CreateDirectory("wwwroot\\" + Collection);
307307

308-
if (!File.Exists("wwwroot\\" + Collection + "\\" + Hash + ".json")) //We do not have to create the same hash file twice...
309-
{
310-
lock (locker) //only one write operation
311-
{
312-
File.WriteAllText("wwwroot\\" + Collection + "\\" + Hash + ".json", Data);
313-
}
314-
}
315-
316308
switch (Collection.ToLower())
317309
{
318310
case "_full":
@@ -360,6 +352,28 @@ public static bool WriteHash(string Hash, string Data, string Collection)
360352
}
361353
}
362354
}
355+
356+
lock (locker) //only one write operation
357+
{
358+
File.WriteAllText("wwwroot\\" + Collection + "\\" + Hash + ".json", Data);
359+
}
360+
break;
361+
362+
case "chain":
363+
lock (locker) //only one write operation
364+
{
365+
File.WriteAllText("wwwroot\\" + Collection + "\\" + Hash + ".json", Data);
366+
}
367+
break;
368+
369+
default:
370+
if (!File.Exists("wwwroot\\" + Collection + "\\" + Hash + ".json")) //We do not have to create the same hash file twice...
371+
{
372+
lock (locker) //only one write operation
373+
{
374+
File.WriteAllText("wwwroot\\" + Collection + "\\" + Hash + ".json", Data);
375+
}
376+
}
363377
break;
364378
}
365379

source/jaindb/jaindb.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<RepositoryUrl>https://github.com/rzander/jaindb</RepositoryUrl>
1414
<PackageTags>blockchain json</PackageTags>
1515
<Version>0.9.0</Version>
16-
<AssemblyVersion>0.9.0.18</AssemblyVersion>
17-
<FileVersion>0.9.0.18</FileVersion>
16+
<AssemblyVersion>0.9.0.19</AssemblyVersion>
17+
<FileVersion>0.9.0.19</FileVersion>
1818
<StartupObject>jaindb.Program</StartupObject>
1919
<UserSecretsId>fcfd6c0a-e53c-46cb-8a9d-b786c0579861</UserSecretsId>
2020
</PropertyGroup>

0 commit comments

Comments
 (0)