Kaynağa Gözat

delete unuserd project.

master
yangxiaodong 7 yıl önce
ebeveyn
işleme
f89940b7f2
8 değiştirilmiş dosya ile 0 ekleme ve 404 silme
  1. +0
    -43
      src/Cap.Consistency.Server/Cap.Consistency.Server.csproj
  2. +0
    -63
      src/Cap.Consistency.Server/ConsistencyServer.cs
  3. +0
    -53
      src/Cap.Consistency.Server/ConsistencyServerOptions.cs
  4. +0
    -9
      src/Cap.Consistency.Server/IConsistencyServer.cs
  5. +0
    -46
      src/Cap.Consistency.Server/IConsistencyTrace.cs
  6. +0
    -20
      src/Cap.Consistency.Server/IConsumer.cs
  7. +0
    -145
      src/Cap.Consistency.Server/Internal/Infrastructure/ConsistencyTrace.cs
  8. +0
    -25
      src/Cap.Consistency.Server/Properties/AssemblyInfo.cs

+ 0
- 43
src/Cap.Consistency.Server/Cap.Consistency.Server.csproj Dosyayı Görüntüle

@@ -1,43 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<DebugType>portable</DebugType>
<AssemblyName>Cap.Consistency.Server</AssemblyName>
<PackageId>Cap.Consistency.Server</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
</PropertyGroup>

<ItemGroup>
<Compile Remove="x64\**" />
<Compile Remove="x86\**" />
<Content Remove="x64\**" />
<Content Remove="x86\**" />
<EmbeddedResource Remove="x64\**" />
<EmbeddedResource Remove="x86\**" />
<None Remove="x64\**" />
<None Remove="x86\**" />
</ItemGroup>

<ItemGroup>
<Content Remove="C:\Users\yangxiaodong\.nuget\packages\rdkafka.internal.librdkafka\0.9.2-ci-28\build\..\runtimes\win7-x64\native\librdkafka.dll" />
<Content Remove="C:\Users\yangxiaodong\.nuget\packages\rdkafka.internal.librdkafka\0.9.2-ci-28\build\..\runtimes\win7-x64\native\zlib.dll" />
<Content Remove="C:\Users\yangxiaodong\.nuget\packages\rdkafka.internal.librdkafka\0.9.2-ci-28\build\..\runtimes\win7-x86\native\librdkafka.dll" />
<Content Remove="C:\Users\yangxiaodong\.nuget\packages\rdkafka.internal.librdkafka\0.9.2-ci-28\build\..\runtimes\win7-x86\native\zlib.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="1.1.2" />
<PackageReference Include="RdKafka" Version="0.9.2-ci-189" />
</ItemGroup>

</Project>

+ 0
- 63
src/Cap.Consistency.Server/ConsistencyServer.cs Dosyayı Görüntüle

@@ -1,63 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text;

namespace Cap.Consistency.Server
{
public class ConsistencyServer : IConsistencyServer
{
private Stack<IDisposable> _disposables;
private readonly IApplicationLifetime _applicationLifetime;
private readonly ILogger _logger;
private readonly IConsumer _consumer;

public ConsistencyServer(IOptions<ConsistencyServerOptions> options, ILoggerFactory loggerFactory)
{
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}

if (loggerFactory == null)
{
throw new ArgumentNullException(nameof(loggerFactory));
}

Options = options.Value ?? new ConsistencyServerOptions();
_logger = loggerFactory.CreateLogger(typeof(ConsistencyServer).GetTypeInfo().Namespace);
_consumer = Options.ApplicationServices.GetService<IConsumer>();
}

public ConsistencyServerOptions Options { get; }

public void Run() {
//配置消费者组
//var config = new Config() { GroupId = "example-csharp-consumer" };
//using (var consumer = new EventConsumer(config, "127.0.0.1:9092")) {

// //注册一个事件
// consumer.OnMessage += (obj, msg) =>
// {
// string text = Encoding.UTF8.GetString(msg.Payload, 0, msg.Payload.Length);
// Console.WriteLine($"Topic: {msg.Topic} Partition: {msg.Partition} Offset: {msg.Offset} {text}");
// };

// //订阅一个或者多个Topic
// consumer.Subscribe(new[] { "testtopic" });

// //启动
// consumer.Start();

// _logger.LogInformation("Started consumer...");
//}
}
}
}

+ 0
- 53
src/Cap.Consistency.Server/ConsistencyServerOptions.cs Dosyayı Görüntüle

@@ -1,53 +0,0 @@
using System;

namespace Cap.Consistency.Server
{
public class ConsistencyServerOptions
{
/// <summary>
/// Enables the Consistency Server options callback to resolve and use services registered by the application during startup.
/// Typically initialized by <see cref="Cap.Consistency.UseConsistency(Action{ConsistencyServerOptions})"/>.
/// </summary>
public IServiceProvider ApplicationServices { get; set; }

/// <summary>
/// The amount of time after the server begins shutting down before connections will be forcefully closed.
/// Kestrel will wait for the duration of the timeout for any ongoing request processing to complete before
/// terminating the connection. No new connections or requests will be accepted during this time.
/// </summary>
/// <remarks>
/// Defaults to 5 seconds.
/// </remarks>
public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromSeconds(5);

/// <summary>
/// The number of libuv I/O threads used to process requests.
/// </summary>
/// <remarks>
/// Defaults to half of <see cref="Environment.ProcessorCount" /> rounded down and clamped between 1 and 16.
/// </remarks>
public int ThreadCount { get; set; } = ProcessorThreadCount;

private static int ProcessorThreadCount {
get {
// Actual core count would be a better number
// rather than logical cores which includes hyper-threaded cores.
// Divide by 2 for hyper-threading, and good defaults (still need threads to do webserving).
var threadCount = Environment.ProcessorCount >> 1;

if (threadCount < 1) {
// Ensure shifted value is at least one
return 1;
}

if (threadCount > 16) {
// Receive Side Scaling RSS Processor count currently maxes out at 16
// would be better to check the NIC's current hardware queues; but xplat...
return 16;
}

return threadCount;
}
}
}
}

+ 0
- 9
src/Cap.Consistency.Server/IConsistencyServer.cs Dosyayı Görüntüle

@@ -1,9 +0,0 @@
namespace Cap.Consistency.Server
{
public interface IConsistencyServer
{
ConsistencyServerOptions Options { get; }

void Run();
}
}

+ 0
- 46
src/Cap.Consistency.Server/IConsistencyTrace.cs Dosyayı Görüntüle

@@ -1,46 +0,0 @@
using System;
using Microsoft.Extensions.Logging;

namespace Cap.Consistency.Server
{
public interface IConsistencyTrace : ILogger
{
void ConnectionStart(string connectionId);

void ConnectionStop(string connectionId);

void ConnectionRead(string connectionId, int count);

void ConnectionPause(string connectionId);

void ConnectionResume(string connectionId);

void ConnectionReadFin(string connectionId);

void ConnectionWriteFin(string connectionId);

void ConnectionWroteFin(string connectionId, int status);

void ConnectionKeepAlive(string connectionId);

void ConnectionDisconnect(string connectionId);

void ConnectionWrite(string connectionId, int count);

void ConnectionWriteCallback(string connectionId, int status);

void ConnectionError(string connectionId, Exception ex);

void ConnectionReset(string connectionId);

void RequestProcessingError(string connectionId, Exception ex);

void ConnectionDisconnectedWrite(string connectionId, int count, Exception ex);

void ConnectionHeadResponseBodyWrite(string connectionId, long count);

void NotAllConnectionsClosedGracefully();

void ApplicationError(string connectionId, Exception ex);
}
}

+ 0
- 20
src/Cap.Consistency.Server/IConsumer.cs Dosyayı Görüntüle

@@ -1,20 +0,0 @@
using System;
using Microsoft.AspNetCore.Hosting;

