Skip to content

Commit

Permalink
Merge branch 'main' into cachecurrentprocessinprocessinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyfedorov2 authored Nov 6, 2024
2 parents 9453453 + f05cf03 commit caf2188
Show file tree
Hide file tree
Showing 45 changed files with 1,819 additions and 143 deletions.
123 changes: 98 additions & 25 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,28 +1,101 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence,
# @dotnet/dotnet-extensions-fundamentals will be requested for review when someone opens a pull request.

*.cmd @dotnet/dotnet-extensions-infra
*.sh @dotnet/dotnet-extensions-infra
*.ps1 @dotnet/dotnet-extensions-infra
*.yml @dotnet/dotnet-extensions-infra
*.props @dotnet/dotnet-extensions-infra
*.targets @dotnet/dotnet-extensions-infra
/global.json @dotnet/dotnet-extensions-infra
/.azure/ @dotnet/dotnet-extensions-infra
/.azuredevops/ @dotnet/dotnet-extensions-infra
/.config/ @dotnet/dotnet-extensions-infra
/.devcontainer/ @dotnet/dotnet-extensions-infra
/.vscode/ @dotnet/dotnet-extensions-infra
/.github/ @dotnet/dotnet-extensions-infra
/docs/ @dotnet/dotnet-extensions-infra
/eng/ @dotnet/dotnet-extensions-infra

/src/Libraries/Microsoft.Extensions.AI @dotnet/dotnet-extensions-ai
/src/Libraries/Microsoft.Extensions.AI.* @dotnet/dotnet-extensions-ai
/test/Libraries/Microsoft.Extensions.AI @dotnet/dotnet-extensions-ai
/test/Libraries/Microsoft.Extensions.AI.* @dotnet/dotnet-extensions-ai

/src/Libraries/Microsoft.Extensions.Caching.Hybrid @dotnet/dotnet-extensions-caching-hybrid
/src/Libraries/Microsoft.Extensions.Caching.Hybrid.* @dotnet/dotnet-extensions-caching-hybrid
/test/Libraries/Microsoft.Extensions.Caching.Hybrid @dotnet/dotnet-extensions-caching-hybrid
/test/Libraries/Microsoft.Extensions.Caching.Hybrid.* @dotnet/dotnet-extensions-caching-hybrid
*.cmd @dotnet/dotnet-extensions-infra
*.sh @dotnet/dotnet-extensions-infra
*.ps1 @dotnet/dotnet-extensions-infra
*.yml @dotnet/dotnet-extensions-infra
*.props @dotnet/dotnet-extensions-infra
*.targets @dotnet/dotnet-extensions-infra
/global.json @dotnet/dotnet-extensions-infra
/.azure/ @dotnet/dotnet-extensions-infra
/.azuredevops/ @dotnet/dotnet-extensions-infra
/.config/ @dotnet/dotnet-extensions-infra
/.devcontainer/ @dotnet/dotnet-extensions-infra
/.vscode/ @dotnet/dotnet-extensions-infra
/.github/ @dotnet/dotnet-extensions-infra
/docs/ @dotnet/dotnet-extensions-infra
/eng/ @dotnet/dotnet-extensions-infra

/src/Libraries/Microsoft.Extensions.AI @dotnet/dotnet-extensions-ai
/src/Libraries/Microsoft.Extensions.AI.* @dotnet/dotnet-extensions-ai
/test/Libraries/Microsoft.Extensions.AI @dotnet/dotnet-extensions-ai
/test/Libraries/Microsoft.Extensions.AI.* @dotnet/dotnet-extensions-ai

/src/Libraries/Microsoft.Extensions.Caching.Hybrid @dotnet/dotnet-extensions-caching-hybrid
/src/Libraries/Microsoft.Extensions.Caching.Hybrid.* @dotnet/dotnet-extensions-caching-hybrid
/test/Libraries/Microsoft.Extensions.Caching.Hybrid @dotnet/dotnet-extensions-caching-hybrid
/test/Libraries/Microsoft.Extensions.Caching.Hybrid.* @dotnet/dotnet-extensions-caching-hybrid

/src/Analyzers/Microsoft.Analyzers.Extra @dotnet/dotnet-extensions-analyzers
/src/Analyzers/Microsoft.Analyzers.Local @dotnet/dotnet-extensions-analyzers
/src/Packages/Microsoft.Extensions.StaticAnalysis @dotnet/dotnet-extensions-analyzers
/test/Analyzers/Microsoft.Analyzers.Extra.* @dotnet/dotnet-extensions-analyzers
/test/Analyzers/Microsoft.Analyzers.Local.* @dotnet/dotnet-extensions-analyzers

/src/Generators/Microsoft.Gen.ComplianceReports @dotnet/dotnet-extensions-compliance
/src/Libraries/Microsoft.Extensions.Compliance.Abstractions @dotnet/dotnet-extensions-compliance
/src/Libraries/Microsoft.Extensions.Compliance.Redaction @dotnet/dotnet-extensions-compliance
/src/Libraries/Microsoft.Extensions.Compliance.Testing @dotnet/dotnet-extensions-compliance
/src/Packages/Microsoft.Extensions.AuditReports @dotnet/dotnet-extensions-compliance
/test/Generators/Microsoft.Gen.ComplianceReports @dotnet/dotnet-extensions-compliance
/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.* @dotnet/dotnet-extensions-compliance
/test/Libraries/Microsoft.Extensions.Compliance.Redaction.* @dotnet/dotnet-extensions-compliance
/test/Libraries/Microsoft.Extensions.Compliance.Testing.* @dotnet/dotnet-extensions-compliance

/src/Generators/Microsoft.Gen.ContextualOptions @dotnet/dotnet-extensions-configuration
/src/Libraries/Microsoft.Extensions.Options.Contextual @dotnet/dotnet-extensions-configuration
/test/Generators/Microsoft.Gen.ContextualOptions @dotnet/dotnet-extensions-configuration
/test/Libraries/Microsoft.Extensions.Options.Contextual.* @dotnet/dotnet-extensions-configuration

/src/Libraries/Microsoft.AspNetCore.AsyncState @dotnet/dotnet-extensions-fundamentals
/src/Libraries/Microsoft.AspNetCore.HeaderParsing @dotnet/dotnet-extensions-fundamentals
/src/Libraries/Microsoft.Extensions.AsyncState @dotnet/dotnet-extensions-fundamentals
/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation @dotnet/dotnet-extensions-fundamentals
/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection @dotnet/dotnet-extensions-fundamentals
/src/Libraries/Microsoft.Extensions.TimeProvider.Testing @dotnet/dotnet-extensions-fundamentals
/src/Shared @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.AspNetCore.AsyncState.* @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.AspNetCore.HeaderParsing.* @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.Extensions.AsyncState.* @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation.* @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection.* @dotnet/dotnet-extensions-fundamentals
/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.* @dotnet/dotnet-extensions-fundamentals
/test/Shared.* @dotnet/dotnet-extensions-fundamentals

/src/Libraries/Microsoft.AspNetCore.Testing @dotnet/dotnet-extensions-hosting
/src/Libraries/Microsoft.Extensions.Hosting.Testing @dotnet/dotnet-extensions-hosting
/test/Libraries/Microsoft.AspNetCore.Testing.* @dotnet/dotnet-extensions-hosting
/test/Libraries/Microsoft.Extensions.Hosting.Testing.* @dotnet/dotnet-extensions-hosting

/src/Libraries/Microsoft.Extensions.Diagnostics.Probes @dotnet/dotnet-extensions-resilience
/src/Libraries/Microsoft.Extensions.Http.Resilience @dotnet/dotnet-extensions-resilience
/src/Libraries/Microsoft.Extensions.Resilience @dotnet/dotnet-extensions-resilience
/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.* @dotnet/dotnet-extensions-resilience
/test/Libraries/Microsoft.Extensions.Http.Resilience.* @dotnet/dotnet-extensions-resilience
/test/Libraries/Microsoft.Extensions.Resilience.* @dotnet/dotnet-extensions-resilience

/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.* @dotnet/dotnet-extensions-resourcemonitoring
/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring @dotnet/dotnet-extensions-resourcemonitoring
/test/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.* @dotnet/dotnet-extensions-resourcemonitoring
/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.* @dotnet/dotnet-extensions-resourcemonitoring

