├── tests
├── Gigya.Microdot.UnitTests
│ ├── loadpaths.json
│ ├── TestCert
│ │ ├── TestRootCA.cer
│ │ ├── TestRootCA.pvk
│ │ ├── OtherTestRootCA.cer
│ │ ├── OtherTestRootCA.pvk
│ │ ├── TestClientCer.cer
│ │ ├── TestClientCer.pvk
│ │ ├── TestServerCer.cer
│ │ ├── TestServerCer.pvk
│ │ ├── OtherTestClientCer.cer
│ │ ├── OtherTestClientCer.pvk
│ │ ├── OtherTestServerCer.cer
│ │ ├── OtherTestServerCer.pvk
│ │ └── CreateTestCert.cmd
│ ├── paket.references
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── app.config
│ ├── Serialization
│ │ ├── BusinessEntity.cs
│ │ └── MyServiceException.cs
│ ├── IDemoService.cs
│ ├── ExceptionExtensions.cs
│ ├── Configuration
│ │ ├── ConfigObjectsCacheTests.cs
│ │ ├── Verificator
│ │ │ └── VerifiedConfigs.cs
│ │ └── Benchmark
│ │ │ └── ConfigCreator.cs
│ ├── Caching
│ │ └── Host
│ │ │ └── ISlowService.cs
│ ├── NullEnvironment.cs
│ ├── Discovery
│ │ └── LocalNodeSourceTests.cs
│ └── StringExtensionsTest.cs
├── Gigya.Microdot.Hosting.UnitTests
│ ├── loadPaths.json
│ ├── NonOrleansMicroService
│ │ ├── CalculatorService.cs
│ │ └── ICalculatorService.cs
│ ├── paket.references
│ ├── app.config
│ └── Caching
│ │ └── RevokeNotifier
│ │ └── RevokeNotifierTestClass.cs
├── Gigya.Microdot.Orleans.Hosting.UnitTests
│ ├── loadPaths.json
│ ├── Microservice
│ │ ├── StorageProviderTest
│ │ │ ├── Account.cs
│ │ │ ├── IAccountGrain.cs
│ │ │ ├── BindStorageTest.cs
│ │ │ └── AccountGrain.cs
│ │ ├── WarmupTestService
│ │ │ └── WarmupTestServiceHostWithSiloHostFake.cs
│ │ ├── CalculatorService
│ │ │ ├── IUserGrainWithGuid.cs
│ │ │ └── ICalculatorServiceGrain.cs
│ │ └── AgeLimitService
│ │ │ └── GrainStubAgeLimitTestedService2.cs
│ ├── app.config
│ ├── paket.references
│ ├── TestContextAttribute.cs
│ └── WarmupTests.cs
└── Gigya.Microdot.ServiceContract.UnitTests
│ ├── paket.references
│ ├── app.config
│ └── Gigya.Microdot.ServiceContract.UnitTests.csproj
├── Gigya.ServiceContract
├── paket.references
├── .paket
│ ├── paket.exe
│ ├── update.bat
│ ├── restore.bat
│ └── paket.bootstrapper.exe
├── paket.dependencies
├── paket.lock
├── Attributes
│ ├── LogFieldsAttribute.cs
│ └── EventAttrubute.cs
├── paket.template
├── Gigya.ServiceContract.csproj
└── Exceptions
│ └── Breadcrumb.cs
├── Sample
├── CalculatorService
│ ├── paket.references
│ ├── loadPaths.json
│ ├── App.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── CalculatorServiceHost.cs
├── CalculatorService.Interface
│ ├── paket.references
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── CalculatorService.Interface.csproj
├── CalculatorService.Client
│ ├── paket.references
│ ├── loadPaths.json
│ ├── Discovery.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── App.config
│ └── CalculatorService.Client.csproj
└── CalculatorService.Orleans
│ ├── loadPaths.json
│ ├── paket.references
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── App.config
│ ├── PerSiloGrainExample.cs
│ ├── CalculatorService.Orleans.csproj
│ └── CalculatorServiceHost.cs
├── Gigya.Microdot.Interfaces
├── paket.references
├── IMetricsInitializer.cs
├── Logging
│ └── IStackTraceEnhancer.cs
├── Events
│ ├── IEventSerializer.cs
│ ├── SerializedEventField.cs
│ ├── EventConfiguration.cs
│ └── IEventPublisher.cs
├── paket.template
├── Gigya.Microdot.Interfaces.csproj
├── Configuration
│ ├── IConfigObject.cs
│ └── IConfigItem.cs
├── IMetricsSettings.cs
├── IApplicationDirectoryProvider.cs
└── ICacheRevoker.cs
├── Metrics
├── Properties
│ └── AssemblyInfo.cs
├── metrics_32.png
├── Endpoints
│ ├── index.full.html.gz
│ ├── MetricsEndpointRequest.cs
│ ├── MetricsEndpointHandler.cs
│ ├── AbstractMetricsEndpointHandler.cs
│ └── MetricsEndpoint.cs
├── paket.references
├── Utils
│ ├── TaskEx.cs
│ ├── IHideObjectMembers.cs
│ └── HostResolver.cs
├── Sampling
│ ├── Reservoir.cs
│ ├── Snapshot.cs
│ └── UserValueWrapper.cs
├── TimeUnit.cs
├── Reporters
│ ├── MetricsReport.cs
│ ├── ConsoleReport.cs
│ ├── StringReport.cs
│ └── TextFileReport.cs
├── paket.template
├── Json
│ ├── JsonMetric.cs
│ ├── JsonObject.cs
│ ├── JsonBuilderV2.cs
│ └── JsonGauge.cs
├── MetricData
│ ├── EnvironmentEntry.cs
│ ├── GaugeValue.cs
│ ├── ConstantValue.cs
│ └── MetricsDataProvider.cs
├── ResetableMetric.cs
├── Core
│ ├── DefaultMetricsContext.cs
│ ├── MetricsBuilder.cs
│ └── MetricsRegistry.cs
├── Histogram.cs
├── Metrics.csproj
├── App_Packages
│ └── HdrHistogram
│ │ ├── Iterable.cs
│ │ └── AbstractHistogramEnumerableExtensions.cs
└── RemoteMetrics
│ ├── RemoteMetricsExtensions.cs
│ └── HttpRemoteMetrics.cs
├── Gigya.Microdot.Logging.NLog
├── paket.references
├── Properties
│ └── AssemblyInfo.cs
├── paket.template
├── Gigya.Microdot.Logging.NLog.csproj
└── LogEventPublisher.cs
├── Gigya.Microdot.Testing
├── README.txt
├── paket.references
└── paket.template
├── Gigya.Microdot.Fakes
├── paket.references
├── paket.template
├── ConsoleLogLoggersModules.cs
├── Gigya.Microdot.Fakes.csproj
├── MetricsInitializerFake.cs
└── Properties
│ └── AssemblyInfo.cs
├── dockerfile
├── Gigya.Microdot.UnitTests
└── TestCert
│ ├── TestRootCA.pfx
│ ├── TestClientCer.pfx
│ ├── TestServerCer.pfx
│ ├── OtherTestRootCA.pfx
│ ├── OtherTestClientCer.pfx
│ └── OtherTestServerCer.pfx
├── Gigya.Microdot.ServiceDiscovery
├── Rewrite
│ └── _diagram.png
├── paket.references
├── AvailabilityZoneServiceDiscovery
│ ├── DBKeyValue.cs
│ └── AvailabilityZoneInfo.cs
├── IServiceDiscoverySource.cs
├── paket.template
├── Gigya.Microdot.ServiceDiscovery.csproj
├── ServiceDiscoveryAssembly.cs
└── ConsulContracts.cs
├── Gigya.Microdot.Testing.Shared
├── paket.references
├── README.txt
├── App.config
└── paket.template
├── Gigya.Microdot.Common.Tests
├── paket.references
├── Properties
│ └── AssemblyInfo.cs
├── DummyCertificateLocator.cs
├── FakesLoggersModules.cs
├── Gigya.Microdot.Common.Tests.csproj
└── SpyEventPublisher.cs
├── Gigya.Microdot.Ninject.Host
├── paket.references
├── App.config
├── paket.template
├── Gigya.Microdot.Ninject.Host.csproj
└── Properties
│ └── AssemblyInfo.cs
├── Gigya.Microdot.Hosting
├── app.config
├── paket.references
├── Validators
│ ├── IValidator.cs
│ └── ServiceValidator.cs
├── paket.template
├── Metrics
│ └── MetricsConfiguration.cs
├── Environment
│ └── ApplicationInfoSource.cs
├── Gigya.Microdot.Hosting.csproj
├── HttpService
│ ├── IWarmup.cs
│ ├── IWorker.cs
│ ├── IActivator.cs
│ └── InvocationResult.cs
├── HostingAssembly.cs
└── Service
│ └── ServiceWarmup.cs
├── Gigya.Microdot.Ninject
├── paket.references
├── paket.template
├── ConfigEventFactory.cs
├── Gigya.Microdot.Ninject.csproj
├── RegexTimeoutInitializer.cs
└── Properties
│ └── AssemblyInfo.cs
├── .config
└── dotnet-tools.json
├── Gigya.Microdot.Configuration
├── paket.references
├── paket.template
├── Objects
│ ├── IConfigObjectsCache.cs
│ └── ConfigObjectsCache.cs
├── Gigya.Microdot.Configuration.csproj
├── Properties
│ └── AssemblyInfo.cs
├── ConfigurationAssembly.cs
├── IConfigurationDataWatcher.cs
├── ConfigDecryptor.cs
└── IConfigEventFactory.cs
├── test.runsettings
├── Gigya.Microdot.SharedLogic
├── paket.references
├── paket.template
├── Measurement
│ ├── Workload
│ │ ├── IWorkloadMetrics.cs
│ │ └── CpuUsageCounterByProcess.cs
│ └── IMeasurement.cs
├── Events
│ └── IEventFactory.cs
├── ServcieShutdownSource.cs
├── Gigya.Microdot.SharedLogic.csproj
├── Utils
│ ├── System.Diagnostics.cs
│ └── ObjectPool.cs
├── Rewrite
│ └── Node.cs
├── HttpService
│ ├── ServiceReachabilityStatus.cs
│ └── ICertificateLocator.cs
├── SharedLogicAssembly.cs
├── Exceptions
│ └── StripHttpRequestExceptionConverter.cs
└── PortOffsets.cs
├── Gigya.Microdot.ServiceProxy
├── Caching
│ ├── RevokeNotifier
│ │ ├── IRevokeKey.cs
│ │ ├── IRevokeContextConcurrentCollectionFactory.cs
│ │ ├── IRevokeKeyIndexerFactory.cs
│ │ ├── RevokeNotifierConfig.cs
│ │ ├── IRevokeNotifier.cs
│ │ ├── IRevokeKeyIndexer.cs
│ │ └── IRevokeContextConcurrentCollection.cs
│ ├── ICachingProxyProvider.cs
│ ├── CacheConfig.cs
│ ├── IRevokeListener.cs
│ ├── ICache.cs
│ └── EmptyRevokeListener.cs
├── CoreFX
│ └── _Readme.txt
├── paket.references
├── paket.template
├── Gigya.Microdot.ServiceProxy.csproj
└── ServiceProxyAssembly.cs
├── .reuse
└── dep5
├── Gigya.Microdot.LanguageExtensions
├── paket.template
└── Gigya.Microdot.LanguageExtensions.csproj
├── main.ruleset
├── Gigya.Microdot.Orleans.Hosting
├── paket.template
├── OrleansConfigurationBuilderNoopConfigurator.cs
├── GrainLoggingConfig.cs
├── Gigya.Microdot.Orleans.Hosting.csproj
├── IOrleansConfigurationBuilderConfigurator.cs
├── paket.references
├── OrleansHostingAssembly.cs
├── ExcludeGrainFromStatisticsAttribute.cs
└── IOrleansToNinjectBinding.cs
├── Directory.Build.props
├── Gigya.Microdot.Orleans.Ninject.Host
├── paket.references
├── paket.template
├── app.config
└── Gigya.Microdot.Orleans.Ninject.Host.csproj
└── Changelog.md
/tests/Gigya.Microdot.UnitTests/loadpaths.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/Gigya.ServiceContract/paket.references:
--------------------------------------------------------------------------------
1 | Newtonsoft.Json
--------------------------------------------------------------------------------
/Sample/CalculatorService/paket.references:
--------------------------------------------------------------------------------
1 | Ninject
2 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/paket.references:
--------------------------------------------------------------------------------
1 | Newtonsoft.Json
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/loadPaths.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/loadPaths.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/Metrics/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Interface/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
--------------------------------------------------------------------------------
/Gigya.Microdot.Logging.NLog/paket.references:
--------------------------------------------------------------------------------
1 | NLog
2 | Ninject
3 | System.Net.Http
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/paket.references:
--------------------------------------------------------------------------------
1 | Ninject
2 | Ninject.Extensions.Factory
3 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing/README.txt:
--------------------------------------------------------------------------------
1 | The project contains logic for only Orleans host testers.
2 |
--------------------------------------------------------------------------------
/Metrics/metrics_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Metrics/metrics_32.png
--------------------------------------------------------------------------------
/Sample/CalculatorService/loadPaths.json:
--------------------------------------------------------------------------------
1 | [
2 | { "Pattern": ".\\*.config", "Priority": 1 }
3 | ]
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/loadPaths.json:
--------------------------------------------------------------------------------
1 | [
2 | { "Pattern": ".\\*.config", "Priority": 1 }
3 | ]
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/loadPaths.json:
--------------------------------------------------------------------------------
1 | [
2 | { "Pattern": ".\\*.config", "Priority": 1 }
3 | ]
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/paket.references:
--------------------------------------------------------------------------------
1 | Ninject
2 | System.Net.Http
3 | System.Threading.Tasks.Dataflow
4 |
--------------------------------------------------------------------------------
/dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903
2 |
3 | SHELL ["powershell.exe", "-Command"]
--------------------------------------------------------------------------------
/Metrics/Endpoints/index.full.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Metrics/Endpoints/index.full.html.gz
--------------------------------------------------------------------------------
/Gigya.ServiceContract/.paket/paket.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.ServiceContract/.paket/paket.exe
--------------------------------------------------------------------------------
/Gigya.ServiceContract/.paket/update.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d %~dp0
3 | paket.bootstrapper.exe
4 | paket.exe update
5 | echo.
6 | echo.
7 | pause
--------------------------------------------------------------------------------
/Metrics/paket.references:
--------------------------------------------------------------------------------
1 | System.Diagnostics.PerformanceCounter
2 | LibLog
3 | Microsoft.CSharp
4 | System.Configuration.ConfigurationManager
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/TestRootCA.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/TestRootCA.pfx
--------------------------------------------------------------------------------
/Gigya.ServiceContract/.paket/restore.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d %~dp0
3 | paket.bootstrapper.exe
4 | paket.exe restore
5 | echo.
6 | echo.
7 | pause
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Ninject
3 | Microsoft.Orleans.Client
4 | Microsoft.CSharp
5 | System.Net.Http
6 |
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/TestClientCer.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/TestClientCer.pfx
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/TestServerCer.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/TestServerCer.pfx
--------------------------------------------------------------------------------
/Gigya.ServiceContract/.paket/paket.bootstrapper.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.ServiceContract/.paket/paket.bootstrapper.exe
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/Rewrite/_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.ServiceDiscovery/Rewrite/_diagram.png
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing.Shared/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Ninject
3 | System.Threading.Tasks.Dataflow
4 | Microsoft.CSharp
5 | System.Net.Http
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.pfx
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestRootCA.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestRootCA.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestRootCA.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestRootCA.pvk
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.pfx
--------------------------------------------------------------------------------
/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.pfx
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestRootCA.pvk
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestClientCer.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestClientCer.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestClientCer.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestClientCer.pvk
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestServerCer.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestServerCer.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/TestServerCer.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/TestServerCer.pvk
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/paket.references:
--------------------------------------------------------------------------------
1 | NSubstitute
2 | Ninject
3 | System.Threading.Tasks.Dataflow
4 | System.Data.DataSetExtensions
5 | Microsoft.CSharp
6 | System.Net.Http
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestClientCer.pvk
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.cer
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.pvk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gigya/microdot/HEAD/tests/Gigya.Microdot.UnitTests/TestCert/OtherTestServerCer.pvk
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing.Shared/README.txt:
--------------------------------------------------------------------------------
1 | The project contains logic for both Orleans and Non-Orleans host testers.
2 | Pay attention to not include any direct or in-direct Orleans references.
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject.Host/paket.references:
--------------------------------------------------------------------------------
1 | Ninject
2 | Ninject.Extensions.Conventions
3 | Ninject.Extensions.Factory
4 | System.Threading.Tasks.Dataflow
5 | Microsoft.CSharp
6 | System.Net.Http
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.ServiceContract.UnitTests/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Newtonsoft.Json
3 | NUnit
4 | NUnit3TestAdapter
5 | Shouldly
6 | System.ComponentModel.Annotations
7 | Microsoft.NET.Test.Sdk
--------------------------------------------------------------------------------
/Gigya.ServiceContract/paket.dependencies:
--------------------------------------------------------------------------------
1 | source https://api.nuget.org/v3/index.json
2 |
3 | framework: auto-detect
4 | redirects: off
5 | content: once
6 | copy_content_to_output_dir: always
7 |
8 | nuget Newtonsoft.Json >= 12
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/IMetricsInitializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.Microdot.Interfaces
4 | {
5 | public interface IMetricsInitializer: IDisposable
6 | {
7 | void Init();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Ninject
3 | Ninject.Extensions.Conventions
4 | Ninject.Extensions.Factory
5 | System.Threading.Tasks.Dataflow
6 | Castle.Core
7 | Microsoft.CSharp
8 | System.Net.Http
9 |
--------------------------------------------------------------------------------
/Metrics/Utils/TaskEx.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Metrics.Utils
4 | {
5 | internal static class TaskEx
6 | {
7 | public static readonly Task CompletedTask = Task.FromResult(0);
8 | }
9 | }
--------------------------------------------------------------------------------
/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "paket": {
6 | "version": "5.258.1",
7 | "commands": [
8 | "paket"
9 | ]
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject.Host/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing.Shared/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Gigya.ServiceContract/paket.lock:
--------------------------------------------------------------------------------
1 | REDIRECTS: OFF
2 | COPY-CONTENT-TO-OUTPUT-DIR: ALWAYS
3 | CONTENT: ONCE
4 | RESTRICTION: == netstandard2.0
5 | NUGET
6 | remote: https://api.nuget.org/v3/index.json
7 | Newtonsoft.Json (12.0.3)
8 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/paket.references:
--------------------------------------------------------------------------------
1 | Ninject
2 | Microsoft.Orleans.CodeGenerator.MsBuild
3 | Microsoft.Orleans.Core
4 |
5 | # Solve binding redirect issue, related to project vs nuget references. OrleansDashboard depends on.
6 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/Discovery.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | System.Threading.Tasks.Dataflow
3 | Newtonsoft.Json
4 | System.ComponentModel.Annotations
5 | System.Configuration.ConfigurationManager
6 |
7 | Microsoft.CSharp
8 | System.Net.Http
9 |
--------------------------------------------------------------------------------
/test.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | x64
6 |
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Newtonsoft.Json
3 | System.ComponentModel.Annotations
4 | System.Diagnostics.PerformanceCounter
5 | System.Net.Http
6 | System.Threading.Tasks.Dataflow
7 | System.ValueTuple
8 | Microsoft.CSharp
9 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Logging.NLog/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // The following GUID is for the ID of the typelib if this project is exposed to COM
5 | [assembly: Guid("06e45085-5a54-4bfe-bd24-e9c3983a2689")]
6 |
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Nito.AsyncEx
3 | Newtonsoft.Json
4 | Microsoft.CSharp
5 | System.Collections.Immutable
6 | System.ComponentModel.Annotations
7 | System.Net.Http
8 | System.Threading.Tasks.Dataflow
9 | System.ValueTuple
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
5 | {
6 | public interface IRevokeKey
7 | {
8 | Task OnKeyRevoked(string key);
9 | }
10 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/CoreFX/_Readme.txt:
--------------------------------------------------------------------------------
1 | Classes in this folder are borrowed from CoreFX (.NET Core's Libraries) git repository:
2 | https://github.com/dotnet/corefx/tree/master/src/
3 | When migrating this codebase to .NET Core, these classes can be removed since they will be included with the CoreFX.
--------------------------------------------------------------------------------
/Metrics/Sampling/Reservoir.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace Metrics.Sampling
4 | {
5 | public interface Reservoir
6 | {
7 | void Update(long value, string userValue = null);
8 | Snapshot GetSnapshot(bool resetReservoir = false);
9 | void Reset();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeContextConcurrentCollectionFactory.cs:
--------------------------------------------------------------------------------
1 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
2 | {
3 | public interface IRevokeContextConcurrentCollectionFactory
4 | {
5 | IRevokeContextConcurrentCollection Create();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Newtonsoft.Json
3 | Nito.AsyncEx
4 | System.Collections.Immutable
5 | System.Threading.Tasks.Dataflow
6 | System.ValueTuple
7 | System.ComponentModel.Annotations
8 | System.Net.Http
9 | System.Runtime.Caching
10 | System.Reflection.Emit
11 |
--------------------------------------------------------------------------------
/Metrics/TimeUnit.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics
3 | {
4 | public enum TimeUnit
5 | {
6 | Nanoseconds = 0,
7 | Microseconds = 1,
8 | Milliseconds = 2,
9 | Seconds = 3,
10 | Minutes = 4,
11 | Hours = 5,
12 | Days = 6
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.reuse/dep5:
--------------------------------------------------------------------------------
1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2 | Upstream-Name: Microdot
3 | Upstream-Contact: Daniel Lamberger
4 | Source: https://github.com/gigya/microdot
5 |
6 | Files: *
7 | Copyright: 2020 SAP SE or an SAP affiliate company
8 | License: Apache-2.0
9 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Newtonsoft.Json
3 | System.Threading.Tasks.Dataflow
4 | System.Collections.Immutable
5 | System.ValueTuple
6 | Microsoft.Orleans.Core.Abstractions
7 | System.ComponentModel.Annotations
8 | System.Net.Http
9 | System.ServiceProcess.ServiceController
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.LanguageExtensions/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Language and system library extensions for Microdot
5 | projectUrl
6 | https://github.com/gigya/microdot
7 | licenseUrl
8 | https://github.com/gigya/microdot/blob/master/LICENSE.md
9 | tags
10 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/main.ruleset:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Tools to help write tests for Microdot services.
5 | projectUrl
6 | https://github.com/gigya/microdot
7 | licenseUrl
8 | https://github.com/gigya/microdot/blob/master/LICENSE.md
9 | tags
10 | gigya microdot microservice microservices fakes mocks mocking unit-testing
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Logging/IStackTraceEnhancer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Gigya.Microdot.Interfaces.Logging
5 | {
6 | public interface IStackTraceEnhancer
7 | {
8 | string Clean(string stackTrace);
9 | JObject ToJObjectWithBreadcrumb(Exception exception);
10 | }
11 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Validators/IValidator.cs:
--------------------------------------------------------------------------------
1 | namespace Gigya.Microdot.Hosting.Validators
2 | {
3 | ///
4 | /// When service is started, validates that the service is Ok to run, and throws an exception if not
5 | ///
6 | public interface IValidator
7 | {
8 | void Validate();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Infrastructure used for hosting Microdot services, part of the Microdot
5 | framework.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/Gigya.Microdot.Logging.NLog/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | An implementation of Microdot's logging and tracing using NLog.
5 | projectUrl
6 | https://github.com/gigya/microdot
7 | licenseUrl
8 | https://github.com/gigya/microdot/blob/master/LICENSE.md
9 | tags
10 | gigya microdot microservice microservices NLog logging tracing
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeKeyIndexerFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
6 | {
7 | public interface IRevokeKeyIndexerFactory
8 | {
9 | IRevokeKeyIndexer Create();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/RevokeNotifierConfig.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Interfaces.Configuration;
2 |
3 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
4 | {
5 | public class RevokeNotifierConfig: IConfigObject
6 | {
7 | public int CleanupIntervalInSec { get; set; } = 10*60;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Various components and utilities shared between different parts of the Microdot framework.
5 | projectUrl
6 | https://github.com/gigya/microdot
7 | licenseUrl
8 | https://github.com/gigya/microdot/blob/master/LICENSE.md
9 | tags
10 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Events/IEventSerializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Gigya.Microdot.Interfaces.Events
5 | {
6 |
7 | public interface IEventSerializer
8 | {
9 | IEnumerable Serialize(IEvent evt, Func predicate = null);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Infrastructure used for hosting Orleans Microdot services, part of the
5 | Microdot framework.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/Metrics/Reporters/MetricsReport.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Metrics.MetricData;
4 |
5 | namespace Metrics.Reporters
6 | {
7 | public interface MetricsReport : Utils.IHideObjectMembers
8 | {
9 | void RunReport(MetricsData metricsData, Func healthStatus, CancellationToken token);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Metrics/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Infrastructure used for hosting Orleans Microdot services, part of the
5 | Microdot framework.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices
12 | authors
13 | metrics.net
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Measurement/Workload/IWorkloadMetrics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gigya.Microdot.SharedLogic.Measurement.Workload
8 | {
9 | public interface IWorkloadMetrics : IDisposable
10 | {
11 | void Init();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Ninject modules, providers and binding resolvers for various Microdot
5 | components, part of the Microdot framework.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices ninject ioc di
--------------------------------------------------------------------------------
/Metrics/Json/JsonMetric.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics.Json
3 | {
4 | public class JsonMetric
5 | {
6 | private string[] tags = MetricTags.None.Tags;
7 |
8 | public string Name { get; set; }
9 | public string Unit { get; set; }
10 | public string[] Tags { get { return this.tags; } set { this.tags = value ?? new string[0]; } }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Gigya.Microdot.LanguageExtensions/Gigya.Microdot.LanguageExtensions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.LanguageExtensions
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Tools to help write tests for Microdot services.
5 | The project contains logic for Orleans host testers.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices fakes mocks mocking unit-testing
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/NonOrleansMicroService/CalculatorService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Gigya.Microdot.Hosting.UnitTests.NonOrleansMicroService
4 | {
5 | public class CalculatorService : ICalculatorService
6 | {
7 | public Task Add(int a, int b)
8 | {
9 | return Task.FromResult(a + b);
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Gigya.ServiceContract/Attributes/LogFieldsAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.ServiceContract.Attributes
4 | {
5 | /// Mark the parameter as containing log field data
6 | /// by providing this attribute the class will be dissects into properties.
7 | ///
8 | [AttributeUsage(AttributeTargets.Parameter)]
9 | public class LogFieldsAttribute : Attribute { }
10 | }
--------------------------------------------------------------------------------
/Metrics/MetricData/EnvironmentEntry.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics.MetricData
3 | {
4 | public struct EnvironmentEntry
5 | {
6 | public readonly string Name;
7 | public readonly string Value;
8 |
9 | public EnvironmentEntry(string name, string value)
10 | {
11 | this.Name = name;
12 | this.Value = value;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Metrics/MetricsConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Gigya.Microdot.Interfaces.Configuration;
3 |
4 | namespace Gigya.Microdot.Hosting.Metrics
5 | {
6 | [ConfigurationRoot("Metrics", RootStrategy.ReplaceClassNameWithPath)]
7 | public class MetricsConfiguration: IConfigObject
8 | {
9 | public TimeSpan InitializationTimeout { get; set; } = TimeSpan.FromSeconds(5);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | Gigya Inc.
4 | © 2020 Gigya Inc.
5 | Microdot Framework
6 | Microdot Framework
7 |
8 | 3.3.28
9 | $(SolutionDir)\test.runsettings
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Ninject.Host/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Microsoft.Extensions.DependencyInjection
3 | Microsoft.Extensions.DependencyInjection.Abstractions
4 | Microsoft.Orleans.Core
5 | Microsoft.Orleans.OrleansRuntime
6 | Microsoft.Orleans.OrleansProviders
7 | Ninject
8 | Ninject.Extensions.Conventions
9 | Ninject.Extensions.Factory
10 | Microsoft.Orleans.Server
11 |
12 | Microsoft.CSharp
13 | System.Net.Http
--------------------------------------------------------------------------------
/Gigya.Microdot.Testing.Shared/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Tools to help write tests for Microdot services.
5 | The project contains logic for both Orleans and Non-Orleans host testers.
6 | projectUrl
7 | https://github.com/gigya/microdot
8 | licenseUrl
9 | https://github.com/gigya/microdot/blob/master/LICENSE.md
10 | tags
11 | gigya microdot microservice microservices fakes mocks mocking unit-testing
--------------------------------------------------------------------------------
/Gigya.ServiceContract/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Referenced by microservice public-facing interfaces. Provides common
5 | facilities that are needed to define a service's contract. Part of the
6 | Microdot framework.
7 | projectUrl
8 | https://github.com/gigya/microdot
9 | licenseUrl
10 | https://github.com/gigya/microdot/blob/master/LICENSE.md
11 | tags
12 | gigya microdot microservice microservices contracts
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/AvailabilityZoneServiceDiscovery/DBKeyValue.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Gigya.Microdot.ServiceDiscovery.AvailabilityZoneServiceDiscovery
4 | {
5 | internal class DbKeyValue
6 | {
7 | [JsonProperty("serviceZone")]
8 | public string ServiceZone { get; set; }
9 |
10 | [JsonProperty("consulZone")]
11 | public string ConsulZone { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Events/IEventFactory.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Interfaces.Events;
2 |
3 | namespace Gigya.Microdot.SharedLogic.Events
4 | {
5 | ///
6 | ///
7 | public interface IEventFactory where T : IEvent
8 | {
9 | ///
10 | /// Creates the concrete event with contextual fields (callId, application info, etc).
11 | ///
12 | T CreateEvent();
13 | }
14 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Interface abstractions used by various Microdot components, seperated from
5 | their implementations to allow easy unit testing with mocks (see
6 | Gigya.Microdot.Fakes). Part of the Microdot Framework.
7 | projectUrl
8 | https://github.com/gigya/microdot
9 | licenseUrl
10 | https://github.com/gigya/microdot/blob/master/LICENSE.md
11 | tags
12 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/Metrics/ResetableMetric.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics
3 | {
4 | ///
5 | /// Indicates a metric's ability to be reset. Reseting a metric clear all currently collected data.
6 | ///
7 | public interface ResetableMetric : Utils.IHideObjectMembers
8 | {
9 | ///
10 | /// Clear all currently collected data for this metric.
11 | ///
12 | void Reset();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Metrics/Reporters/ConsoleReport.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Metrics.Reporters
4 | {
5 | public class ConsoleReport : HumanReadableReport
6 | {
7 | protected override void StartReport(string contextName)
8 | {
9 | Console.Clear();
10 | }
11 |
12 | protected override void WriteLine(string line, params string[] args)
13 | {
14 | Console.WriteLine(line, args);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeNotifier.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
5 | {
6 | public interface IRevokeNotifier
7 | {
8 | void NotifyOnRevoke(object @this, IRevokeKey revokeKey, params string[] revokeKeys);
9 | void RemoveNotifications(object @this, params string[] revokeKeys);
10 | void RemoveAllNotifications(object @this);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Metrics/MetricData/GaugeValue.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics.MetricData
3 | {
4 | ///
5 | /// Combines the value of a gauge (a double) with the defined unit for the value.
6 | ///
7 | public sealed class GaugeValueSource : MetricValueSource
8 | {
9 | public GaugeValueSource(string name, MetricValueProvider value, Unit unit, MetricTags tags)
10 | : base(name, value, unit, tags)
11 | { }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | FluentAssertions
3 | NSubstitute
4 | NUnit
5 | NUnit3TestAdapter
6 | RichardSzalay.MockHttp
7 | Shouldly
8 | Ninject
9 | System.Threading.Tasks.Dataflow
10 | Castle.Core
11 | Microsoft.Orleans.Core
12 | System.ComponentModel.Annotations
13 | System.Net.Http
14 | System.Runtime.Caching
15 | Microsoft.CSharp
16 | Microsoft.NET.Test.Sdk
17 |
18 | # Remove after the transition to netcore completed
19 | System.ServiceProcess.ServiceController
20 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject.Host/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | A container used to host non-Orleans Microdot service which uses Ninject
5 | for dependency injection. Incoming HTTP calls (via Gigya.Microdot.ServiceProxy)
6 | are dispatched to a specified class instance. Part of the Microdot framework.
7 | projectUrl
8 | https://github.com/gigya/microdot
9 | licenseUrl
10 | https://github.com/gigya/microdot/blob/master/LICENSE.md
11 | tags
12 | gigya microdot microservice microservices ninject ioc di
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/OrleansConfigurationBuilderNoopConfigurator.cs:
--------------------------------------------------------------------------------
1 | using Orleans.Hosting;
2 |
3 | namespace Gigya.Microdot.Orleans.Hosting
4 | {
5 | public class OrleansConfigurationBuilderNoopConfigurator : IOrleansConfigurationBuilderConfigurator
6 | {
7 | public void PreInitializationConfiguration(SiloHostBuilder siloHostBuilder)
8 | {
9 | }
10 |
11 | public void PostInitializationConfiguration(SiloHostBuilder siloHostBuilder)
12 | {
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeKeyIndexer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
4 | {
5 | public interface IRevokeKeyIndexer
6 | {
7 | IEnumerable GetLiveRevokeesAndSafelyRemoveDeadOnes(string revokeKey);
8 | void AddRevokeContext(string key, RevokeContext newContext);
9 | bool Remove(object @this, string key);
10 | void Remove(object @this);
11 | void Cleanup();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | ServiceProxy is used to call remote Microdot services. It is a
5 | runtime-generated transparent proxy which implements the remote service's
6 | public interface, translating all calls performed on it to HTTP calls.
7 | Part of the Microdot framework.
8 | projectUrl
9 | https://github.com/gigya/microdot
10 | licenseUrl
11 | https://github.com/gigya/microdot/blob/master/LICENSE.md
12 | tags
13 | gigya microdot microservice microservices serviceproxy http rpc
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // Setting ComVisible to false makes the types in this assembly not visible
5 | // to COM components. If you need to access a type in this assembly from
6 | // COM, set the ComVisible attribute to true on that type.
7 | [assembly: ComVisible(false)]
8 |
9 | // The following GUID is for the ID of the typelib if this project is exposed to COM
10 | [assembly: Guid("0a24ae97-ee88-4e8b-8b92-092884d41399")]
11 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Ninject.Host/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | A container used to host an Orleans Microdot service which uses Ninject for
5 | dependency injection. Incoming HTTP calls (via Gigya.Microdot.ServiceProxy)
6 | are handled and processed inside Orleans and are then dispatched to
7 | specific Grains. Part of the Microdot framework.
8 | projectUrl
9 | https://github.com/gigya/microdot
10 | licenseUrl
11 | https://github.com/gigya/microdot/blob/master/LICENSE.md
12 | tags
13 | gigya microdot microservice microservices
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Validators/ServiceValidator.cs:
--------------------------------------------------------------------------------
1 | namespace Gigya.Microdot.Hosting.Validators
2 | {
3 | public class ServiceValidator
4 | {
5 | private readonly IValidator[] _validators;
6 |
7 | public ServiceValidator(IValidator[] validators)
8 | {
9 | _validators = validators;
10 | }
11 |
12 | public void Validate()
13 | {
14 | foreach (var validator in _validators)
15 | {
16 | validator.Validate();
17 | }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Sample/CalculatorService/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Sample/CalculatorService/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("5b1ba713-f5ba-466b-b79e-95261db27fa9")]
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("47cbf637-ab8f-4568-86d6-eab6ef08b9ce")]
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | A configuration system based on a hierarchy of XML files, the values of
5 | which are accessed using strongly-typed configuration objects. Supports
6 | modification of the files on live service, environment variable substitution,
7 | encryption and collections. Part of the Microdot framework.
8 | projectUrl
9 | https://github.com/gigya/microdot
10 | licenseUrl
11 | https://github.com/gigya/microdot/blob/master/LICENSE.md
12 | tags
13 | gigya microdot microservice microservices configuration
14 |
--------------------------------------------------------------------------------
/Gigya.ServiceContract/Gigya.ServiceContract.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0
4 | Gigya.ServiceContract
5 | Gigya
6 | Gigya.ServiceContract
7 | © 2017 Gigya Inc.
8 | 2.7.8
9 | 2.7.8
10 | 2.7.8
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("bcd894c2-29b3-4c76-8e5d-5781a5a10c67")]
12 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Interface/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("1fb8e464-6a36-44a2-a343-8e95b51b4542")]
12 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("10e10fde-8a2c-4d5d-8fc1-15facf844e80")]
12 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.ServiceContract.UnitTests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | True
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/Objects/IConfigObjectsCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Gigya.Microdot.Interfaces;
7 |
8 | namespace Gigya.Microdot.Configuration.Objects
9 | {
10 | public interface IConfigObjectsCache
11 | {
12 | void RegisterConfigObjectCreator(IConfigObjectCreator configObjectCreator);
13 | void DecryptAndReloadConfigObjects(Func configDecryptor, Func isValidEncryptedStringFormat);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Metrics/Endpoints/MetricsEndpointRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Metrics.Endpoints
5 | {
6 | public class MetricsEndpointRequest
7 | {
8 | public readonly IDictionary Headers;
9 |
10 | public MetricsEndpointRequest(IDictionary headers)
11 | {
12 | if (headers == null)
13 | {
14 | throw new ArgumentNullException(nameof(headers));
15 | }
16 |
17 | this.Headers = headers;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/RevokeNotifier/IRevokeContextConcurrentCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Gigya.Microdot.ServiceProxy.Caching.RevokeNotifier
4 | {
5 | public interface IRevokeContextConcurrentCollection : IEnumerable
6 | {
7 | bool IsEmpty { get;}
8 | IRevokeContextConcurrentCollection MergeMissingEntriesWith(IRevokeContextConcurrentCollection other);
9 | void Insert(RevokeContext context);
10 | bool RemoveEntryMatchingObject(object obj);
11 |
12 | int Cleanup();
13 | }
14 |
15 |
16 |
17 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/ServcieShutdownSource.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 |
3 | namespace Gigya.Microdot.SharedLogic
4 | {
5 | public interface IServiceDrainListener
6 | {
7 | CancellationToken Token { get; }
8 | }
9 |
10 | internal class ServiceDrainController :IServiceDrainListener
11 | {
12 | public CancellationTokenSource Source = new CancellationTokenSource();
13 |
14 | internal void StartDrain()
15 | {
16 | Source.Cancel();
17 | }
18 |
19 | CancellationToken IServiceDrainListener.Token => Source.Token;
20 | }
21 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Gigya.Microdot.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.Interfaces
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Ninject.Host/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | True
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/StorageProviderTest/Account.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Common.Tests;
2 | using Gigya.Microdot.Fakes.KernelUtils;
3 | using Gigya.Microdot.Ninject;
4 | using Gigya.Microdot.Orleans.Hosting;
5 | using Gigya.Microdot.Orleans.Ninject.Host;
6 | using Ninject;
7 | using Ninject.Syntax;
8 | using Orleans;
9 | using Orleans.Hosting;
10 | using Orleans.Providers;
11 | using System.Threading.Tasks;
12 |
13 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.StorageProviderTest
14 | {
15 | public class Account
16 | {
17 | public string Name { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Microsoft.Extensions.DependencyInjection
3 | Microsoft.Orleans.OrleansCodeGenerator
4 | Microsoft.Orleans.CodeGenerator.MsBuild
5 | NSubstitute
6 | NUnit
7 | NUnit3TestAdapter
8 | Ninject
9 | Shouldly
10 | Castle.Core
11 | ZooKeeperNetEx
12 | System.Threading.Tasks.Dataflow
13 | Microsoft.AspNetCore.Hosting # Solve binding redirect issue, related to project vs nuget references. OrleansDashboard depends on.
14 | Microsoft.CSharp
15 | System.Net.Http
16 | Microsoft.NET.Test.Sdk
17 |
18 | # Remove after the transition to netcore completed
19 | System.ServiceProcess.ServiceController
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | # Transition to net standard change log
2 |
3 | ## Configuration
4 |
5 | - Configuration locations file (loadPaths.json) doesn't support `$(prefix)` anymore. Use `GIGYA_CONFIG_ROOT` environment variable instead.
6 | - Default `ConfigRoot` now is now $CurrentWorkingDir/config/ instead of beging hardcoded.
7 | - Updated Newtonsoft.Json to 12.0.3
8 | - Requires VS 16.4
9 | - Host configuration is now injected into the host. Host isn't aware of environment anymore.
10 | - Configuration values aren't taken from environemnt variables anymore but are injected with host configuration.
11 | - Product information is now stored in Directory.Build.props
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | True
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Gigya.ServiceContract/Exceptions/Breadcrumb.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.ServiceContract.Exceptions
4 | {
5 | [Serializable]
6 | public class Breadcrumb
7 | {
8 | public string ServiceName { get; set; }
9 | public string ServiceVersion { get; set; }
10 | public string HostName { get; set; }
11 | public string DataCenter { get; set; }
12 | public string DeploymentEnvironment { get; set; }
13 |
14 | public override string ToString()
15 | {
16 | return $"{ServiceName} v{ServiceVersion} on {HostName} in {DataCenter}-{DeploymentEnvironment}";
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.ServiceContract.UnitTests/Gigya.Microdot.ServiceContract.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | true
6 | true
7 | $(SolutionDir)main.ruleset
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Serialization/BusinessEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.Microdot.UnitTests.Serialization
4 | {
5 | public interface IBusinessEntity
6 | {
7 | string Name { get; set; }
8 | int Number { get; set; }
9 | }
10 |
11 | [Serializable]
12 | public class BusinessEntity : IBusinessEntity
13 | {
14 | public string Name { get; set; }
15 | public int Number { get; set; }
16 |
17 | public override bool Equals(object obj)
18 | {
19 | BusinessEntity other = (BusinessEntity)obj;
20 | return Name == other.Name && Number == other.Number;
21 | }
22 |
23 | public override int GetHashCode() { unchecked { return 0; } }
24 | }
25 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/ICachingProxyProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Gigya.Microdot.ServiceProxy.Caching
2 | {
3 | public interface ICachingProxyProvider
4 | {
5 | ///
6 | /// The instance of the actual data source, used when the data is not present in the cache.
7 | ///
8 | TInterface DataSource { get; }
9 |
10 | ///
11 | /// The instance of the transparent proxy used to access the data source with caching.
12 | ///
13 | ///
14 | /// This is a thread-safe instance.
15 | ///
16 | TInterface Proxy { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/Metrics/Utils/IHideObjectMembers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace Metrics.Utils
5 | {
6 | ///
7 | /// Helper interface to cleanup editor visible members on metrics.
8 | ///
9 | public interface IHideObjectMembers
10 | {
11 | [EditorBrowsable(EditorBrowsableState.Never)]
12 | bool Equals(object obj);
13 | [EditorBrowsable(EditorBrowsableState.Never)]
14 | int GetHashCode();
15 | [EditorBrowsable(EditorBrowsableState.Never)]
16 | Type GetType();
17 | [EditorBrowsable(EditorBrowsableState.Never)]
18 | string ToString();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Gigya.Microdot.SharedLogic.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.SharedLogic
6 | 8.0
7 | $(SolutionDir)main.ruleset
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Metrics/Core/DefaultMetricsContext.cs:
--------------------------------------------------------------------------------
1 |
2 | using Metrics.Core;
3 | using Metrics.Utils;
4 | namespace Metrics
5 | {
6 | public sealed class DefaultMetricsContext : BaseMetricsContext
7 | {
8 | public DefaultMetricsContext()
9 | : this(string.Empty) { }
10 |
11 | public DefaultMetricsContext(string context)
12 | : base(context, new DefaultMetricsRegistry(), new DefaultMetricsBuilder(), () => Clock.Default.UTCDateTime)
13 | { }
14 |
15 | protected override MetricsContext CreateChildContextInstance(string contextName)
16 | {
17 | return new DefaultMetricsContext(contextName);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Utils/System.Diagnostics.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | // ReSharper disable CheckNamespace
4 | namespace System.Diagnostics
5 | {
6 | public static class ProcessExtensions
7 | {
8 |
9 | ///
10 | /// Enumerates the indexes of cores assgined to the current process by CPU affinity.
11 | ///
12 | public static IEnumerable ProcessorAffinityList(this Process p)
13 | {
14 | var mask = (ulong)p.ProcessorAffinity.ToInt64();
15 | for (var i = 0; i < 64; i++)
16 | if ((mask & 1ul << i) > 0)
17 | yield return i;
18 | }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | True
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/DummyCertificateLocator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security.Cryptography;
3 | using System.Security.Cryptography.X509Certificates;
4 | using Gigya.Microdot.SharedLogic.HttpService;
5 |
6 | namespace Gigya.Microdot.Common.Tests
7 | {
8 | public class DummyCertificateLocator : ICertificateLocator
9 | {
10 | public X509Certificate2 GetCertificate(string certName)
11 | {
12 | var ecdsa = ECDsa.Create(); // generate asymmetric key pair
13 | var req = new CertificateRequest("cn=foobar", ecdsa, HashAlgorithmName.SHA256);
14 | return req.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(5));
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Events/SerializedEventField.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 |
4 | namespace Gigya.Microdot.Interfaces.Events
5 | {
6 |
7 | ///
8 | /// Represents a single serialized field marked as from an
9 | /// object, or a sub-field of a collection. Beware of writing the if
10 | /// denotes it should be encrypted.
11 | ///
12 | public class SerializedEventField
13 | {
14 | public string Name;
15 | public string Value;
16 | public EventFieldAttribute Attribute;
17 |
18 | [Obsolete]
19 | public bool ShouldEncrypt; // TODO: Remove
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/ConfigEventFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks.Dataflow;
2 | using Gigya.Microdot.Configuration;
3 | using Gigya.Microdot.Interfaces.Configuration;
4 | using Ninject;
5 | using Ninject.Syntax;
6 |
7 | namespace Gigya.Microdot.Ninject
8 | {
9 | public class ConfigEventFactory : IConfigEventFactory
10 | {
11 | private readonly IResolutionRoot _resolutionRoot;
12 |
13 | public ConfigEventFactory(IResolutionRoot resolutionRoot)
14 | {
15 | _resolutionRoot = resolutionRoot;
16 | }
17 |
18 | public ISourceBlock GetChangeEvent() where T : IConfigObject
19 | {
20 | return _resolutionRoot.Get>();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/StorageProviderTest/IAccountGrain.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Common.Tests;
2 | using Gigya.Microdot.Fakes.KernelUtils;
3 | using Gigya.Microdot.Ninject;
4 | using Gigya.Microdot.Orleans.Hosting;
5 | using Gigya.Microdot.Orleans.Ninject.Host;
6 | using Ninject;
7 | using Ninject.Syntax;
8 | using Orleans;
9 | using Orleans.Hosting;
10 | using Orleans.Providers;
11 | using System.Threading.Tasks;
12 |
13 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.StorageProviderTest
14 | {
15 | public interface IAccountGrain : IGrainWithIntegerKey
16 | {
17 | Task Save(Account account);
18 |
19 | Task Get();
20 |
21 | Task Delete();
22 | }
23 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/GrainLoggingConfig.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using Gigya.Microdot.Interfaces.Configuration;
3 |
4 | namespace Gigya.Microdot.Orleans.Hosting
5 | {
6 | [ConfigurationRoot("Microdot.GrainLogging", RootStrategy.ReplaceClassNameWithPath)]
7 | public class GrainLoggingConfig : IConfigObject
8 | {
9 | public bool LogServiceGrains { get; set; } = true;
10 | public bool LogMicrodotGrains { get; set; }
11 | public bool LogOrleansGrains { get; set; }
12 |
13 | ///
14 | /// This will what present are written
15 | ///
16 | [Range(0.000000001,1)]
17 | public decimal LogRatio { get; set; } = 0.01m;
18 | }
19 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Metrics/MetricData/ConstantValue.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics.MetricData
3 | {
4 | public static class ConstantValue
5 | {
6 | public static MetricValueProvider Provider(T value)
7 | {
8 | return new ConstantValueProvider(value);
9 | }
10 |
11 | private sealed class ConstantValueProvider : MetricValueProvider
12 | {
13 | public ConstantValueProvider(T value)
14 | {
15 | this.Value = value;
16 | }
17 |
18 | public T Value { get; }
19 |
20 | public T GetValue(bool resetMetric = false)
21 | {
22 | return this.Value;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Metrics/Histogram.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Metrics
3 | {
4 | ///
5 | /// A Histogram measures the distribution of values in a stream of data: e.g., the number of results returned by a search.
6 | ///
7 | public interface Histogram : ResetableMetric
8 | {
9 | ///
10 | /// Records a value.
11 | ///
12 | /// Value to be added to the histogram.
13 | /// A custom user value that will be associated to the results.
14 | /// Useful for tracking (for example) for which id the max or min value was recorded.
15 | ///
16 | void Update(long value, string userValue = null);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Microsoft.Extensions.DependencyInjection
3 | Microsoft.Orleans.OrleansCodeGenerator
4 | Microsoft.Orleans.CodeGenerator.MsBuild
5 | Microsoft.Orleans.OrleansProviders
6 | NSubstitute
7 | NUnit
8 | NUnit3TestAdapter
9 | Ninject
10 | Shouldly
11 | Castle.Core
12 | ZooKeeperNetEx
13 | System.Threading.Tasks.Dataflow
14 | System.ValueTuple
15 | # Solve binding redirect issue, related to project vs nuget references. OrleansDashboard depends on.
16 | Microsoft.AspNetCore.Hosting
17 | Microsoft.AspNetCore.Server.Kestrel
18 | Microsoft.CSharp
19 | System.Net.Http
20 | Microsoft.NET.Test.Sdk
21 |
22 | # Remove after the transition to netcore completed
23 | System.ServiceProcess.ServiceController
--------------------------------------------------------------------------------
/Metrics/Utils/HostResolver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Net;
4 | using System.Net.Sockets;
5 |
6 | namespace Metrics.Utils
7 | {
8 | public static class HostResolver
9 | {
10 | public static IPAddress Resolve(string host)
11 | {
12 | var address = Dns.GetHostAddresses(host)
13 | .Where(a => a.AddressFamily == AddressFamily.InterNetwork)
14 | .OrderBy(a => Guid.NewGuid())
15 | .FirstOrDefault();
16 |
17 | if (address == null)
18 | {
19 | throw new InvalidOperationException("Unable to resolve host name " + host);
20 | }
21 |
22 | return address;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/IServiceDiscoverySource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Threading.Tasks.Dataflow;
4 |
5 | namespace Gigya.Microdot.ServiceDiscovery
6 | {
7 | public interface IServiceDiscoverySource : IDisposable
8 | {
9 | string SourceName { get; }
10 | bool SupportsFallback { get; }
11 | Task Init();
12 |
13 | string Deployment { get; }
14 | ISourceBlock EndPointsChanged { get; }
15 | EndPointsResult Result { get; }
16 | bool IsServiceDeploymentDefined { get; }
17 |
18 | Exception AllEndpointsUnreachable(EndPointsResult endPointsResult, Exception lastException,
19 | string lastExceptionEndPoint, string unreachableHosts);
20 | }
21 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/Gigya.Microdot.Orleans.Hosting.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.Orleans.Host
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Metrics/Sampling/Snapshot.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | namespace Metrics.Sampling
3 | {
4 | public interface Snapshot
5 | {
6 | long Count { get; }
7 | IEnumerable Values { get; }
8 | double GetValue(double quantile);
9 | long Max { get; }
10 | string MaxUserValue { get; }
11 | double Mean { get; }
12 | double Median { get; }
13 | long Min { get; }
14 | string MinUserValue { get; }
15 | double Percentile75 { get; }
16 | double Percentile95 { get; }
17 | double Percentile98 { get; }
18 | double Percentile99 { get; }
19 | double Percentile999 { get; }
20 | double StdDev { get; }
21 | int Size { get; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Logging.NLog/Gigya.Microdot.Logging.NLog.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.Logging.NLog
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/ConsoleLogLoggersModules.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Gigya.Microdot.Fakes;
3 | using Gigya.Microdot.Interfaces.Events;
4 | using Gigya.Microdot.Interfaces.Logging;
5 | using Gigya.Microdot.Ninject;
6 | using Ninject;
7 | using Ninject.Syntax;
8 |
9 | namespace Gigya.Microdot.UnitTests.Caching.Host
10 | {
11 | public class ConsoleLogLoggersModules : ILoggingModule
12 | {
13 | public void Bind(IBindingToSyntax logBinding, IBindingToSyntax eventPublisherBinding, IBindingToSyntax> logFactory)
14 | {
15 | logBinding.To();
16 |
17 | logFactory.ToMethod(c => caller => c.Kernel.Get());
18 | eventPublisherBinding.To();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/WarmupTestService/WarmupTestServiceHostWithSiloHostFake.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Fakes;
2 | using Gigya.Microdot.Interfaces;
3 | using Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.CalculatorService;
4 | using Gigya.Microdot.SharedLogic;
5 | using Ninject;
6 |
7 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.WarmupTestService
8 | {
9 | public class WarmupTestServiceHostWithSiloHostFake : CalculatorServiceHost
10 | {
11 | protected override void PreConfigure(IKernel kernel, ServiceArguments Arguments)
12 | {
13 | base.PreConfigure(kernel, Arguments);
14 | kernel.Rebind().To().InSingletonScope();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/Gigya.Microdot.Configuration.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 1591
6 | Gigya.Microdot.Configuration
7 | true
8 | $(SolutionDir)main.ruleset
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Serialization/MyServiceException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | using Gigya.Common.Contracts.Exceptions;
5 |
6 | namespace Gigya.Microdot.UnitTests.Serialization
7 | {
8 | [Serializable]
9 | public class MyServiceException : RequestException
10 | {
11 | public IBusinessEntity Entity { get; private set; }
12 |
13 | public MyServiceException(string message, IBusinessEntity entity, Tags encrypted = null, Tags unencrypted = null)
14 | : base(message, null, encrypted, unencrypted)
15 | {
16 | Entity = entity;
17 | }
18 |
19 | public MyServiceException(string message, Exception innerException) : base(message, innerException) { }
20 | public MyServiceException(SerializationInfo info, StreamingContext context) : base(info, context) { }
21 | }
22 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/FakesLoggersModules.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Gigya.Microdot.Fakes;
3 | using Gigya.Microdot.Interfaces.Events;
4 | using Gigya.Microdot.Interfaces.Logging;
5 | using Gigya.Microdot.Ninject;
6 | using Ninject;
7 | using Ninject.Syntax;
8 |
9 | namespace Gigya.Microdot.Common.Tests
10 | {
11 | public class FakesLoggersModules : ILoggingModule
12 | {
13 | public void Bind(IBindingToSyntax logBinding, IBindingToSyntax eventPublisherBinding, IBindingToSyntax> logFactory)
14 | {
15 | logBinding.To().InSingletonScope();
16 | logFactory.ToMethod(c => caller => c.Kernel.Get()).InSingletonScope();
17 | eventPublisherBinding.To().InSingletonScope();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/paket.template:
--------------------------------------------------------------------------------
1 | type
2 | project
3 | description
4 | Using this component you can find other Microdot services (and any other
5 | remote system), perform client-side load balancing between multiple
6 | servers, detect and skip unresponsive servers and resume using them
7 | when they return to full operation. Discovery is typically perfomed with
8 | Consul by HashiCorp (http://consul.io) but it also supports manual server
9 | lists specified in Microdot configuration (see NuGet package
10 | Gigya.Microdot.Configuration) and can be expanded to support additional
11 | service discovery systems.
12 | projectUrl
13 | https://github.com/gigya/microdot
14 | licenseUrl
15 | https://github.com/gigya/microdot/blob/master/LICENSE.md
16 | tags
17 | gigya microdot microservice microservices discovery service-discovery consul
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/CacheConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Gigya.Microdot.Interfaces.Configuration;
4 |
5 | namespace Gigya.Microdot.ServiceProxy.Caching
6 | {
7 | [ConfigurationRoot("Cache", RootStrategy.ReplaceClassNameWithPath)]
8 | public class CacheConfig: IConfigObject
9 | {
10 | public bool DontCacheRecentlyRevokedResponses { get; set; } = true;
11 | public int DelayBetweenRecentlyRevokedCacheClean { get; set; } = 1000;
12 | public bool LogRevokes { get; set; } = false;
13 | public Dictionary Groups { get; } = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
14 | }
15 |
16 | public class CacheGroupConfig
17 | {
18 | public bool WriteExtraLogs { get; set; } = false;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Gigya.Microdot.ServiceProxy.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.ServiceProxy
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/IDemoService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using Gigya.Common.Contracts.HttpService;
4 |
5 | namespace Gigya.Microdot.UnitTests
6 | {
7 | [HttpService(5555)]
8 | public interface IDemoService
9 | {
10 | Task DoSomething();
11 | Task ToUpper(string str);
12 | Task Increment(ulong val);
13 | Task SendEnum(TestEnum value);
14 | Task IncrementInt(int val);
15 | }
16 |
17 | [HttpService(6555, UseHttps = true)]
18 | public interface IDemoServiceSecure
19 | {
20 | Task DoSomething();
21 | Task ToUpper(string str);
22 | Task Increment(ulong val);
23 | Task SendEnum(TestEnum value);
24 | }
25 |
26 | public enum TestEnum
27 | {
28 | Enval1,
29 | Enval2,
30 | Enval3
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/Metrics/Json/JsonObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Metrics.Json
6 | {
7 | public class JsonObject
8 | {
9 | public JsonObject(IEnumerable properties)
10 | {
11 | this.Properties = properties;
12 | }
13 |
14 | public IEnumerable Properties { get; }
15 |
16 | public string AsJson(bool indented = true, int indent = 0)
17 | {
18 | indent = indented ? indent : 0;
19 | var properties = this.Properties.Select(p => p.AsJson(indented, indent + 2));
20 |
21 | var jsonProperties = string.Join(indented ? "," + Environment.NewLine : ",", properties);
22 |
23 | return string.Format(indented ? "{{\r\n{0}\r\n{1}}}" : "{{{0}}}{1}", jsonProperties, new string(' ', indent));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Metrics/Sampling/UserValueWrapper.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Collections.Generic;
3 | namespace Metrics.Sampling
4 | {
5 | public struct UserValueWrapper
6 | {
7 | public static readonly UserValueWrapper Empty = new UserValueWrapper();
8 | public static readonly IComparer Comparer = new UserValueComparer();
9 |
10 | public readonly long Value;
11 | public readonly string UserValue;
12 |
13 | public UserValueWrapper(long value, string userValue = null)
14 | {
15 | this.Value = value;
16 | this.UserValue = userValue;
17 | }
18 |
19 | private class UserValueComparer : IComparer
20 | {
21 | public int Compare(UserValueWrapper x, UserValueWrapper y)
22 | {
23 | return Comparer.Default.Compare(x.Value, y.Value);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Utils/ObjectPool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 |
4 | namespace Gigya.Microdot.SharedLogic.Utils
5 | {
6 | public class ObjectPool
7 | {
8 | private readonly ConcurrentBag _objects;
9 | private readonly Func _objectGenerator;
10 | private readonly int _poolSize;
11 |
12 | public ObjectPool(Func objectGenerator, int poolSize)
13 | {
14 | _objectGenerator = objectGenerator ?? throw new ArgumentNullException(nameof(objectGenerator));
15 | _objects = new ConcurrentBag();
16 | _poolSize = poolSize;
17 | }
18 |
19 | public T Get() => _objects.TryTake(out T item) ? item : _objectGenerator();
20 |
21 | public void Return(T item)
22 | {
23 | if (_objects.Count >= _poolSize)
24 | return;
25 |
26 | _objects.Add(item);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/Gigya.Microdot.ServiceDiscovery.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.ServiceDiscovery
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/Gigya.Microdot.Common.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | Gigya.Microdot.Common.Tests
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Common.Tests/SpyEventPublisher.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 | using System.Threading.Tasks;
3 | using Gigya.Microdot.Interfaces.Events;
4 | using NSubstitute;
5 |
6 | namespace Gigya.Microdot.Common.Tests
7 | {
8 | public class SpyEventPublisher : IEventPublisher
9 | {
10 | static readonly PublishingTasks PublishingTasks = new PublishingTasks { PublishEvent = Task.FromResult(true), PublishAudit = Task.FromResult(true) };
11 | public ConcurrentQueue Events = new ConcurrentQueue();
12 |
13 | public PublishingTasks TryPublish(IEvent evt)
14 | {
15 | evt.Configuration = Substitute.For();
16 | evt.Configuration.ParamTruncateLength = 1000000;
17 | Events.Enqueue(evt);
18 | return PublishingTasks;
19 | }
20 |
21 | public void Clear()
22 | {
23 | Events = new ConcurrentQueue();
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/Gigya.Microdot.Fakes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.Fakes
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/IOrleansConfigurationBuilderConfigurator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using Orleans.Hosting;
5 |
6 | namespace Gigya.Microdot.Orleans.Hosting
7 | {
8 | ///
9 | /// This interface is intended to act as a hook for configuring Orleans host builder
10 | ///
11 | public interface IOrleansConfigurationBuilderConfigurator
12 | {
13 | ///
14 | /// Configure the host builder before it is initialized by microdot
15 | ///
16 | ///
17 | void PreInitializationConfiguration(SiloHostBuilder siloHostBuilder);
18 |
19 | ///
20 | /// Configure the host builder after it is initialized by microdot
21 | ///
22 | ///
23 | void PostInitializationConfiguration(SiloHostBuilder siloHostBuilder);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/TestContextAttribute.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using NUnit.Framework.Interfaces;
3 | using NUnit.Framework.Internal;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests
11 | {
12 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
13 | public class TestContextAttribute : Attribute, IApplyToContext
14 | {
15 | public void ApplyToContext(TestExecutionContext context)
16 | {
17 | Environment.SetEnvironmentVariable("ZONE", "zone");
18 | Environment.SetEnvironmentVariable("ENV", "env");
19 | }
20 |
21 | ~TestContextAttribute()
22 | {
23 | Environment.SetEnvironmentVariable("ZONE", null);
24 | Environment.SetEnvironmentVariable("ENV", null);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Rewrite/Node.cs:
--------------------------------------------------------------------------------
1 | namespace Gigya.Microdot.SharedLogic.Rewrite
2 | {
3 | public class Node
4 | {
5 | public Node(string hostName, int? port = null)
6 | {
7 | Hostname = hostName;
8 | Port = port;
9 | }
10 |
11 | public string Hostname { get; }
12 | public int? Port { get; }
13 |
14 | public override string ToString()
15 | {
16 | return Port.HasValue ? $"{Hostname}:{Port}" : Hostname;
17 | }
18 |
19 | public override bool Equals(object obj)
20 | {
21 | if (!(obj is Node other))
22 | return false;
23 |
24 | return other.Hostname == Hostname && other.Port == Port;
25 | }
26 |
27 |
28 | public override int GetHashCode()
29 | {
30 | unchecked
31 | {
32 | return ((Hostname?.GetHashCode() ?? 0) * 397) ^ (Port?.GetHashCode() ?? 1);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/ExceptionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Gigya.Microdot.UnitTests
5 | {
6 | public static class ExceptionExtensions
7 | {
8 | public static T ThrowAndCatch(this T exception) where T : Exception
9 | {
10 | try
11 | {
12 | throw exception;
13 | }
14 | catch (T ex)
15 | {
16 | return ex;
17 | }
18 | }
19 |
20 | public static T ThrowAndCatchAsync(this T exception) where T : Exception
21 | {
22 | async Task AsyncThrow()
23 | {
24 | await Task.FromResult(0);
25 | throw exception;
26 | }
27 |
28 | try
29 | {
30 | AsyncThrow().GetAwaiter().GetResult();
31 | }
32 | catch (T ex)
33 | {
34 | return ex;
35 | }
36 |
37 | return null;
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Environment/ApplicationInfoSource.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.SharedLogic;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace Gigya.Microdot.Hosting.Environment
6 | {
7 | public sealed class ApplicationInfoSource : IHostEnvironmentSource
8 | {
9 | public string Zone { get; }
10 |
11 | public string Region { get; }
12 |
13 | public string DeploymentEnvironment { get; }
14 |
15 | public string ConsulAddress { get; }
16 |
17 | public string InstanceName { get; }
18 |
19 | public CurrentApplicationInfo ApplicationInfo { get; }
20 |
21 | public DirectoryInfo ConfigRoot { get; }
22 |
23 | public FileInfo LoadPathsFile { get; }
24 |
25 | public IDictionary EnvironmentVariables => new Dictionary();
26 |
27 | public ApplicationInfoSource(CurrentApplicationInfo applicationInfo)
28 | {
29 | this.ApplicationInfo = applicationInfo;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject.Host/Gigya.Microdot.Ninject.Host.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 | Gigya.Microdot.Ninject.Host
7 | $(SolutionDir)main.ruleset
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Metrics/Reporters/StringReport.cs:
--------------------------------------------------------------------------------
1 | using Metrics.MetricData;
2 | using System;
3 | using System.Text;
4 | using System.Threading;
5 |
6 | namespace Metrics.Reporters
7 | {
8 | public class StringReport : HumanReadableReport
9 | {
10 | public static string RenderMetrics(MetricsData metricsData, Func healthStatus)
11 | {
12 | var report = new StringReport();
13 | report.RunReport(metricsData, healthStatus, CancellationToken.None);
14 | return report.Result;
15 | }
16 |
17 | private StringBuilder buffer;
18 |
19 | protected override void StartReport(string contextName)
20 | {
21 | this.buffer = new StringBuilder();
22 | base.StartReport(contextName);
23 | }
24 | protected override void WriteLine(string line, params string[] args)
25 | {
26 | this.buffer.AppendLine(string.Format(line, args));
27 | }
28 |
29 | public string Result => this.buffer.ToString();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Events/EventConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 | using Gigya.Microdot.Interfaces.Configuration;
3 |
4 | namespace Gigya.Microdot.Interfaces.Events
5 | {
6 |
7 | [ConfigurationRoot("logging", RootStrategy.ReplaceClassNameWithPath)]
8 | public class EventConfiguration : IConfigObject
9 | {
10 | ///
11 | /// E.g. "^[2-4].*$" will filter 2xx - 4xx error codes and leave stack traces for 5xx errors.
12 | ///
13 | public string ExcludeStackTraceForErrorCodeRegex
14 | {
15 | get => ExcludeStackTraceRule.ToString();
16 | set => ExcludeStackTraceRule = new Regex(value, RegexOptions.Compiled);
17 | }
18 |
19 | public Regex ExcludeStackTraceRule { get; set; } = new Regex("^$", RegexOptions.Compiled);
20 |
21 | public bool ExcludeParams { get; set; } = false;
22 |
23 | public int ParamTruncateLength { get; set; } = 16 * 1024;
24 |
25 | public int MinResponseTimeForLog { get; set; } = 500;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Configuration/ConfigObjectsCacheTests.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Configuration;
2 | using Gigya.Microdot.Configuration.Objects;
3 | using Gigya.Microdot.Interfaces;
4 | using NSubstitute;
5 | using NUnit.Framework;
6 |
7 | namespace Gigya.Microdot.UnitTests.Configuration
8 | {
9 | [TestFixture,Parallelizable(ParallelScope.Fixtures)]
10 | public class ConfigObjectsCacheTests
11 | {
12 | [Test]
13 | public void Register2Creators()
14 | {
15 | IConfigObjectCreator config1 = Substitute.For();
16 | IConfigObjectCreator config2 = Substitute.For();
17 |
18 | ConfigObjectsCache cache = new ConfigObjectsCache(new ConfigDecryptor());
19 | cache.RegisterConfigObjectCreator(config1);
20 | cache.RegisterConfigObjectCreator(config2);
21 |
22 | cache.DecryptAndReloadConfigObjects(null, null);
23 |
24 | config1.Received(1).Reload();
25 | config2.Received(1).Reload();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Metrics/Metrics.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 | true
7 | Metrics
8 | Metrics
9 |
10 |
11 |
12 |
13 |
14 | ..\..\bin\$(Configuration)\Metrics.XML
15 | 1591; 1570; 1587;
16 |
17 |
18 |
19 |
20 | Endpoints\metrics_32.png
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Metrics/Endpoints/MetricsEndpointHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.Specialized;
3 | using System.Linq;
4 | using System.Net;
5 |
6 | namespace Metrics.Endpoints
7 | {
8 | public sealed class MetricsEndpointHandler : AbstractMetricsEndpointHandler
9 | {
10 | public MetricsEndpointHandler(IEnumerable endpoints) : base(endpoints) { }
11 |
12 | protected override MetricsEndpointRequest CreateRequest(HttpListenerContext requestInfo)
13 | {
14 | var headers = GetHeaders(requestInfo.Request.Headers);
15 | return new MetricsEndpointRequest(headers);
16 | }
17 |
18 | private IDictionary GetHeaders(NameValueCollection headers)
19 | {
20 | return headers.AllKeys
21 | .ToDictionary(
22 | key => key,
23 | key => headers[key].Split(',')
24 | .Select(s => s.Trim())
25 | .ToArray());
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/StorageProviderTest/BindStorageTest.cs:
--------------------------------------------------------------------------------
1 | using Gigya;
2 | using Gigya.Common;
3 | using Gigya.Common.OrleansInfra;
4 | using Gigya.Common.OrleansInfra.FunctionalTests;
5 | using Gigya.Microdot.Common.Tests;
6 | using Gigya.Microdot.Hosting.Environment;
7 | using Gigya.Microdot.Testing.Service;
8 | using NUnit.Framework;
9 | using System.Threading.Tasks;
10 |
11 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.StorageProviderTest
12 | {
13 | [TestFixture, Parallelizable(ParallelScope.All)]
14 | public class BindStorageTest
15 | {
16 |
17 | [Test]
18 | public async Task CanBindStorage()
19 | {
20 | ServiceTester selfHostService = new ServiceTester();
21 |
22 | var accountGrain = selfHostService.GrainClient.GetGrain(0);
23 | await accountGrain.Save(new Account() { Name = "test" });
24 | var accunt = await accountGrain.Get();
25 | Assert.AreEqual("test", accunt.Name);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.ServiceContract/Attributes/EventAttrubute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.ServiceContract.Attributes
4 | {
5 | /// Mark the parameter as containing sensitive data.
6 | /// When sensitive data is automaticity logged (e.g. event publisher) it will be encrypted.
7 | ///
8 | [AttributeUsage(AttributeTargets.Parameter| AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
9 |
10 | public class SensitiveAttribute : Attribute
11 | {
12 | /// Mark the parameter as containing Secretive data.
13 | ///it will never log automaticity (e.g. event publisher).
14 | ///
15 | public bool Secretive { get; set; }
16 | }
17 |
18 | /// Mark the parameter as containing nonsensitive data.
19 | /// When nonsensitive data is automaticity logged (e.g. event publisher) it wont be encrypted.
20 | ///
21 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
22 | public class NonSensitiveAttribute : Attribute{}
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/StorageProviderTest/AccountGrain.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Common.Tests;
2 | using Gigya.Microdot.Fakes.KernelUtils;
3 | using Gigya.Microdot.Ninject;
4 | using Gigya.Microdot.Orleans.Hosting;
5 | using Gigya.Microdot.Orleans.Ninject.Host;
6 | using Ninject;
7 | using Ninject.Syntax;
8 | using Orleans;
9 | using Orleans.Hosting;
10 | using Orleans.Providers;
11 | using System.Threading.Tasks;
12 |
13 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.StorageProviderTest
14 | {
15 | [StorageProvider(ProviderName = MemoryServiceHost.MemoryStorageProvider)]
16 | public class AccountGrain : Grain,IAccountGrain
17 | {
18 | public async Task Save(Account account)
19 | {
20 | State = account;
21 | await WriteStateAsync();
22 | }
23 |
24 |
25 | public async Task Get()
26 | {
27 | await ReadStateAsync();
28 | return State;
29 | }
30 |
31 |
32 | public async Task Delete()
33 | {
34 | await ClearStateAsync();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Gigya.Microdot.Hosting.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 | Gigya.Microdot.Hosting
7 | CODE_ANALYSIS;DEBUG;TRACE
8 | $(SolutionDir)main.ruleset
9 | 8.0
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Metrics/App_Packages/HdrHistogram/Iterable.cs:
--------------------------------------------------------------------------------
1 | // Written by Gil Tene of Azul Systems, and released to the public domain,
2 | // as explained at http://creativecommons.org/publicdomain/zero/1.0/
3 | //
4 | // Ported to .NET by Iulian Margarintescu under the same license and terms as the java version
5 | // Java Version repo: https://github.com/HdrHistogram/HdrHistogram
6 | // Latest ported version is available in the Java submodule in the root of the repo
7 | using System.Collections.Generic;
8 |
9 | namespace HdrHistogram
10 | {
11 | internal abstract class Iterable : IEnumerable
12 | {
13 |
14 | /**
15 | * Returns an iterator over a set of elements of type T.
16 | *
17 | * @return an Iterator.
18 | */
19 | protected abstract Iterator iterator();
20 |
21 | public IEnumerator GetEnumerator()
22 | {
23 | return this.iterator();
24 | }
25 |
26 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
27 | {
28 | return this.GetEnumerator();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/AvailabilityZoneServiceDiscovery/AvailabilityZoneInfo.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Common.Contracts.Exceptions;
2 | using Gigya.Microdot.SharedLogic.Rewrite;
3 |
4 | namespace Gigya.Microdot.ServiceDiscovery.AvailabilityZoneServiceDiscovery
5 | {
6 | public class AvailabilityZoneInfo
7 | {
8 | public enum StatusCodes
9 | {
10 | InitializingConnectionToConsul = 0, // default before polling thread first (successful or failed) read
11 | Ok,
12 | FailedConnectToConsul,
13 | ConsulInternalError,
14 | MissingOrInvalidKeyValue,
15 | FailedGetHealthyNodes,
16 | FailedOrInvalidKeyFromConsul,
17 | CriticalError
18 | }
19 |
20 | public StatusCodes StatusCode { get; internal set; }
21 | public string ServiceName { get; internal set; }
22 | public string ServiceZone { get; internal set; }
23 | public DeploymentIdentifier DeploymentIdentifier { get; internal set; }
24 | public Node[] Nodes { get; internal set; }
25 | public EnvironmentException Exception { get; internal set; }
26 | }
27 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Configuration/Verificator/VerifiedConfigs.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using Gigya.Microdot.Interfaces.Configuration;
3 |
4 | namespace Gigya.Microdot.UnitTests.Configuration.Verificator
5 | {
6 | [ConfigurationRoot("VerifiedConfig1", RootStrategy.ReplaceClassNameWithPath)]
7 | public class VerifiedConfig1 : IConfigObject
8 | {
9 | ///
10 | /// Expecting the value loaded from config file
11 | ///
12 | public string ValueLoaded { get; set; }
13 | }
14 |
15 | [ConfigurationRoot("VerifiedConfig2", RootStrategy.ReplaceClassNameWithPath)]
16 | public class VerifiedConfig2 : IConfigObject
17 | {
18 | ///
19 | /// Expecting the value remains null and detected as not initialized
20 | ///
21 | [Required]
22 | public string Required { get; set; }
23 | }
24 |
25 | [ConfigurationRoot("VerifiedConfig3", RootStrategy.ReplaceClassNameWithPath)]
26 | public class VerifiedConfig3 : IConfigObject
27 | {
28 | ///
29 | /// Expecting the string value cannot be converted into an int.
30 | ///
31 | public int TheInt { get; set; }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/Metrics/Json/JsonBuilderV2.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using Metrics.MetricData;
4 | using Metrics.Utils;
5 |
6 | namespace Metrics.Json
7 | {
8 | public static class JsonBuilderV2
9 | {
10 | public const int Version = 2;
11 | public const string MetricsMimeType = "application/vnd.metrics.net.v2.metrics+json";
12 |
13 | #if !DEBUG
14 | private const bool DefaultIndented = false;
15 | #else
16 | private const bool DefaultIndented = true;
17 | #endif
18 | public static string BuildJson(MetricsData data)
19 | {
20 | return BuildJson(data, AppEnvironment.Current, Clock.Default, indented: DefaultIndented);
21 | }
22 |
23 | public static string BuildJson(MetricsData data, IEnumerable environment, Clock clock, bool indented = DefaultIndented)
24 | {
25 | var version = Version.ToString(CultureInfo.InvariantCulture);
26 |
27 | return JsonMetricsContext.FromContext(data, environment, version)
28 | .ToJsonObject()
29 | .AsJson(indented);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/TestCert/CreateTestCert.cmd:
--------------------------------------------------------------------------------
1 | makecert.exe ^
2 | -n "CN=TestRootCA,O=Gigya,L=Tel-Aviv,C=IL" ^
3 | -r ^
4 | -pe ^
5 | -a sha512 ^
6 | -len 4096 ^
7 | -cy authority ^
8 | -sv TestRootCA.pvk ^
9 | TestRootCA.cer
10 |
11 | pvk2pfx.exe ^
12 | -pvk TestRootCA.pvk ^
13 | -spc TestRootCA.cer ^
14 | -pfx TestRootCA.pfx ^
15 | -po 123
16 |
17 | makecert.exe ^
18 | -n "CN=TestServerCer,O=Gigya,L=Tel-Aviv,C=IL" ^
19 | -iv TestRootCA.pvk ^
20 | -ic TestRootCA.cer ^
21 | -pe ^
22 | -a sha512 ^
23 | -len 4096 ^
24 | -b 01/01/2015 ^
25 | -e 01/01/2025 ^
26 | -sky exchange ^
27 | -eku 1.3.6.1.5.5.7.3.1 ^
28 | -sv TestServerCer.pvk ^
29 | TestServerCer.cer
30 |
31 | pvk2pfx.exe ^
32 | -pvk TestServerCer.pvk ^
33 | -spc TestServerCer.cer ^
34 | -pfx TestServerCer.pfx ^
35 | -po 123
36 |
37 | makecert.exe ^
38 | -n "CN=TestClientCer" ^
39 | -iv TestRootCA.pvk ^
40 | -ic TestRootCA.cer ^
41 | -pe ^
42 | -a sha512 ^
43 | -len 4096 ^
44 | -b 01/01/2015 ^
45 | -e 01/01/2025 ^
46 | -sky exchange ^
47 | -eku 1.3.6.1.5.5.7.3.2 ^
48 | -sv TestClientCer.pvk ^
49 | TestClientCer.cer
50 |
51 | pvk2pfx.exe ^
52 | -pvk TestClientCer.pvk ^
53 | -spc TestClientCer.cer ^
54 | -pfx TestClientCer.pfx ^
55 | -po 123
--------------------------------------------------------------------------------
/Metrics/Endpoints/AbstractMetricsEndpointHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 |
4 | namespace Metrics.Endpoints
5 | {
6 | public abstract class AbstractMetricsEndpointHandler
7 | {
8 | private readonly MetricsEndpoint[] endpoints;
9 |
10 | protected AbstractMetricsEndpointHandler(IEnumerable endpoints)
11 | {
12 | this.endpoints = endpoints.ToArray();
13 | }
14 |
15 | public MetricsEndpointResponse Process(string urlPath, T requestInfo)
16 | {
17 | if (string.IsNullOrEmpty(urlPath))
18 | {
19 | return null;
20 | }
21 |
22 | foreach (var endpoint in this.endpoints)
23 | {
24 | if (endpoint.IsMatch(urlPath))
25 | {
26 | var request = CreateRequest(requestInfo);
27 | return endpoint.ProduceResponse(request);
28 | }
29 | }
30 |
31 | return null;
32 | }
33 |
34 | protected abstract MetricsEndpointRequest CreateRequest(T requestInfo);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Metrics/Reporters/TextFileReport.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Text;
3 |
4 | namespace Metrics.Reporters
5 | {
6 | public class TextFileReport : HumanReadableReport
7 | {
8 | private readonly string fileName;
9 |
10 | private StringBuilder buffer;
11 |
12 | public TextFileReport(string fileName)
13 | {
14 | Directory.CreateDirectory(Path.GetDirectoryName(fileName));
15 | this.fileName = fileName;
16 | }
17 |
18 | protected override void StartReport(string contextName)
19 | {
20 | this.buffer = new StringBuilder();
21 | base.StartReport(contextName);
22 | }
23 |
24 | protected override void WriteLine(string line, params string[] args)
25 | {
26 | buffer.AppendFormat(line, args);
27 | buffer.AppendLine();
28 | }
29 |
30 | protected override void EndReport(string contextName)
31 | {
32 |
33 | File.WriteAllText(this.fileName, this.buffer.ToString());
34 |
35 | base.EndReport(contextName);
36 | this.buffer = null;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/Gigya.Microdot.Ninject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Gigya.Microdot.Ninject
6 | $(SolutionDir)main.ruleset
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Metrics/RemoteMetrics/RemoteMetricsExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Metrics.Json;
3 | using Metrics.RemoteMetrics;
4 |
5 | namespace Metrics
6 | {
7 | public static class RemoteMetricsExtensions
8 | {
9 | private static Func jsonDeserializer;
10 |
11 |
12 | public static MetricsConfig WithJsonDeserialzier(this MetricsConfig config, Func jsonDeserializer)
13 | {
14 | RemoteMetricsExtensions.jsonDeserializer = jsonDeserializer;
15 | return config;
16 | }
17 |
18 | public static MetricsConfig RegisterRemote(this MetricsConfig config, string name, Uri remoteUri, TimeSpan updateInterval)
19 | {
20 | if (jsonDeserializer == null)
21 | {
22 | throw new InvalidOperationException("You must set a JSON Deserializer by setting Metrics.Config.WithJsonDeserialzier()");
23 | }
24 |
25 | config.WithConfigExtension((ctx, hs) => ctx.Advanced.AttachContext(name, new RemoteMetricsContext(remoteUri, updateInterval, jsonDeserializer)), () => false);
26 | return config;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/WarmupTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Threading.Tasks;
4 | using Gigya.Microdot.Common.Tests;
5 | using Gigya.Microdot.Hosting.Environment;
6 | using Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.WarmupTestService;
7 | using Gigya.Microdot.Testing.Service;
8 | using NUnit.Framework;
9 |
10 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests
11 | {
12 | [TestFixture, Parallelizable(ParallelScope.Fixtures)]
13 | public class WarmupTests
14 | {
15 |
16 | [Test]
17 | public async Task InstanceReadyBeforeCallingMethod_Warmup()
18 | {
19 | ServiceTester tester = new ServiceTester();
20 | var beforeGrainCreated = DateTime.Now;
21 |
22 | IWarmupTestServiceGrain grain = tester.GrainClient.GetGrain(0);
23 |
24 | var dependencyCreateDate = await grain.DependencyCreateDate();
25 |
26 | Assert.Greater(beforeGrainCreated, dependencyCreateDate, "dependencyCreateDate should create before grain is created");
27 |
28 | tester.Dispose();
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Metrics/Core/MetricsBuilder.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using Metrics.MetricData;
4 | using Metrics.Sampling;
5 |
6 | namespace Metrics.Core
7 | {
8 | public interface MetricsBuilder
9 | {
10 | MetricValueProvider BuildPerformanceCounter(string name, Unit unit, string counterCategory, string counterName, string counterInstance);
11 | MetricValueProvider BuildGauge(string name, Unit unit, Func valueProvider);
12 | CounterImplementation BuildCounter(string name, Unit unit);
13 | MeterImplementation BuildMeter(string name, Unit unit, TimeUnit rateUnit);
14 | HistogramImplementation BuildHistogram(string name, Unit unit, SamplingType samplingType);
15 | HistogramImplementation BuildHistogram(string name, Unit unit, Reservoir reservoir);
16 | TimerImplementation BuildTimer(string name, Unit unit, TimeUnit rateUnit, TimeUnit durationUnit, SamplingType samplingType);
17 | TimerImplementation BuildTimer(string name, Unit unit, TimeUnit rateUnit, TimeUnit durationUnit, HistogramImplementation histogram);
18 | TimerImplementation BuildTimer(string name, Unit unit, TimeUnit rateUnit, TimeUnit durationUnit, Reservoir reservoir);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Metrics/RemoteMetrics/HttpRemoteMetrics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Metrics.Json;
6 |
7 | namespace Metrics.RemoteMetrics
8 | {
9 | public static class HttpRemoteMetrics
10 | {
11 | private class CustomClient : WebClient
12 | {
13 | protected override WebRequest GetWebRequest(Uri address)
14 | {
15 | HttpWebRequest request = base.GetWebRequest(address) as HttpWebRequest;
16 | request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
17 | return request;
18 | }
19 | }
20 |
21 | public static async Task FetchRemoteMetrics(Uri remoteUri, Func deserializer, CancellationToken token)
22 | {
23 | using (CustomClient client = new CustomClient())
24 | {
25 | client.Headers.Add("Accept-Encoding", "gzip");
26 | var json = await client.DownloadStringTaskAsync(remoteUri).ConfigureAwait(false);
27 | return deserializer(json);
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Interface/CalculatorService.Interface.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {1FB8E464-6A36-44A2-A343-8E95B51B4542}
5 | net472
6 | Gigya.Microdot.Sample.CalculatorService.Interface
7 | Gigya.Microdot.Sample.CalculatorService.Interface
8 | Copyright © 2018
9 | false
10 | bin\$(Configuration)\
11 | $(SolutionDir)main.ruleset
12 |
13 |
14 | full
15 | 3
16 |
17 |
18 | pdbonly
19 |
20 |
21 |
22 | Designer
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Ninject.Host/Gigya.Microdot.Orleans.Ninject.Host.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 | Gigya.Microdot.Orleans.Ninject.Host
7 | $(SolutionDir)main.ruleset
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/CalculatorService/IUserGrainWithGuid.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Orleans;
3 |
4 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.CalculatorService
5 | {
6 | public interface IUserGrainWithGuid : IIdentety, IGrainWithGuidKey { }
7 | public interface IUserGrainWithString : IIdentety, IGrainWithStringKey { }
8 | public interface IUserGrainWithLong : IIdentety, IGrainWithIntegerKey { }
9 |
10 | public interface IIdentety
11 | {
12 | Task GetIdentety();
13 | }
14 |
15 |
16 | public class UserGrainWithGuid : Grain, IUserGrainWithGuid
17 | {
18 | public Task GetIdentety()
19 | {
20 | return Task.FromResult(this.GetPrimaryKey().ToString());
21 | }
22 | }
23 | public class UserGrainWithString : Grain, IUserGrainWithString
24 | {
25 | public Task GetIdentety()
26 | {
27 | return Task.FromResult(this.GetPrimaryKeyString());
28 | }
29 | }
30 |
31 | public class UserGrainWithLong : Grain, IUserGrainWithLong
32 | {
33 | public Task GetIdentety()
34 | {
35 | return Task.FromResult(this.GetPrimaryKeyLong().ToString());
36 | }
37 | }
38 |
39 |
40 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/paket.references:
--------------------------------------------------------------------------------
1 | Gigya.ServiceContract
2 | Microsoft.CodeAnalysis.CSharp
3 | Microsoft.CodeAnalysis.Common
4 | Microsoft.CSharp
5 | System.Net.Http
6 |
7 | Microsoft.Orleans.Connections.Security
8 | Microsoft.Orleans.Core
9 | Microsoft.Orleans.Core.Abstractions
10 | Microsoft.Orleans.OrleansCodeGenerator
11 | Microsoft.Orleans.CodeGenerator.MSBuild
12 | Microsoft.Orleans.OrleansRuntime
13 | Microsoft.Orleans.OrleansProviders
14 | Microsoft.Orleans.OrleansSqlUtils
15 | Microsoft.Orleans.OrleansZooKeeperUtils
16 | Microsoft.Orleans.Server
17 | Microsoft.Orleans.OrleansTelemetryConsumers.Counters
18 | Gigya.OrleansDashboard.NetStandard
19 | # TODO: remove this dependency once we move to dotnet core and go back to using the original dashboard
20 | System.Text.Json
21 |
22 |
23 |
24 | # lock dependcy in nuspac
25 | Microsoft.Extensions.Configuration
26 | Microsoft.AspNetCore.Connections.Abstractions
27 | Microsoft.AspNetCore.Hosting
28 | Microsoft.AspNetCore.Server.Kestrel
29 | Microsoft.Extensions.Logging.Abstractions
30 | Microsoft.Extensions.ObjectPool
31 | Microsoft.Extensions.DependencyModel
32 | Microsoft.Extensions.FileSystemGlobbing
33 | Microsoft.Extensions.Primitives
34 | System.Diagnostics.PerformanceCounter
35 | System.Threading.Tasks.Dataflow
36 | Microsoft.AspNetCore.Http.Features
37 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/RegexTimeoutInitializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 |
4 | namespace Gigya.Microdot.Ninject
5 | {
6 |
7 | ///
8 | /// Notice that REGEX_DEFAULT_MATCH_TIMEOUT can be set only once and will be determined when calling the first regex the default in infinite!!
9 | ///
10 | public class RegexTimeoutInitializer
11 | {
12 | static RegexTimeoutInitializer()
13 | {
14 | int regexDefaultMachTimeOutMs = (int)TimeSpan.FromSeconds(10).TotalMilliseconds;
15 | /*try
16 | {
17 | if (ConfigurationManager.AppSettings["regexDefaultMachTimeOutMs"] != null)
18 | {
19 | regexDefaultMachTimeOutMs = int.Parse(ConfigurationManager.AppSettings["regexDefaultMachTimeOutMs"]);
20 | }
21 | }
22 | catch (Exception e)
23 | {
24 | }
25 | */
26 | AppDomain.CurrentDomain.SetData("REGEX_DEFAULT_MATCH_TIMEOUT", TimeSpan.FromMilliseconds(regexDefaultMachTimeOutMs));
27 | }
28 | public void Init()
29 | {
30 | // make sure our static is initialize
31 | // our test is running parallel, we need to make sure it happens in the domain only oncse
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Sample/CalculatorService/CalculatorServiceHost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CalculatorService.Interface;
3 | using Gigya.Microdot.Configuration;
4 | using Gigya.Microdot.Hosting.Environment;
5 | using Gigya.Microdot.Interfaces.Configuration;
6 | using Gigya.Microdot.Interfaces.SystemWrappers;
7 | using Gigya.Microdot.Logging.NLog;
8 | using Gigya.Microdot.Ninject;
9 | using Gigya.Microdot.Ninject.Host;
10 | using Gigya.Microdot.SharedLogic;
11 | using Gigya.Microdot.SharedLogic.SystemWrappers;
12 | using Ninject;
13 |
14 | namespace CalculatorService
15 | {
16 |
17 | class CalculatorServiceHost : MicrodotServiceHost
18 | {
19 | public override string ServiceName => "CalculatorService";
20 |
21 | static void Main(string[] args)
22 | {
23 | try
24 | {
25 | new CalculatorServiceHost().Run();
26 | }
27 | catch (Exception ex)
28 | {
29 | Console.Error.WriteLine(ex);
30 | }
31 | }
32 |
33 | protected override ILoggingModule GetLoggingModule() => new NLogModule();
34 |
35 |
36 | protected override void Configure(IKernel kernel, BaseCommonConfig commonConfig)
37 | {
38 | kernel.Bind().To();
39 | }
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Configuration/IConfigObject.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Interfaces.Configuration
23 | {
24 |
25 | public interface IConfigObject
26 | {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/IMetricsSettings.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Interfaces
23 | {
24 | public interface IMetricsSettings
25 | {
26 | int MetricsPort { get; }
27 | }
28 | }
--------------------------------------------------------------------------------
/Metrics/App_Packages/HdrHistogram/AbstractHistogramEnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace HdrHistogram
4 | {
5 | internal static class AbstractHistogramEnumerableExtensions
6 | {
7 | private static IEnumerable IterateOver(AbstractHistogramIterator iterator)
8 | {
9 | using (iterator)
10 | {
11 | while (iterator.MoveNext())
12 | {
13 | yield return iterator.Current;
14 | }
15 | }
16 | }
17 |
18 | ///
19 | /// Provide a means of iterating through all recorded histogram values using the finest granularity steps
20 | /// supported by the underlying representation. The iteration steps through all non-zero recorded value counts,
21 | /// and terminates when all recorded histogram values are exhausted.
22 | ///
23 | ///
24 | /// The histogram on which to iterate.
25 | ///
26 | public static IEnumerable RecordedValues(this AbstractHistogram histogram)
27 | {
28 | return IterateOver(new RecordedValuesIterator(histogram));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Runtime.CompilerServices;
24 | using System.Runtime.InteropServices;
25 |
26 | [assembly: InternalsVisibleTo("Gigya.Common.Configuration")]
27 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/IApplicationDirectoryProvider.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Interfaces
23 | {
24 | public interface IApplicationDirectoryProvider
25 | {
26 | string GetApplicationDirectory();
27 | }
28 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Caching/Host/ISlowService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using Gigya.Common.Contracts.Attributes;
5 | using Gigya.Common.Contracts.HttpService;
6 |
7 | namespace Gigya.Microdot.UnitTests.Caching.Host
8 | {
9 | [HttpService(7555)]
10 | public interface ISlowService
11 | {
12 | [Cached] Task SimpleSlowMethod(int id, int millisecondsDelay, bool shouldThrow = false);
13 | [Cached] Task> ComplexSlowMethod(int millisecondsDelay, IEnumerable slowDatas, bool shouldThrow = false);
14 |
15 | Task SimpleSlowMethodUncached(int id, int millisecondsDelay, bool shouldThrow = false);
16 | Task> ComplexSlowMethodUncached(int millisecondsDelay, IEnumerable slowDatas, bool shouldThrow = false);
17 | }
18 |
19 | public delegate Task SimpleDelegate(int id, int millisecondsDelay, bool shouldThrow = false);
20 | public delegate Task> ComplexDelegate(int millisecondsDelay, IEnumerable slowDatas, bool shouldThrow = false);
21 |
22 | public class SlowData
23 | {
24 | public int SerialNumber { get; set; }
25 | public string LuckyString { get; set; } = "Leprechaun";
26 | public DateTime TimeCreatedUtc { get; set; } = DateTime.Today;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/ICacheRevoker.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks;
24 |
25 | namespace Gigya.Microdot.Interfaces
26 | {
27 | public interface ICacheRevoker
28 | {
29 | Task Revoke(string key);
30 | }
31 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/HttpService/IWarmup.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks;
24 |
25 | namespace Gigya.Microdot.Hosting.HttpService
26 | {
27 | public interface IWarmup
28 | {
29 | void Warmup();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/PerSiloGrainExample.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Orleans.Hosting.Utils;
2 | using Microsoft.Extensions.Logging;
3 | using Orleans;
4 | using Orleans.Concurrency;
5 | using Orleans.Core;
6 | using Orleans.Runtime;
7 | using System;
8 | using System.Threading.Tasks;
9 |
10 | namespace CalculatorService.Orleans
11 | {
12 |
13 | public interface IMyNormalGrain : IGrainWithIntegerKey
14 | {
15 | Task Publish(T message);
16 | }
17 |
18 |
19 | [Reentrant]
20 | [StatelessWorker(1)]
21 | public class MyNormalGrain: Grain, IMyNormalGrain
22 | {
23 |
24 | PerSiloGrainClient ServiceClient;
25 | public MyNormalGrain(PerSiloGrainClient serviceClient)
26 | {
27 | ServiceClient = serviceClient;
28 | }
29 |
30 | public async Task Publish(T message)
31 | {
32 | await ServiceClient.PublishMessageToAllSilos(message);
33 | }
34 | }
35 |
36 |
37 | public class MyPerSiloGrain : PerSiloGrain
38 | {
39 | public MyPerSiloGrain(IGrainIdentity id, Silo silo, ILoggerFactory loggerFactory, IGrainFactory grainFactory)
40 | : base(id, silo, loggerFactory, grainFactory)
41 | {}
42 |
43 | protected override async Task OnMessage(int message)
44 | {
45 | Console.WriteLine("Got: " + message);
46 | }
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/HttpService/ServiceReachabilityStatus.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.SharedLogic.HttpService
23 | {
24 | public class ServiceReachabilityStatus
25 | {
26 | public bool IsReachable { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/HostingAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Hosting
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Common.Application assembly
26 | ///
27 | public class HostingAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Measurement/Workload/CpuUsageCounterByProcess.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Linq;
4 |
5 | namespace Gigya.Microdot.SharedLogic.Measurement.Workload
6 | {
7 | ///
8 | /// The process CPU usage perf counter per count of affinity assigned virtual cores.
9 | /// The value is: CPU_USAGE / number of virtual cores (from actual process affinity).
10 | ///
11 | public class CpuUsageCounterByProcess : PerformanceCounterByProcess
12 | {
13 | ///
14 | /// The counter of CPUs (virtual cores) assigned to the process with affinity
15 | ///
16 | public int AssignedCoresCount { get; }
17 |
18 | public CpuUsageCounterByProcess()
19 | : base(categoryName: "Process", counterName: "% Processor Time")
20 | {
21 | AssignedCoresCount = Process.GetCurrentProcess().ProcessorAffinityList().Count();
22 | }
23 |
24 | ///
25 | /// Get the current value of counter, or Null if exceptional conditions.
26 | ///
27 | public override double? GetValue()
28 | {
29 | double? value = base.GetValue(); // never throwing
30 |
31 | if (value != null)
32 | value = Math.Round(value.Value / AssignedCoresCount, 2);
33 |
34 | return value;
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/NullEnvironment.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.Interfaces.SystemWrappers;
2 | using Gigya.Microdot.SharedLogic;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Gigya.Microdot.UnitTests
11 | {
12 | internal class NullEnvironment : IEnvironment
13 | {
14 | public string this[string key] => throw new NotImplementedException();
15 |
16 | public string Zone => nameof(Zone);
17 | public string Region => nameof(Region);
18 | public string DeploymentEnvironment => nameof(DeploymentEnvironment);
19 | public string ConsulAddress => nameof(ConsulAddress);
20 | public string InstanceName => nameof(InstanceName);
21 | public DirectoryInfo ConfigRoot => new DirectoryInfo(Directory.GetCurrentDirectory());
22 | public FileInfo LoadPathsFile => new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), "loadPaths.json"));
23 |
24 | public CurrentApplicationInfo ApplicationInfo => throw new NotImplementedException();
25 |
26 | [Obsolete("To be deleted on version 2.0")]
27 | public string GetEnvironmentVariable(string name) => name;
28 | [Obsolete("To be deleted on version 2.0")]
29 | public void SetEnvironmentVariableForProcess(string name, string value) {}
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/MetricsInitializerFake.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Gigya.Microdot.Interfaces;
4 | using Gigya.Microdot.Interfaces.Logging;
5 | using Metrics;
6 |
7 | namespace Gigya.Microdot.Fakes
8 | {
9 | public sealed class MetricsInitializerFake : IMetricsInitializer
10 | {
11 |
12 | public void Init()
13 | {
14 | Metrics.Logging.LogProvider.SetCurrentLogProvider(null);
15 |
16 | MetricsConfig = Metric.Config.WithErrorHandler(ex => {
17 | Log.Error(_ => _("", ex));
18 | }, true);
19 | }
20 |
21 | public void Dispose()
22 | {
23 | try
24 | {
25 | MetricsConfig.Dispose();
26 | }
27 | catch (AggregateException ae)
28 | {
29 | // Ignore all TaskCanceledExceptions (unhandled by Metrics.NET for unknown reasons)
30 | ae.Handle(ex => ex is TaskCanceledException);
31 | }
32 | }
33 |
34 | public MetricsConfig MetricsConfig { get; private set; }
35 |
36 | private IMetricsSettings MetricsSettings { get; set; }
37 |
38 | private ILog Log { get; }
39 |
40 | public MetricsInitializerFake(ILog log, IMetricsSettings metricsSettings)
41 | {
42 | MetricsSettings = metricsSettings;
43 | Log = log;
44 | }
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/SharedLogicAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.SharedLogic
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Common.SharedLogic assembly
26 | ///
27 | public class SharedLogicAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/Caching/RevokeNotifier/RevokeNotifierTestClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Gigya.Microdot.Hosting.UnitTests.Caching.RevokeNotifier
4 | {
5 | public class RevokeNotifierTestClass
6 | {
7 | private readonly int _hashcode;
8 |
9 | public RevokeNotifierTestClass(int hashcodeSeed = 1234)
10 | {
11 | _hashcode = hashcodeSeed;
12 | }
13 | public override int GetHashCode()
14 | {
15 | return _hashcode;
16 | }
17 |
18 | public override bool Equals(object obj)
19 | {
20 | if (ReferenceEquals(null, obj))
21 | return false;
22 | if (ReferenceEquals(this, obj))
23 | return true;
24 | if (obj.GetType() != this.GetType())
25 | return false;
26 | return Equals((RevokeNotifierTestClass)obj);
27 | }
28 |
29 | public bool Equals(RevokeNotifierTestClass other)
30 | {
31 | if (other == null)
32 | {
33 | return false;
34 | }
35 |
36 | return _hashcode == other._hashcode;
37 | }
38 |
39 | public static void CallGC()
40 | {
41 | GC.WaitForFullGCComplete();
42 | GC.WaitForPendingFinalizers();
43 | GC.WaitForFullGCApproach();
44 | GC.Collect(2);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Fakes/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Reflection;
24 | using System.Runtime.InteropServices;
25 |
26 | // The following GUID is for the ID of the typelib if this project is exposed to COM
27 | [assembly: Guid("2865f69b-d847-4901-8945-4941e463f94e")]
28 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/ServiceProxyAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.ServiceProxy
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Common.ServiceProxy assembly
26 | ///
27 | public class ServiceProxyAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/ConfigurationAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Configuration
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Common.Configuration assembly
26 | ///
27 | public class ConfigurationAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Reflection;
24 | using System.Runtime.InteropServices;
25 |
26 | // The following GUID is for the ID of the typelib if this project is exposed to COM
27 | [assembly: Guid("63e40f38-df99-4df5-9b45-addb0c2fc9ff")]
28 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/OrleansHostingAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.Orleans.Hosting
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Orleans.Host assembly
26 | ///
27 | public class OrleansHostingAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Exceptions/StripHttpRequestExceptionConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using Gigya.Common.Contracts.Exceptions;
4 | using Gigya.Microdot.SharedLogic.Utils;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 | namespace Gigya.Microdot.SharedLogic.Exceptions
9 | {
10 | internal class StripHttpRequestExceptionConverter : JsonConverter
11 | {
12 | public override bool CanConvert(Type objectType)
13 | {
14 | return objectType == typeof(HttpRequestException);
15 | }
16 |
17 |
18 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
19 | {
20 | var httpException = (HttpRequestException)value;
21 |
22 | var innerException = httpException?.InnerException ??
23 | new EnvironmentException("[HttpRequestException] " + httpException?.RawMessage(),
24 | unencrypted: new Tags { { "originalStackTrace", httpException?.StackTrace } });
25 |
26 | JObject.FromObject(innerException, serializer).WriteTo(writer);
27 | }
28 |
29 |
30 | public override bool CanRead => false;
31 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
32 | {
33 | throw new NotImplementedException();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/IConfigurationDataWatcher.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks.Dataflow;
24 |
25 | namespace Gigya.Microdot.Configuration
26 | {
27 | public interface IConfigurationDataWatcher
28 | {
29 | ISourceBlock DataChanges { get; }
30 | }
31 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Ninject.Host/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Reflection;
24 | using System.Runtime.InteropServices;
25 |
26 | // The following GUID is for the ID of the typelib if this project is exposed to COM
27 | [assembly: Guid("4e6a024f-ddc9-4a27-a859-77ebc3241009")]
28 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/IRevokeListener.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks.Dataflow;
24 |
25 | namespace Gigya.Microdot.ServiceProxy.Caching
26 | {
27 | public interface IRevokeListener
28 | {
29 | ISourceBlock RevokeSource { get; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/ServiceDiscoveryAssembly.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.ServiceDiscovery
23 | {
24 | ///
25 | /// Placeholder for referencing the Gigya.Common.SharedLogic assembly
26 | ///
27 | public class ServiceDiscoveryAssembly { }
28 | }
29 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/HttpService/IWorker.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System;
24 | using System.Threading.Tasks;
25 |
26 | namespace Gigya.Microdot.Hosting.HttpService
27 | {
28 | public interface IWorker:IDisposable
29 | {
30 | void FireAndForget(Func asyncAction);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/HttpService/IActivator.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks;
24 |
25 | namespace Gigya.Microdot.Hosting.HttpService
26 | {
27 | public interface IActivator
28 | {
29 | Task Invoke(ServiceMethod serviceMethod, object[] arguments);
30 | }
31 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/HttpService/InvocationResult.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System;
24 |
25 | namespace Gigya.Microdot.Hosting.HttpService
26 | {
27 | public class InvocationResult
28 | {
29 | public object Result { get; set; }
30 | public TimeSpan ExecutionTime { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/ExcludeGrainFromStatisticsAttribute.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System;
24 |
25 | namespace Gigya.Microdot.Orleans.Hosting
26 | {
27 | [AttributeUsage(AttributeTargets.Class)]
28 | public class ExcludeGrainFromStatisticsAttribute : Attribute
29 | {
30 |
31 | }
32 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/Objects/ConfigObjectsCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Gigya.Microdot.Interfaces;
4 |
5 | namespace Gigya.Microdot.Configuration.Objects
6 | {
7 | public class ConfigObjectsCache : IConfigObjectsCache
8 | {
9 | private readonly ConfigDecryptor _configDecryptor;
10 |
11 | public ConfigObjectsCache(ConfigDecryptor configDecryptor)
12 | {
13 | _configDecryptor = configDecryptor;
14 | }
15 |
16 | private List _configObjectCreatorsList = new List();
17 |
18 | public void RegisterConfigObjectCreator(IConfigObjectCreator configObjectCreator)
19 | {
20 | if (_configObjectCreatorsList.Contains(configObjectCreator))
21 | throw new InvalidOperationException();
22 |
23 | _configObjectCreatorsList.Add(configObjectCreator);
24 | }
25 |
26 | public void DecryptAndReloadConfigObjects(Func configDecryptor, Func isValidEncryptedStringFormat)
27 | {
28 | _configDecryptor.ConfigDecryptorFunc = configDecryptor;
29 | _configDecryptor.IsValidEncryptedStringFormat = isValidEncryptedStringFormat;
30 |
31 | foreach (IConfigObjectCreator configObjectCreator in _configObjectCreatorsList)
32 | {
33 | configObjectCreator.Reload();
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/HttpService/ICertificateLocator.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Security.Cryptography.X509Certificates;
24 |
25 | namespace Gigya.Microdot.SharedLogic.HttpService
26 | {
27 | public interface ICertificateLocator
28 | {
29 | X509Certificate2 GetCertificate(string certName);
30 | }
31 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Orleans.Hosting/IOrleansToNinjectBinding.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | // Copyright 2017 Gigya Inc. All rights reserved.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
12 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
15 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
16 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
17 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
18 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
19 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 | // POSSIBILITY OF SUCH DAMAGE.
22 |
23 | #endregion Copyright
24 |
25 | using Microsoft.Extensions.DependencyInjection;
26 |
27 | namespace Gigya.Microdot.Orleans.Hosting
28 | {
29 | public interface IOrleansToNinjectBinding
30 | {
31 | void ConfigureServices(IServiceCollection services);
32 | }
33 | }
--------------------------------------------------------------------------------
/Metrics/Core/MetricsRegistry.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using Metrics.MetricData;
5 | namespace Metrics.Core
6 | {
7 | public interface RegistryDataProvider
8 | {
9 | IEnumerable Gauges { get; }
10 | IEnumerable Counters { get; }
11 | IEnumerable Meters { get; }
12 | IEnumerable Histograms { get; }
13 | IEnumerable Timers { get; }
14 | }
15 |
16 | public interface MetricsRegistry
17 | {
18 | RegistryDataProvider DataProvider { get; }
19 |
20 | void Gauge(string name, Func> valueProvider, Unit unit, MetricTags tags);
21 |
22 | Counter Counter(string name, Func builder, Unit unit, MetricTags tags)
23 | where T : CounterImplementation;
24 |
25 | Meter Meter(string name, Func builder, Unit unit, TimeUnit rateUnit, MetricTags tags)
26 | where T : MeterImplementation;
27 |
28 | Histogram Histogram(string name, Func builder, Unit unit, MetricTags tags)
29 | where T : HistogramImplementation;
30 |
31 | Timer Timer(string name, Func builder, Unit unit, TimeUnit rateUnit, TimeUnit durationUnit, MetricTags tags)
32 | where T : TimerImplementation;
33 |
34 | void ClearAllMetrics();
35 | void ResetMetricsValues();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/ConfigDecryptor.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System;
24 |
25 | namespace Gigya.Microdot.Configuration
26 | {
27 | public class ConfigDecryptor
28 | {
29 | public Func ConfigDecryptorFunc = null;
30 | public Func IsValidEncryptedStringFormat = null;
31 | }
32 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/ICache.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Runtime.Caching;
24 | using Nito.AsyncEx;
25 |
26 | namespace Gigya.Microdot.ServiceProxy.Caching
27 | {
28 | public interface ICache
29 | {
30 | AsyncLazy GetOrAdd(string key, T value, CacheItemPolicy policy);
31 | void Clear();
32 | }
33 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/CalculatorService/ICalculatorServiceGrain.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using Orleans;
24 |
25 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.CalculatorService
26 | {
27 | public interface ICalculatorServiceGrain : ICalculatorService, IGrainWithIntegerKey { }
28 |
29 |
30 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Configuration/IConfigEventFactory.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks.Dataflow;
24 | using Gigya.Microdot.Interfaces.Configuration;
25 |
26 | namespace Gigya.Microdot.Configuration
27 | {
28 | public interface IConfigEventFactory
29 | {
30 | ISourceBlock GetChangeEvent() where T: IConfigObject;
31 | }
32 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceDiscovery/ConsulContracts.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Gigya.Microdot.ServiceDiscovery.Rewrite;
6 | using Newtonsoft.Json;
7 |
8 | namespace Gigya.Microdot.ServiceDiscovery
9 | {
10 | public class ConsulQueryExecuteResponse
11 | {
12 | public ServiceEntry[] Nodes { get; set; }
13 | }
14 |
15 | public class ServiceEntry
16 | {
17 | public NodeEntry Node { get; set; }
18 |
19 | public AgentService Service { get; set; }
20 |
21 | }
22 |
23 | public class NodeEntry
24 | {
25 | [JsonProperty(PropertyName = "Node")]
26 | public string Name { get; set; }
27 | }
28 |
29 | public class AgentService
30 | {
31 | public string[] Tags { get; set; }
32 |
33 | public int Port { get; set; }
34 |
35 | }
36 |
37 |
38 | public class KeyValueResponse
39 | {
40 | public string Value { get; set; }
41 |
42 | public T DecodeValue() where T : class
43 | {
44 | var serialized = Encoding.UTF8.GetString(Convert.FromBase64String(Value));
45 | return JsonConvert.DeserializeObject(serialized);
46 | }
47 | }
48 |
49 | public class ServiceKeyValue
50 | {
51 | [JsonProperty("version")]
52 | public string Version { get; set; }
53 |
54 | [JsonProperty("instancename")]
55 | public string InstanceName { get; set; }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/Measurement/IMeasurement.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.SharedLogic.Measurement
23 | {
24 | /// A time measurement. The number of calls made and their total time taken.
25 | public interface IMeasurement {
26 | double? ElapsedMS { get; }
27 | long? Calls { get; }
28 | }
29 | }
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/CalculatorService.Orleans.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net472
6 | true
7 | false
8 | $(SolutionDir)main.ruleset
9 |
10 |
11 |
12 | PreserveNewest
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Configuration/IConfigItem.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Collections.Generic;
24 |
25 | namespace Gigya.Microdot.Interfaces.Configuration
26 | {
27 | public interface IConfigItem
28 | {
29 | string Key { get; set; }
30 |
31 | string Value { get; set; }
32 |
33 | List Overrides { get; }
34 | }
35 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.ServiceProxy/Caching/EmptyRevokeListener.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks.Dataflow;
24 |
25 | namespace Gigya.Microdot.ServiceProxy.Caching
26 | {
27 | public class EmptyRevokeListener : IRevokeListener
28 | {
29 | public ISourceBlock RevokeSource { get; set; } = new WriteOnceBlock(message => message);
30 | }
31 | }
--------------------------------------------------------------------------------
/Metrics/Json/JsonGauge.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Collections.Generic;
3 | using Metrics.MetricData;
4 |
5 | namespace Metrics.Json
6 | {
7 | public class JsonGauge : JsonMetric
8 | {
9 | private double value;
10 |
11 | public double? Value { get { return this.value; } set { this.value = value ?? double.NaN; } }
12 |
13 | public static JsonGauge FromGauge(MetricValueSource gauge)
14 | {
15 | return new JsonGauge
16 | {
17 | Name = gauge.Name,
18 | Value = gauge.Value,
19 | Unit = gauge.Unit.Name,
20 | Tags = gauge.Tags
21 | };
22 | }
23 |
24 | public JsonObject ToJsonObject()
25 | {
26 | return new JsonObject(ToJsonProperties());
27 | }
28 |
29 | public IEnumerable ToJsonProperties()
30 | {
31 | yield return new JsonProperty("Name", this.Name);
32 | yield return new JsonProperty("Value", this.Value.Value);
33 | yield return new JsonProperty("Unit", this.Unit);
34 |
35 | if (this.Tags.Length > 0)
36 | {
37 | yield return new JsonProperty("Tags", this.Tags);
38 | }
39 | }
40 |
41 | public GaugeValueSource ToValueSource()
42 | {
43 | return new GaugeValueSource(this.Name, ConstantValue.Provider(this.Value.Value), this.Unit, this.Tags);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Configuration/Benchmark/ConfigCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks.Dataflow;
3 | using Gigya.Microdot.ServiceDiscovery.Config;
4 |
5 | namespace Gigya.Microdot.UnitTests.Configuration.Benchmark
6 | {
7 | public abstract class ConfigCreatorBase where T : class
8 | {
9 | protected readonly T _config;
10 |
11 | protected ConfigCreatorBase(T config)
12 | {
13 | _config = config;
14 | }
15 |
16 | public virtual T GetConfig()
17 | {
18 | return _config;
19 | }
20 | }
21 |
22 | public class ConfigCreatorObject : ConfigCreatorBase
23 | {
24 | public ConfigCreatorObject(DiscoveryConfig config) : base(config)
25 | {}
26 | }
27 |
28 | public class ConfigCreatorFuncObject : ConfigCreatorBase>
29 | {
30 | public ConfigCreatorFuncObject(Func config) : base(config)
31 | {}
32 | }
33 |
34 | public class ConfigCreatorISourceBlockObject : ConfigCreatorBase>
35 | {
36 | public ConfigCreatorISourceBlockObject(ISourceBlock config) : base(config)
37 | {}
38 | }
39 |
40 | public class ConfigCreatorFuncISourceBlockObject : ConfigCreatorBase>>
41 | {
42 | public ConfigCreatorFuncISourceBlockObject(Func> config) : base(config)
43 | {}
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Logging.NLog/LogEventPublisher.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 | using Gigya.Microdot.Interfaces.Events;
5 | using Gigya.Microdot.Interfaces.Logging;
6 |
7 | namespace Gigya.Microdot.Logging.NLog
8 | {
9 | ///
10 | /// Publishes distributed tracing events to the log. Should only be used when no other event publishing system is available.
11 | ///
12 | public class LogEventPublisher : IEventPublisher
13 | {
14 | private ILog Log { get; }
15 | private IEventSerializer Serializer { get; }
16 |
17 | public LogEventPublisher(ILog log, IEventSerializer serializer)
18 | {
19 | Log = log;
20 | Serializer = serializer;
21 | }
22 |
23 | public PublishingTasks TryPublish(IEvent evt)
24 | {
25 | var fields = Serializer.Serialize(evt);
26 |
27 | Log.Debug(l => l("Tracing event",
28 | unencryptedTags: fields.Where(_ => !_.Attribute.Encrypt).Select(_ => new KeyValuePair(_.Name, _.Value)),
29 | encryptedTags: fields.Where(_ => _.Attribute.Encrypt).Select(_ => new KeyValuePair(_.Name, _.Value))));
30 |
31 | return new PublishingTasks
32 | {
33 | PublishEvent = Task.FromResult(true),
34 | PublishAudit = Task.FromResult(false),
35 | SerializedEventFields = fields,
36 | };
37 | }
38 |
39 | }
40 | }
--------------------------------------------------------------------------------
/Metrics/Endpoints/MetricsEndpoint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Metrics.Endpoints
4 | {
5 | public sealed class MetricsEndpoint
6 | {
7 | private readonly Func responseFactory;
8 |
9 | public readonly string Endpoint;
10 |
11 | public MetricsEndpointResponse ProduceResponse(MetricsEndpointRequest request) => this.responseFactory(request);
12 |
13 | public MetricsEndpoint(string endpoint, Func responseFactory)
14 | {
15 | if (responseFactory == null)
16 | {
17 | throw new ArgumentNullException(nameof(responseFactory));
18 | }
19 |
20 | this.Endpoint = NormalizeEndpoint(endpoint);
21 |
22 | this.responseFactory = responseFactory;
23 | }
24 |
25 | public bool IsMatch(string matchWith)
26 | {
27 | var normalizedMatchWith = NormalizeEndpoint(matchWith);
28 | return string.Equals(this.Endpoint, normalizedMatchWith, StringComparison.InvariantCultureIgnoreCase);
29 | }
30 |
31 | private static string NormalizeEndpoint(string endpoint)
32 | {
33 | if (string.IsNullOrWhiteSpace(endpoint) || endpoint == "/")
34 | {
35 | throw new ArgumentException("Endpoint path cannot be empty");
36 | }
37 |
38 | return endpoint.TrimStart('/');
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Metrics/MetricData/MetricsDataProvider.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace Metrics.MetricData
4 | {
5 | ///
6 | /// A provider capable of returning the current values for a set of metrics
7 | ///
8 | public interface MetricsDataProvider : Utils.IHideObjectMembers
9 | {
10 | ///
11 | /// Returns the current metrics data for the context for which this provider has been created.
12 | ///
13 | MetricsData CurrentMetricsData { get; }
14 | }
15 |
16 | public sealed class FilteredMetrics : MetricsDataProvider
17 | {
18 | private readonly MetricsDataProvider provider;
19 | private readonly MetricsFilter filter;
20 |
21 | public FilteredMetrics(MetricsDataProvider provider, MetricsFilter filter)
22 | {
23 | this.provider = provider;
24 | this.filter = filter;
25 | }
26 |
27 | public MetricsData CurrentMetricsData
28 | {
29 | get
30 | {
31 | return this.provider.CurrentMetricsData.Filter(this.filter);
32 | }
33 | }
34 | }
35 |
36 | public static class FilteredMetricsExtensions
37 | {
38 | public static MetricsDataProvider WithFilter(this MetricsDataProvider provider, MetricsFilter filter)
39 | {
40 | if(filter == null)
41 | {
42 | return provider;
43 | }
44 | return new FilteredMetrics(provider, filter);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Client/CalculatorService.Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net472
6 | true
7 | true
8 | 1591
9 |
10 |
11 |
12 | PreserveNewest
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Sample/CalculatorService.Orleans/CalculatorServiceHost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Gigya.Microdot.Logging.NLog;
3 | using Gigya.Microdot.Ninject;
4 | using Gigya.Microdot.Orleans.Ninject.Host;
5 | using System.Threading.Tasks;
6 | using Orleans;
7 |
8 | namespace CalculatorService.Orleans
9 | {
10 |
11 | class CalculatorServiceHost : MicrodotOrleansServiceHost
12 | {
13 | public override string ServiceName => nameof(CalculatorService);
14 |
15 | static void Main(string[] args)
16 | {
17 | try
18 | {
19 | new CalculatorServiceHost().Run();
20 | }
21 | catch (Exception ex)
22 | {
23 | Console.Error.WriteLine(ex);
24 | }
25 | }
26 |
27 | public override ILoggingModule GetLoggingModule() => new NLogModule();
28 |
29 | protected override async Task AfterOrleansStartup(IGrainFactory grainFactory)
30 | {
31 | //StartGeneratingPerSiloGrainMessages(grainFactory);
32 | }
33 |
34 | public override Type PerSiloGrainType => typeof(MyPerSiloGrain);
35 | async void StartGeneratingPerSiloGrainMessages(IGrainFactory grainFactory)
36 | {
37 | int count = 0;
38 | while (true) {
39 | var grain = grainFactory.GetGrain>(0);
40 | try { await grain.Publish(count++); }
41 | catch {}
42 | await Task.Delay(2000);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/Discovery/LocalNodeSourceTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Net;
4 | using Gigya.Microdot.Fakes;
5 | using Gigya.Microdot.Interfaces.SystemWrappers;
6 | using Gigya.Microdot.ServiceDiscovery;
7 | using Gigya.Microdot.ServiceDiscovery.Rewrite;
8 | using Gigya.Microdot.Testing.Shared;
9 | using Ninject;
10 | using NSubstitute;
11 | using NUnit.Framework;
12 | using Shouldly;
13 |
14 | namespace Gigya.Microdot.UnitTests.Discovery
15 | {
16 | public class LocalNodeSourceTests
17 | {
18 | private TestingKernel _kernel;
19 | private INodeSource _localNodeSource;
20 |
21 | [OneTimeSetUp]
22 | public void OneTimeSetup()
23 | {
24 | _kernel = new TestingKernel();
25 | }
26 |
27 | [OneTimeTearDown]
28 | public void OneTimeTearDown()
29 | {
30 | _kernel.Dispose();
31 | }
32 |
33 | [SetUp]
34 | public void Setup()
35 | {
36 | var deployment = new DeploymentIdentifier("MyService", "prod", Substitute.For());
37 |
38 | _localNodeSource = _kernel.Get>()(deployment);
39 | }
40 |
41 | [Test]
42 | public void OneSingleLocalHostNode()
43 | {
44 | var node = _localNodeSource.GetNodes().Single();
45 | node.Hostname.ShouldBe(Dns.GetHostName());
46 | node.Port.ShouldBeNull();
47 | }
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Hosting.UnitTests/NonOrleansMicroService/ICalculatorService.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks;
24 | using Gigya.Common.Contracts.HttpService;
25 |
26 | namespace Gigya.Microdot.Hosting.UnitTests.NonOrleansMicroService
27 | {
28 | [HttpService(12323)]
29 | public interface ICalculatorService
30 | {
31 | Task Add(int a, int b);
32 | }
33 | }
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.UnitTests/StringExtensionsTest.cs:
--------------------------------------------------------------------------------
1 | using Gigya.Microdot.SharedLogic.Utils;
2 |
3 | using NUnit.Framework;
4 |
5 | using Shouldly;
6 | using Gigya.Microdot.LanguageExtensions;
7 |
8 | namespace Gigya.Microdot.UnitTests
9 | {
10 | [TestFixture,Parallelizable(ParallelScope.Fixtures)]
11 | public class StringExtensionsTest
12 | {
13 | [TestCase(@"c:\foo", @"c:", true)]
14 | [TestCase(@"c:\foo", @"c:\", true)]
15 | [TestCase(@"c:\foo", @"c:\foo", true)]
16 | [TestCase(@"c:\foo", @"c:\foo\", true)]
17 | [TestCase(@"c:\foo\", @"c:\foo", true)]
18 | [TestCase(@"c:\foo\bar\", @"c:\foo\", true)]
19 | [TestCase(@"c:\foo\bar", @"c:\foo\", true)]
20 | [TestCase(@"c:\foo\a.txt", @"c:\foo", true)]
21 | [TestCase(@"c:\FOO\a.txt", @"c:\foo", true)]
22 | [TestCase(@"c:/foo/a.txt", @"c:\foo", true)]
23 | [TestCase(@"c:\foobar", @"c:\foo", false)]
24 | [TestCase(@"c:\foobar\a.txt", @"c:\foo", false)]
25 | [TestCase(@"c:\foobar\a.txt", @"c:\foo\", false)]
26 | [TestCase(@"c:\foo\a.txt", @"c:\foobar", false)]
27 | [TestCase(@"c:\foo\a.txt", @"c:\foobar\", false)]
28 | [TestCase(@"c:\foo\..\bar\baz", @"c:\foo", false)]
29 | [TestCase(@"c:\foo\..\bar\baz", @"c:\bar", true)]
30 | [TestCase(@"c:\foo\..\bar\baz", @"c:\barr", false)]
31 | public void IsSubPathOfTest(string path, string baseDirPath, bool isSubPath)
32 | {
33 | path.IsSubPathOf(baseDirPath).ShouldBe(isSubPath);
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Gigya.Microdot.Hosting/Service/ServiceWarmup.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | using System.Threading.Tasks;
24 | using Gigya.Microdot.Hosting.HttpService;
25 |
26 | namespace Gigya.Microdot.Hosting.Service
27 | {
28 | public class ServiceWarmup : IWarmup
29 | {
30 | public bool IsServiceWarmed { get; } = true;
31 |
32 | public void Warmup()
33 | {
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Gigya.Microdot.Interfaces/Events/IEventPublisher.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 |
23 | namespace Gigya.Microdot.Interfaces.Events
24 | {
25 | public interface IEventPublisher
26 | {
27 | PublishingTasks TryPublish(IEvent evt);
28 | }
29 |
30 | public interface IEventPublisher where T : IEvent
31 | {
32 | PublishingTasks TryPublish(T evt);
33 | T CreateEvent();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Gigya.Microdot.SharedLogic/PortOffsets.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 | // Copyright 2017 Gigya Inc. All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
11 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
14 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
15 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 | // POSSIBILITY OF SUCH DAMAGE.
21 | #endregion
22 | namespace Gigya.Microdot.SharedLogic
23 | {
24 | public enum PortOffsets
25 | {
26 | Http = 0,
27 | SiloGateway = 1, // TODO: Once everyone is using the ServiceProxy, don't open the silo gateway port
28 | SiloNetworking = 2,
29 | Metrics = 3,
30 | SiloDashboard = 4,
31 | Https = 5,
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/AgeLimitService/GrainStubAgeLimitTestedService2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading.Tasks;
4 | using Gigya.Common.Contracts.HttpService;
5 | using Orleans;
6 | using Orleans.Concurrency;
7 | using Orleans.Providers;
8 |
9 | namespace Gigya.Microdot.Orleans.Hosting.UnitTests.Microservice.AgeLimitService
10 | {
11 |
12 | [HttpService(7146)]
13 |
14 | public interface IGrainStubAgeLimitDefaultTime1MinuteService : IGrainStubAgeLimitTested,IGrainWithIntegerKey
15 | {
16 | }
17 |
18 |
19 | [Reentrant]
20 | [StorageProvider(ProviderName = "OrleansStorage")]
21 | public class GrainStubAgeLimitDefaultTime1MinuteService : Grain, IGrainStubAgeLimitDefaultTime1MinuteService
22 | {
23 | private Stopwatch _stopWatch;
24 |
25 | public async Task Activate()
26 | {
27 | _stopWatch = new Stopwatch();
28 | _stopWatch.Start();
29 |
30 | State = _stopWatch.Elapsed;
31 | await this.WriteStateAsync();
32 |
33 | return true;
34 | }
35 |
36 | public async Task GetTimeStamp()
37 | {
38 | await ReadStateAsync();
39 | return State;
40 | }
41 |
42 | public override Task OnDeactivateAsync()
43 | {
44 | _stopWatch.Stop();
45 | State = _stopWatch.Elapsed;
46 | WriteStateAsync();
47 |
48 | return base.OnDeactivateAsync();
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------