-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Purview: Parallelize PSPC cold-cache scope refresh #5832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
taisirhassan
wants to merge
7
commits into
microsoft:main
Choose a base branch
from
taisirhassan:purview-parallel-scope-cache
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
be7ba94
Parallelize Purview PSPC cold cache path
taisirhassan 146949b
Cache Purview payment-required state for scope refresh
taisirhassan 1fc4870
Cache Purview payment-required state for scope refresh
taisirhassan ea6b2d4
Align Purview policy action dedupe and 402 caching
taisirhassan a60cbda
.NET: Implement best-effort caching for background job scope retrieva…
taisirhassan 557bd1f
Purview - feat: Enhance ScopedContentProcessor to queue ContentActivi…
taisirhassan ce1779b
docs: Update purview package README and AGENTS documentation to refle…
taisirhassan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/PaymentRequiredCacheEntry.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| namespace Microsoft.Agents.AI.Purview.Models.Common; | ||
|
|
||
| /// <summary> | ||
| /// Cached tenant-level payment required state. | ||
| /// </summary> | ||
| internal sealed class PaymentRequiredCacheEntry | ||
| { | ||
| /// <summary> | ||
| /// Creates a new instance of <see cref="PaymentRequiredCacheEntry"/>. | ||
| /// </summary> | ||
| /// <param name="message">The payment required error message.</param> | ||
| public PaymentRequiredCacheEntry(string? message) | ||
| { | ||
| this.Message = message; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The payment required error message. | ||
| /// </summary> | ||
| public string? Message { get; set; } | ||
| } |
23 changes: 23 additions & 0 deletions
23
dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/PaymentRequiredCacheKey.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| namespace Microsoft.Agents.AI.Purview.Models.Common; | ||
|
|
||
| /// <summary> | ||
| /// A cache key for tenant-level payment required state. | ||
| /// </summary> | ||
| internal sealed class PaymentRequiredCacheKey | ||
| { | ||
| /// <summary> | ||
| /// Creates a new instance of <see cref="PaymentRequiredCacheKey"/>. | ||
| /// </summary> | ||
| /// <param name="tenantId">The id of the tenant.</param> | ||
| public PaymentRequiredCacheKey(string tenantId) | ||
| { | ||
| this.TenantId = tenantId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The id of the tenant. | ||
| /// </summary> | ||
| public string TenantId { get; set; } | ||
| } |
44 changes: 44 additions & 0 deletions
44
dotnet/src/Microsoft.Agents.AI.Purview/Models/Jobs/ScopeRetrievalJob.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using Microsoft.Agents.AI.Purview.Models.Common; | ||
| using Microsoft.Agents.AI.Purview.Models.Requests; | ||
|
|
||
| namespace Microsoft.Agents.AI.Purview.Models.Jobs; | ||
|
|
||
| /// <summary> | ||
| /// Class representing a job that refreshes the protection scopes cache in the background. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Used by the parallel protection scopes retrieval path to warm the cache without blocking the | ||
| /// foreground ProcessContent call. | ||
| /// </remarks> | ||
| internal sealed class ScopeRetrievalJob : BackgroundJobBase | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ScopeRetrievalJob"/> class. | ||
| /// </summary> | ||
| /// <param name="request">The protection scopes request to send to Purview.</param> | ||
| /// <param name="cacheKey">The cache key used to store the response.</param> | ||
| /// <param name="processContentRequest">The original process content request that triggered scope retrieval.</param> | ||
| public ScopeRetrievalJob(ProtectionScopesRequest request, ProtectionScopesCacheKey cacheKey, ProcessContentRequest processContentRequest) | ||
| { | ||
| this.Request = request; | ||
| this.CacheKey = cacheKey; | ||
| this.ProcessContentRequest = processContentRequest; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the protection scopes request. | ||
| /// </summary> | ||
| public ProtectionScopesRequest Request { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the cache key used to store the response. | ||
| /// </summary> | ||
| public ProtectionScopesCacheKey CacheKey { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the original process content request that triggered scope retrieval. | ||
| /// </summary> | ||
| public ProcessContentRequest ProcessContentRequest { get; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.