зеркало из https://github.com/Azure/TypeEdge.git
volumes refactored
This commit is contained in:
Родитель
4d1b2dec44
Коммит
59372fef4c
|
@ -1 +1 @@
|
|||
Subproject commit b3f5499becb885e94bde57e3128736355e66ce43
|
||||
Subproject commit 38fbb8d794d0f19da65d614a61544c82d8c92384
|
|
@ -1 +1 @@
|
|||
Subproject commit ff062519b7dc9cadd3f2fc2d0d7e2ccc67fc2ede
|
||||
Subproject commit 54e6a7116a1170f5d90b3e33f68ff8b7276182e8
|
|
@ -47,8 +47,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemperatureSensor", "Exampl
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnomalyDetection", "Examples\AnomalyDetection\Modules\AnomalyDetection\AnomalyDetection.csproj", "{454D7BD7-6490-4124-9F7F-B486F98EC454}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataSampling", "Examples\AnomalyDetection\Modules\DataSampling\DataSampling.csproj", "{EF855D9E-A6FD-4E9D-8883-8E627107DE12}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Visualization", "Examples\AnomalyDetection\Modules\Visualization\Visualization.csproj", "{8B048F42-4132-4374-8204-69EBFD2984C7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualizationWeb", "Examples\AnomalyDetection\Modules\VisualizationWeb\VisualizationWeb.csproj", "{D14AF601-C10D-4D4E-BC59-FF8496027815}"
|
||||
|
@ -57,6 +55,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Orchestrator", "Examples\An
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AnomalyDetection", "AnomalyDetection", "{26E2528E-52E6-4F2E-A1CC-7CACE91D1D1E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModelTraining", "Examples\AnomalyDetection\Modules\ModelTraining\ModelTraining.csproj", "{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CodeCoverage|Any CPU = CodeCoverage|Any CPU
|
||||
|
@ -217,14 +217,6 @@ Global
|
|||
{454D7BD7-6490-4124-9F7F-B486F98EC454}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{454D7BD7-6490-4124-9F7F-B486F98EC454}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{454D7BD7-6490-4124-9F7F-B486F98EC454}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.CodeCoverage|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.CodeCoverage|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{8B048F42-4132-4374-8204-69EBFD2984C7}.CodeCoverage|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{8B048F42-4132-4374-8204-69EBFD2984C7}.CodeCoverage|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{8B048F42-4132-4374-8204-69EBFD2984C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
@ -249,6 +241,14 @@ Global
|
|||
{FB7F2691-C83C-4E2B-8FCD-A3DB1650609F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB7F2691-C83C-4E2B-8FCD-A3DB1650609F}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{FB7F2691-C83C-4E2B-8FCD-A3DB1650609F}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.CodeCoverage|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.CodeCoverage|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -271,11 +271,11 @@ Global
|
|||
{55D73BA2-72B9-46B5-96C8-C32C9398340B} = {26E2528E-52E6-4F2E-A1CC-7CACE91D1D1E}
|
||||
{1F1D6340-302C-4422-9101-49A7F5C3F3F0} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{454D7BD7-6490-4124-9F7F-B486F98EC454} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{EF855D9E-A6FD-4E9D-8883-8E627107DE12} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{8B048F42-4132-4374-8204-69EBFD2984C7} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{D14AF601-C10D-4D4E-BC59-FF8496027815} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{FB7F2691-C83C-4E2B-8FCD-A3DB1650609F} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
{26E2528E-52E6-4F2E-A1CC-7CACE91D1D1E} = {825537AA-3F27-4492-8E83-ABD3B49356FC}
|
||||
{AD8E4B48-D0AD-42AA-A189-B7502C2767E5} = {55D73BA2-72B9-46B5-96C8-C32C9398340B}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {114E5850-267D-4B44-ACD5-91ACA382DDBC}
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>TypeEdge.Host</id>
|
||||
<version>0.2.3</version>
|
||||
<version>0.2.4</version>
|
||||
<authors>paloukari</authors>
|
||||
<owners>paloukari</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Package Description</description>
|
||||
<dependencies>
|
||||
<group targetFramework=".NETCoreApp2.1">
|
||||
<dependency id="TypeEdge" version="0.2.3" exclude="Build,Analyzers" />
|
||||
<dependency id="TypeEdge" version="0.2.4" exclude="Build,Analyzers" />
|
||||
<dependency id="Serilog.Extensions.Logging" version="1.4.0" exclude="Build,Analyzers" />
|
||||
<dependency id="Serilog.Sinks.Console" version="2.1.0" exclude="Build,Analyzers" />
|
||||
<dependency id="Microsoft.Extensions.DependencyInjection" version="2.1.1" exclude="Build,Analyzers" />
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
<PackageId>TypeEdge.Proxy</PackageId>
|
||||
<Version>0.2.3</Version>
|
||||
<Version>0.2.4</Version>
|
||||
<Authors>paloukari</Authors>
|
||||
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
|
|
|
@ -358,16 +358,17 @@ namespace TypeEdge.Modules
|
|||
Volumes[volumeName] = volumePath;
|
||||
}
|
||||
|
||||
internal T GetFileData<T>(string name, string index)
|
||||
where T : class, new()
|
||||
internal T GetReferenceData<T>(string name, string index)
|
||||
where T : class, IEdgeMessage, new()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine(Volumes[name], index);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var result = new T();
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
var result = JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(bytes));
|
||||
result.SetBytes(bytes);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -378,13 +379,13 @@ namespace TypeEdge.Modules
|
|||
return null;
|
||||
}
|
||||
|
||||
internal bool SetFileData<T>(string name, string index, T value)
|
||||
where T : class, new()
|
||||
internal bool SetReferenceData<T>(string name, string index, T value)
|
||||
where T : class, IEdgeMessage, new()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine(Volumes[name], index);
|
||||
var bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value));
|
||||
var bytes = value.GetBytes();
|
||||
|
||||
File.WriteAllBytes(path, bytes);
|
||||
|
||||
|
@ -397,7 +398,7 @@ namespace TypeEdge.Modules
|
|||
return false;
|
||||
}
|
||||
|
||||
internal bool DeleteFile(string name, string index)
|
||||
internal bool DeleteReference(string name, string index)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace TypeEdge.Modules.Endpoints
|
|||
{
|
||||
if (_volume != null)
|
||||
{
|
||||
string fileName;
|
||||
if (_volume.TryWrite(message, out fileName))
|
||||
string fileName = $@"{DateTime.Now.Ticks}"; ;
|
||||
if (_volume.TryWrite(message, fileName))
|
||||
{
|
||||
typeof(T).GetProperty("FileName").SetValue(message, fileName);
|
||||
typeof(T).GetProperty("Message").SetValue(message, null);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
<PackageId>TypeEdge</PackageId>
|
||||
<Version>0.2.3</Version>
|
||||
<Version>0.2.4</Version>
|
||||
<Authors>paloukari</Authors>
|
||||
<PackageOutputPath>../../TypeEdgeNuGets</PackageOutputPath>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
|
|
|
@ -15,26 +15,21 @@ namespace TypeEdge.Volumes
|
|||
Module.RegisterVolume(Name);
|
||||
}
|
||||
|
||||
public bool TryWrite(T data, out string fileName)
|
||||
{
|
||||
var fn = $@"{DateTime.Now.Ticks}";
|
||||
if (Module.SetFileData(Name, fn, data))
|
||||
{
|
||||
fileName = fn;
|
||||
return true;
|
||||
}
|
||||
fileName = null;
|
||||
public bool TryWrite(T data, string fileName)
|
||||
{
|
||||
if (Module.SetReferenceData(Name, fileName, data))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public T Read(string fileName)
|
||||
{
|
||||
return Module.GetFileData<T>(Name, fileName);
|
||||
return Module.GetReferenceData<T>(Name, fileName);
|
||||
}
|
||||
|
||||
public bool Delete(string fileName)
|
||||
{
|
||||
return Module.DeleteFile(Name, fileName);
|
||||
return Module.DeleteReference(Name, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче