Fix network namespace

pull/1/head
Ogoun 6 years ago
parent f28abaccd4
commit 3c3512ec18

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<!-- Logging -->
<add key="log" value="logs" />
<add key="console" value="true" />
<!-- Service parameters -->
<add key="ServiceName" value="MyZeroService" />
<add key="ServiceDescription" value="ZeroService example" />
<add key="ServiceStartType" value="Automatic" />
<add key="ServiceAccountType" value="LocalSystem" />
</appSettings>
</configuration>

@ -1,39 +0,0 @@
using ZeroLevel;
using ZeroLevel.Services.Applications;
namespace ZeroExample
{
public sealed class MyFirstApp
: BaseWindowsService, IZeroService
{
public MyFirstApp() : base("MyApp")
{
Log.AddConsoleLogger();
}
public override void PauseAction()
{
}
public override void ResumeAction()
{
}
public override void StartAction()
{
Log.Info("Started");
}
public override void StopAction()
{
}
}
internal class Program
{
private static void Main(string[] args)
{
Bootstrap.Startup<MyFirstApp>(args);
}
}
}

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ZeroExample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZeroExample")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("50cebec2-2571-4592-afd2-970bdb41947b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{50CEBEC2-2571-4592-AFD2-970BDB41947B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ZeroExample</RootNamespace>
<AssemblyName>ZeroExample</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="ZeroLevel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ZeroLevel.1.0.3\lib\net47\ZeroLevel.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ZeroLevel" version="1.0.3" targetFramework="net472" />
</packages>

@ -37,7 +37,7 @@ namespace ZeroLevel.Discovery
var socketPort = Configuration.Default.First<int>("socketport");
_exInbox = ExchangeTransportFactory.GetServer("socket", socketPort);
_exInbox.RegisterInbox<IEnumerable<ServiceEndpointsInfo>>("services", (_, __) => routeTable.Get());
_exInbox.RegisterInbox<MicroserviceInfo, InvokeResult>("register", (info, _, __) => routeTable.Append(info));
_exInbox.RegisterInbox<ExServiceInfo, InvokeResult>("register", (info, _, __) => routeTable.Append(info));
Log.Info($"TCP server started on port {socketPort}");
}

