This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class MessageErrorsManager | |
{ | |
readonly ConcurrentDictionary<string, MessageErrorObject> errors = new(); | |
public void AddError(MessageErrorObject? error) | |
{ | |
var correlationId = CorrelationIdHelper.Get(); | |
try | |
{ | |
Log.WriteDebug($"{nameof(MessageErrorsManager)}: started.", correlationId); | |
if(error is null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Confluent.Kafka; | |
// producer | |
Task.Run(() => | |
{ | |
Console.WriteLine("producer started"); | |
var conf = new ProducerConfig { BootstrapServers = "localhost:29092" }; | |
Action<DeliveryReport<Null, string>> handler = r => | |
Console.WriteLine(!r.Error.IsError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VerbalizedEvent | |
{ | |
private readonly EventData _eventData; | |
public VerbalizedEvent(MqttDelivery delivery) | |
{ | |
Delivery = delivery; | |
if ( delivery.TryGetPayload<PayloadWithEventData>(out var payload)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UISchema.Attributes; | |
using System; | |
using System.Collections.Generic; | |
using System.Xml; | |
namespace UISchema.Builder; | |
public class UISchemaBuilder | |
{ | |
private readonly string _groupName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ExtendedGCD | |
{ | |
#region General | |
/// <summary> | |
/// Остаток от деления, как в Питоне | |
/// </summary> | |
/// <param name="a"></param> | |
/// <param name="p"></param> | |
/// <returns></returns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FixedSizeQueue<T> | |
: IReadOnlyCollection<T> | |
{ | |
private readonly T[] _items; | |
private int _tail; | |
public FixedSizeQueue(int capacity) | |
{ | |
if (capacity <= 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiCommands] | |
abstract public class Commands | |
{ | |
[ApiArgument( typeof( SubjectsListArguments ), isOptional: true )] | |
[ApiReturn( typeof( SubjectsListResponse ) )] | |
[Title] | |
[Description] | |
public const string SubjectsList = "subjects_list"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public class CustomTypeMapper | |
{ | |
static private readonly Dictionary<Type, Func<OpenApiSchema>> _typeToOpenApiSchema = new() | |
{ | |
[typeof(bool)] = () => new OpenApiSchema { Type = "boolean" }, | |
[typeof(byte)] = () => new OpenApiSchema { Type = "string", Format = "byte" }, | |
[typeof(int)] = () => new OpenApiSchema { Type = "integer", Format = "int32" }, | |
[typeof(uint)] = () => new OpenApiSchema { Type = "integer", Format = "int32" }, | |
[typeof(long)] = () => new OpenApiSchema { Type = "integer", Format = "int64" }, | |
[typeof(ulong)] = () => new OpenApiSchema { Type = "integer", Format = "int64" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class OpenApiGenerator | |
{ | |
public string GenerateYaml( | |
Type apiType, | |
CultureInfo culture) | |
{ | |
var metadata = ApiMetadata.FromType(apiType); | |
if (metadata == null) | |
throw new Exception("The given type is not API"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiEndpoint( Name, SignatureBase )] | |
[Title] | |
[Description] | |
abstract public class ReportsAPI | |
{ | |
public const string Name = "reports"; | |
public const string SignatureBase = "/system/report"; | |
static public readonly EndpointSignature Signature = |
NewerOlder