/src/Generators/Microsoft.Gen.Logging @dotnet/dotnet-extensions-telemetry
/src/Generators/Microsoft.Gen.Metrics @dotnet/dotnet-extensions-telemetry
/src/Generators/Microsoft.Gen.MetricsReports @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.Diagnostics.Testing @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.Http.Diagnostics @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.Telemetry.* @dotnet/dotnet-extensions-telemetry
/src/Libraries/Microsoft.Extensions.Telemetry @dotnet/dotnet-extensions-telemetry
/test/Generators/Microsoft.Gen.Logging @dotnet/dotnet-extensions-telemetry
/test/Generators/Microsoft.Gen.Metrics @dotnet/dotnet-extensions-telemetry
/test/Generators/Microsoft.Gen.MetricsReports @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.* @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.Extensions.AmbientMetadata.Application.* @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization.* @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.* @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.Extensions.Http.Diagnostics.* @dotnet/dotnet-extensions-telemetry
/test/Libraries/Microsoft.Extensions.Telemetry.* @dotnet/dotnet-extensions-telemetry
3 changes: 2 additions & 1 deletion eng/packages/TestOnly.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.13.5" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.65.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.2.3" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.3" />
<PackageVersion Include="Microsoft.ML.Tokenizers" Version="0.22.0-preview.24378.1" />
Expand All @@ -20,7 +21,7 @@
<PackageVersion Include="Verify.Xunit" Version="20.4.0" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.extensibility.execution" Version="2.4.2" />
<PackageVersion Include="JsonSchema.Net" Version="7.2.3" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
Expand Down
Binary file modified eng/spellchecking_exclusions.dic
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.ExtraAnalyzers</RootNamespace>
<Description>Code analyzers and fixers</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Analyzers</Workstream>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.LocalAnalyzers</RootNamespace>
<Description>Analyzers used only in this repo</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Analyzers</Workstream>
<Category>Static Analysis</Category>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.Gen.ComplianceReports</RootNamespace>
<Description>Produces compliance reports based on data classification annotations in the code.</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Compliance</Workstream>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.Gen.ContextualOptions</RootNamespace>
<Description>Code generator to support Microsoft.Extensions.Options.Contextual.</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Configuration</Workstream>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.AspNetCore.Testing</RootNamespace>
<Description>Test fakes for integration testing</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Hosting</Workstream>
<PackageTags>$(PackageTags);Testing</PackageTags>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<TargetFrameworks>$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2227;CA1034;SA1316;S3253</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<TargetFrameworks>$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA1063;CA2227;SA1316;S1067;S1121;S3358</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<TargetFrameworks>$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2227;SA1316;S1121;EA0002</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<TargetFrameworks>$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA1063;CA1508;CA2227;SA1316;S1121;S3358;EA0002</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<TargetFrameworks>$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2227;CA1034;SA1316;S1067;S1121;S1994;S3253</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Microsoft.Extensions.AmbientMetadata</RootNamespace>
<Description>Runtime information provider for application-level ambient metadata.</Description>
<Workstream>Fundamentals</Workstream>
<Workstream>Telemetry</Workstream>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Threading;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;

namespace Microsoft.Extensions.Caching.Hybrid.Internal;

Expand All @@ -22,7 +23,7 @@ internal abstract class CacheItem
// zero.
// This counter also drives cache lifetime, with the cache itself incrementing the count by one. In the
// case of mutable data, cache eviction may reduce this to zero (in cooperation with any concurrent readers,
// who incr/decr around their fetch), allowing safe buffer recycling.
// who increment/decrement around their fetch), allowing safe buffer recycling.

internal int RefCount => Volatile.Read(ref _refCount);

Expand Down Expand Up @@ -89,13 +90,18 @@ internal abstract class CacheItem<T> : CacheItem
{
public abstract bool TryGetSize(out long size);

// attempt to get a value that was *not* previously reserved
public abstract bool TryGetValue(out T value);
// Attempt to get a value that was *not* previously reserved.
// Note on ILogger usage: we don't want to propagate and store this everywhere.
// It is used for reporting deserialization problems - pass it as needed.
// (CacheItem gets into the IMemoryCache - let's minimize the onward reachable set
// of that cache, by only handing it leaf nodes of a "tree", not a "graph" with
// backwards access - we can also limit object size at the same time)
public abstract bool TryGetValue(ILogger log, out T value);

// get a value that *was* reserved, countermanding our reservation in the process
public T GetReservedValue()
public T GetReservedValue(ILogger log)
{
if (!TryGetValue(out var value))
if (!TryGetValue(log, out var value))
{
Throw();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Threading;
using Microsoft.Extensions.Logging;

namespace Microsoft.Extensions.Caching.Hybrid.Internal;

Expand Down Expand Up @@ -38,7 +39,7 @@ public void SetValue(T value, long size)
Size = size;
}

public override bool TryGetValue(out T value)
public override bool TryGetValue(ILogger log, out T value)
{
value = _value;
return true; // always available
Expand Down
Loading

0 comments on commit caf2188

Please sign in to comment.