@ -166,7 +166,7 @@ namespace ZeroLevel.Discovery
Save();
}
public InvokeResult Append(MicroserviceInfo serviceInfo)
public InvokeResult Append(ExServiceInfo serviceInfo)
{
InvokeResult result = null;
if (Ping(serviceInfo.Protocol, serviceInfo.Endpoint, serviceInfo.ServiceKey))

@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroLevel", "ZeroLevel\Zero
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroLevel.Discovery", "ZeroLevel.Discovery\ZeroLevel.Discovery.csproj", "{4F55B23F-938C-4DA2-B6DC-B6BC66D36073}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroExample", "ZeroExample\ZeroExample.csproj", "{50CEBEC2-2571-4592-AFD2-970BDB41947B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -43,18 +41,6 @@ Global
{4F55B23F-938C-4DA2-B6DC-B6BC66D36073}.Release|x64.Build.0 = Release|Any CPU
{4F55B23F-938C-4DA2-B6DC-B6BC66D36073}.Release|x86.ActiveCfg = Release|Any CPU
{4F55B23F-938C-4DA2-B6DC-B6BC66D36073}.Release|x86.Build.0 = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|x64.ActiveCfg = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|x64.Build.0 = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|x86.ActiveCfg = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Debug|x86.Build.0 = Debug|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|Any CPU.Build.0 = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|x64.ActiveCfg = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|x64.Build.0 = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|x86.ActiveCfg = Release|Any CPU
{50CEBEC2-2571-4592-AFD2-970BDB41947B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,11 +1,10 @@
using System.Collections.Generic;
using ZeroLevel.Network.Microservices;
namespace ZeroLevel.Network
{
public interface IDiscoveryClient
{
bool Register(MicroserviceInfo info);
bool Register(ExServiceInfo info);
IEnumerable<ServiceEndpointInfo> GetServiceEndpoints(string serviceKey);

@ -2,7 +2,7 @@
using System.Net;
using ZeroLevel.Models;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public interface IExClient
: IDisposable

@ -1,7 +1,7 @@
using System;
using System.Net;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public interface IExService
: IDisposable

@ -1,6 +1,6 @@
using System.Net;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public interface IZBackward
{

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Net;
namespace ZeroLevel.Services.Network.Contract
namespace ZeroLevel.Network
{
public interface IZObservableServer
: IDisposable

@ -1,7 +1,7 @@
using System;
using System.Net;
namespace ZeroLevel.Services.Network.Contract
namespace ZeroLevel.Network
{
public interface IZTransport
: IDisposable

@ -2,9 +2,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Reflection;
using ZeroLevel.Network.Microservices;
using ZeroLevel.Services.Network;
using ZeroLevel.Services.Network.Contract;
namespace ZeroLevel.Network
{
@ -64,6 +61,7 @@ namespace ZeroLevel.Network
}
throw new NotSupportedException($"Protocol {protocol} not supported");
}
/// <summary>
/// Creates a client to access the server using the specified protocol
/// </summary>

@ -2,7 +2,7 @@
using System.Runtime.Serialization;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
[DataContract]
public class Checkpoint :

@ -1,6 +1,6 @@
using System.Runtime.Serialization;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
[DataContract]
public sealed class CheckpointArc

@ -1,4 +1,4 @@
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
public enum CheckpointType
{

@ -2,12 +2,12 @@
using System.Runtime.Serialization;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
[Serializable]
[DataContract]
public sealed class MicroserviceInfo :
IEquatable<MicroserviceInfo>, IBinarySerializable
public sealed class ExServiceInfo :
IEquatable<ExServiceInfo>, IBinarySerializable
{
public const string DEFAULT_GROUP_NAME = "__service_default_group__";
public const string DEFAULT_TYPE_NAME = "__service_default_type__";
@ -49,7 +49,7 @@ namespace ZeroLevel.Network.Microservices
[DataMember]
public string Version { get; set; }
public bool Equals(MicroserviceInfo other)
public bool Equals(ExServiceInfo other)
{
if (other == null) return false;
if (object.ReferenceEquals(this, other)) return true;

@ -1,6 +1,6 @@
using System;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public abstract class ExchangeAttribute : Attribute { }

@ -6,7 +6,7 @@ using System.Threading;
using ZeroLevel.Services.Pools;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
[Serializable]
[DataContract]

@ -1,6 +1,6 @@
using System;
namespace ZeroLevel.Services.Network.Models
namespace ZeroLevel.Network
{
internal sealed class RequestInfo
{

@ -1,6 +1,6 @@
using System;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
/// <summary>
/// Endpoint

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace ZeroLevel.Network.Microservices
namespace ZeroLevel.Network
{
/// <summary>
/// Information about service connection points

@ -1,4 +1,4 @@
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public enum ZTransportStatus
: int

@ -4,7 +4,7 @@ using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public static class NetUtils
{

@ -1,4 +1,4 @@
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{/*
public static class NetworkStats
{

@ -1,6 +1,6 @@
using System;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public static class NetworkStreamFastObfuscator
{

@ -4,11 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ZeroLevel.Models;
using ZeroLevel.Network;
using ZeroLevel.Network.Microservices;
using ZeroLevel.Services.Collections;
namespace ZeroLevel.Services.Network.Microservices
namespace ZeroLevel.Network
{
public class DiscoveryClient
: IDiscoveryClient
@ -121,7 +119,7 @@ namespace ZeroLevel.Services.Network.Microservices
}
}
public bool Register(MicroserviceInfo info)
public bool Register(ExServiceInfo info)
{
_discoveryServerClient.ForceConnect();
if (_discoveryServerClient.Status == ZTransportStatus.Working)
@ -129,7 +127,7 @@ namespace ZeroLevel.Services.Network.Microservices
bool result = false;
try
{
_discoveryServerClient.Request<MicroserviceInfo, InvokeResult>("register", info, r =>
_discoveryServerClient.Request<ExServiceInfo, InvokeResult>("register", info, r =>
{
result = r.Success;
if (!result)

@ -1,10 +1,8 @@
using System;
using System.Net;
using ZeroLevel.Models;
using ZeroLevel.Services.Network.Contract;
using ZeroLevel.Services.Network.Services;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
internal sealed class ExClient
: ZBaseNetwork, IExClient, IZBackward

@ -6,7 +6,7 @@ using System.Reflection;
using ZeroLevel.Services.Invokation;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network.Services
namespace ZeroLevel.Network
{
internal sealed class ExRouter
{

@ -1,9 +1,7 @@
using System;
using System.Net;
using ZeroLevel.Services.Network.Contract;
using ZeroLevel.Services.Network.Services;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
internal sealed class ExService
: ZBaseNetwork, IExService

@ -4,18 +4,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using ZeroLevel.Network;
using ZeroLevel.Network.Microservices;
using ZeroLevel.Services.Network;
namespace ZeroLevel.Microservices
namespace ZeroLevel.Network
{
public sealed class ExServiceHost
: IDisposable
{
private class MetaService
{
public MicroserviceInfo ServiceInfo { get; set; }
public ExServiceInfo ServiceInfo { get; set; }
public IExService Server { get; set; }
}
@ -50,7 +47,7 @@ namespace ZeroLevel.Microservices
if (false == _services.TryAdd(key, new MetaService
{
Server = server,
ServiceInfo = new MicroserviceInfo
ServiceInfo = new ExServiceInfo
{
Endpoint = $"{server.Endpoint.Address}:{server.Endpoint.Port}",
Protocol = service.Protocol,
@ -76,7 +73,7 @@ namespace ZeroLevel.Microservices
}
}
public IExService RegisterService(MicroserviceInfo serviceInfo)
public IExService RegisterService(ExServiceInfo serviceInfo)
{
try
{
@ -94,7 +91,7 @@ namespace ZeroLevel.Microservices
if (false == _services.TryAdd(key, new MetaService
{
Server = server,
ServiceInfo = new MicroserviceInfo
ServiceInfo = new ExServiceInfo
{
Endpoint = $"{server.Endpoint.Address}:{server.Endpoint.Port}",
Protocol = serviceInfo.Protocol,
@ -131,7 +128,7 @@ namespace ZeroLevel.Microservices
}
}
private void ValidateService(MicroserviceInfo service)
private void ValidateService(ExServiceInfo service)
{
if (string.IsNullOrWhiteSpace(service.Protocol))
{

@ -3,11 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ZeroLevel.Network;
using ZeroLevel.Network.Microservices;
using ZeroLevel.Services.Network;
namespace ZeroLevel.Microservices
namespace ZeroLevel.Network
{
/// <summary>
/// Provides data exchange between services
@ -36,7 +33,7 @@ namespace ZeroLevel.Microservices
return _host.RegisterService(service);
}
public IExService RegisterService(MicroserviceInfo service)
public IExService RegisterService(ExServiceInfo service)
{
return _host.RegisterService(service);
}

@ -1,6 +1,6 @@
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public static class FrameBuilder
{

@ -1,9 +1,8 @@
using System;
using System.Net;
using ZeroLevel.Models;
using ZeroLevel.Services.Network.Contract;
namespace ZeroLevel.Services.Network.Services
namespace ZeroLevel.Network
{
internal sealed class FrameExchange
: IDisposable

@ -2,7 +2,7 @@
using System.Threading.Tasks;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public sealed class FrameParser
{

@ -1,8 +1,7 @@
using System;
using System.Net;
using ZeroLevel.Services.Network.Contract;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public class ZExSocketObservableServer :
ZSocketServer, IZObservableServer

@ -1,6 +1,6 @@
using System;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public abstract class ZBaseNetwork
: IDisposable

@ -4,12 +4,10 @@ using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using ZeroLevel.Services.Network.Contract;
using ZeroLevel.Services.Network.Models;
using ZeroLevel.Services.Pools;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public class ZSocketClient
: ZBaseNetwork, IZTransport

@ -5,7 +5,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
public abstract class ZSocketServer
: ZBaseNetwork

@ -5,7 +5,7 @@ using System.Net.Sockets;
using System.Threading;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Network
namespace ZeroLevel.Network
{
internal sealed class ZSocketServerClient
: ZBaseNetwork, IZBackward, IEquatable<ZSocketServerClient>

@ -239,16 +239,16 @@
<Compile Include="Services\Network\Contract\IZObservableServer.cs" />
<Compile Include="Services\Network\Contract\IZTransport.cs" />
<Compile Include="Services\Network\ExchangeTransportFactory.cs" />
<Compile Include="Services\Network\Microservices\Checkpoint.cs" />
<Compile Include="Services\Network\Microservices\CheckpointArc.cs" />
<Compile Include="Services\Network\Microservices\CheckpointType.cs" />
<Compile Include="Services\Network\Microservices\DiscoveryClient.cs" />
<Compile Include="Services\Network\Microservices\Exchange.cs" />
<Compile Include="Services\Network\Microservices\ExServiceHost.cs" />
<Compile Include="Services\Network\Microservices\IDiscoveryClient.cs" />
<Compile Include="Services\Network\Microservices\IExchangeService.cs" />
<Compile Include="Services\Network\Models\Checkpoint.cs" />
<Compile Include="Services\Network\Models\CheckpointArc.cs" />
<Compile Include="Services\Network\Models\CheckpointType.cs" />
<Compile Include="Services\Network\Services\DiscoveryClient.cs" />
<Compile Include="Services\Network\Services\Exchange.cs" />
<Compile Include="Services\Network\Services\ExServiceHost.cs" />
<Compile Include="Services\Network\Contract\IDiscoveryClient.cs" />
<Compile Include="Services\Network\Contract\IExchangeService.cs" />
<Compile Include="Services\Network\Models\ExchangeAttributes.cs" />
<Compile Include="Services\Network\Models\MicroserviceInfo.cs" />
<Compile Include="Services\Network\Models\ExServiceInfo.cs" />
<Compile Include="Services\Network\Models\RequestInfo.cs" />
<Compile Include="Services\Network\Models\ServiceEndpointInfo.cs" />
<Compile Include="Services\Network\Models\ServiceEndpointsInfo.cs" />

@ -1 +1 @@
34e7ecccf08c9607e57fb18cb5dd41e7bc1a3610
ee06969e2b1f87052733e2a64f8bf6d27363d162

Loading…
Cancel
Save

Powered by TurnKey Linux.