namespace Cap.Consistency.Server
{
public interface IConsumer : IDisposable
{
void Start();

void Start(int count);

void Stop();

IConsistencyTrace Log { get; set; }

ConsistencyServerOptions ServerOptions { get; set; }

IApplicationLifetime AppLifetime { get; set; }
}
}

+ 0
- 145
src/Cap.Consistency.Server/Internal/Infrastructure/ConsistencyTrace.cs Dosyayı Görüntüle

@@ -1,145 +0,0 @@
using System;
using Microsoft.Extensions.Logging;

namespace Cap.Consistency.Server.Internal.Infrastructure
{
/// <summary>
/// Summary description for KestrelTrace
/// </summary>
public class ConsistencyTrace : IConsistencyTrace
{
private static readonly Action<ILogger, string, Exception> _connectionStart;
private static readonly Action<ILogger, string, Exception> _connectionStop;
private static readonly Action<ILogger, string, Exception> _connectionPause;
private static readonly Action<ILogger, string, Exception> _connectionResume;
private static readonly Action<ILogger, string, Exception> _connectionReadFin;
private static readonly Action<ILogger, string, Exception> _connectionWriteFin;
private static readonly Action<ILogger, string, int, Exception> _connectionWroteFin;
private static readonly Action<ILogger, string, Exception> _connectionKeepAlive;
private static readonly Action<ILogger, string, Exception> _connectionDisconnect;
private static readonly Action<ILogger, string, Exception> _applicationError;
private static readonly Action<ILogger, string, Exception> _connectionError;
private static readonly Action<ILogger, string, int, Exception> _connectionDisconnectedWrite;
private static readonly Action<ILogger, string, long, Exception> _connectionHeadResponseBodyWrite;
private static readonly Action<ILogger, Exception> _notAllConnectionsClosedGracefully;
private static readonly Action<ILogger, string, Exception> _connectionReset;
private static readonly Action<ILogger, string, Exception> _requestProcessingError;

protected readonly ILogger _logger;

static ConsistencyTrace() {
_connectionStart = LoggerMessage.Define<string>(LogLevel.Debug, 1, @"Connection id ""{ConnectionId}"" started.");
_connectionStop = LoggerMessage.Define<string>(LogLevel.Debug, 2, @"Connection id ""{ConnectionId}"" stopped.");
// ConnectionRead: Reserved: 3
_connectionPause = LoggerMessage.Define<string>(LogLevel.Debug, 4, @"Connection id ""{ConnectionId}"" paused.");
_connectionResume = LoggerMessage.Define<string>(LogLevel.Debug, 5, @"Connection id ""{ConnectionId}"" resumed.");
_connectionReadFin = LoggerMessage.Define<string>(LogLevel.Debug, 6, @"Connection id ""{ConnectionId}"" received FIN.");
_connectionWriteFin = LoggerMessage.Define<string>(LogLevel.Debug, 7, @"Connection id ""{ConnectionId}"" sending FIN.");
_connectionWroteFin = LoggerMessage.Define<string, int>(LogLevel.Debug, 8, @"Connection id ""{ConnectionId}"" sent FIN with status ""{Status}"".");
_connectionKeepAlive = LoggerMessage.Define<string>(LogLevel.Debug, 9, @"Connection id ""{ConnectionId}"" completed keep alive response.");
_connectionDisconnect = LoggerMessage.Define<string>(LogLevel.Debug, 10, @"Connection id ""{ConnectionId}"" disconnecting.");
// ConnectionWrite: Reserved: 11
// ConnectionWriteCallback: Reserved: 12
_applicationError = LoggerMessage.Define<string>(LogLevel.Error, 13, @"Connection id ""{ConnectionId}"": An unhandled exception was thrown by the application.");
_connectionError = LoggerMessage.Define<string>(LogLevel.Information, 14, @"Connection id ""{ConnectionId}"" communication error.");
_connectionDisconnectedWrite = LoggerMessage.Define<string, int>(LogLevel.Debug, 15, @"Connection id ""{ConnectionId}"" write of ""{count}"" bytes to disconnected client.");
_notAllConnectionsClosedGracefully = LoggerMessage.Define(LogLevel.Debug, 16, "Some connections failed to close gracefully during server shutdown.");
_connectionHeadResponseBodyWrite = LoggerMessage.Define<string, long>(LogLevel.Debug, 18, @"Connection id ""{ConnectionId}"" write of ""{count}"" body bytes to non-body HEAD response.");
_connectionReset = LoggerMessage.Define<string>(LogLevel.Debug, 19, @"Connection id ""{ConnectionId}"" reset.");
_requestProcessingError = LoggerMessage.Define<string>(LogLevel.Information, 20, @"Connection id ""{ConnectionId}"" request processing ended abnormally.");
}

public ConsistencyTrace(ILogger logger) {
_logger = logger;
}

public virtual void ConnectionStart(string connectionId) {
_connectionStart(_logger, connectionId, null);
}

public virtual void ConnectionStop(string connectionId) {
_connectionStop(_logger, connectionId, null);
}

public virtual void ConnectionRead(string connectionId, int count) {
}

public virtual void ConnectionPause(string connectionId) {
_connectionPause(_logger, connectionId, null);
}

public virtual void ConnectionResume(string connectionId) {
_connectionResume(_logger, connectionId, null);
}

public virtual void ConnectionReadFin(string connectionId) {
_connectionReadFin(_logger, connectionId, null);
}

public virtual void ConnectionWriteFin(string connectionId) {
_connectionWriteFin(_logger, connectionId, null);
}

public virtual void ConnectionWroteFin(string connectionId, int status) {
_connectionWroteFin(_logger, connectionId, status, null);
}

public virtual void ConnectionKeepAlive(string connectionId) {
_connectionKeepAlive(_logger, connectionId, null);
}

public virtual void ConnectionDisconnect(string connectionId) {
_connectionDisconnect(_logger, connectionId, null);
}

public virtual void ConnectionWrite(string connectionId, int count) {
// Don't log for now since this could be *too* verbose.
// Reserved: Event ID 11
}

public virtual void ConnectionWriteCallback(string connectionId, int status) {
// Don't log for now since this could be *too* verbose.
// Reserved: Event ID 12
}

public virtual void ApplicationError(string connectionId, Exception ex) {
_applicationError(_logger, connectionId, ex);
}

public virtual void ConnectionError(string connectionId, Exception ex) {
_connectionError(_logger, connectionId, ex);
}

public virtual void ConnectionDisconnectedWrite(string connectionId, int count, Exception ex) {
_connectionDisconnectedWrite(_logger, connectionId, count, ex);
}

public virtual void ConnectionHeadResponseBodyWrite(string connectionId, long count) {
_connectionHeadResponseBodyWrite(_logger, connectionId, count, null);
}

public virtual void NotAllConnectionsClosedGracefully() {
_notAllConnectionsClosedGracefully(_logger, null);
}

public virtual void ConnectionReset(string connectionId) {
_connectionReset(_logger, connectionId, null);
}

public virtual void RequestProcessingError(string connectionId, Exception ex) {
_requestProcessingError(_logger, connectionId, ex);
}

public virtual void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) {
_logger.Log(logLevel, eventId, state, exception, formatter);
}

public virtual bool IsEnabled(LogLevel logLevel) {
return _logger.IsEnabled(logLevel);
}

public virtual IDisposable BeginScope<TState>(TState state) {
return _logger.BeginScope(state);
}
}
}

+ 0
- 25
src/Cap.Consistency.Server/Properties/AssemblyInfo.cs Dosyayı Görüntüle

@@ -1,25 +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("Cap.Consistency.Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cap.Consistency.Server")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("55CF2C48-D390-40CF-8AD9-FA39F90E9217")]

Yükleniyor…
İptal
Kaydet