Skip to content

Commit e392da9

Browse files
ananth7592Copilot
andcommitted
ChangeFeed: Adds Full Fidelity Change Feed APIs to GA surface
Removes #if PREVIEW guards from 7 types/members to make them unconditionally public, promoting the AllVersionsAndDeletes mode from Preview to GA: 1. ChangeFeedMode.AllVersionsAndDeletes 2. ChangeFeedItem<T> 3. ChangeFeedMetadata 4. ChangeFeedOperationType 5. ChangeFeedPolicy 6. ChangeFeedPolicyDefinition 7. ContainerProperties.ChangeFeedPolicy 8. ContainerBuilder.WithChangeFeedPolicy Updates GA and Preview API contract files accordingly. Closes #5814 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 377c5b5 commit e392da9

11 files changed

Lines changed: 15229 additions & 15249 deletions

File tree

Microsoft.Azure.Cosmos/contracts/API_3.59.0.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,42 @@ namespace Microsoft.Azure.Cosmos
4444
public ChangeFeedEstimatorRequestOptions();
4545
public Nullable<int> MaxItemCount { get; set; }
4646
}
47+
public class ChangeFeedItem<T>
48+
{
49+
public ChangeFeedItem();
50+
public T Current { get; set; }
51+
public ChangeFeedMetadata Metadata { get; set; }
52+
public T Previous { get; set; }
53+
}
54+
public class ChangeFeedMetadata
55+
{
56+
public ChangeFeedMetadata();
57+
public DateTime ConflictResolutionTimestamp { get; }
58+
public string Id { get; }
59+
public bool IsTimeToLiveExpired { get; }
60+
public long Lsn { get; }
61+
public ChangeFeedOperationType OperationType { get; }
62+
public Dictionary<string, object> PartitionKey { get; }
63+
public long PreviousLsn { get; }
64+
}
4765
public abstract class ChangeFeedMode
4866
{
67+
public static ChangeFeedMode AllVersionsAndDeletes { get; }
4968
public static ChangeFeedMode Incremental { get; }
5069
public static ChangeFeedMode LatestVersion { get; }
5170
}
71+
public enum ChangeFeedOperationType
72+
{
73+
Create = 0,
74+
Delete = 2,
75+
Replace = 1,
76+
}
77+
public sealed class ChangeFeedPolicy
78+
{
79+
public ChangeFeedPolicy();
80+
public static TimeSpan FullFidelityNoRetention { get; }
81+
public TimeSpan FullFidelityRetention { get; set; }
82+
}
5283
public abstract class ChangeFeedProcessor
5384
{
5485
protected ChangeFeedProcessor();
@@ -239,6 +270,7 @@ namespace Microsoft.Azure.Cosmos
239270
public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable<TimeSpan> estimationPeriod=default(Nullable<TimeSpan>));
240271
public abstract FeedIterator<T> GetChangeFeedIterator<T>(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null);
241272
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate);
273+
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(string processorName, Container.ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate);
242274
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate);
243275
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint<T>(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint<T> onChangesDelegate);
244276
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder<T>(string processorName, Container.ChangeFeedHandler<T> onChangesDelegate);
@@ -286,6 +318,7 @@ namespace Microsoft.Azure.Cosmos
286318
public ContainerProperties(string id, IReadOnlyList<string> partitionKeyPaths);
287319
public ContainerProperties(string id, string partitionKeyPath);
288320
public Nullable<int> AnalyticalStoreTimeToLiveInSeconds { get; set; }
321+
public ChangeFeedPolicy ChangeFeedPolicy { get; set; }
289322
public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; }
290323
public Collection<ComputedProperty> ComputedProperties { get; set; }
291324
public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; }
@@ -1274,6 +1307,10 @@ namespace Microsoft.Azure.Cosmos.FaultInjection
12741307
}
12751308
namespace Microsoft.Azure.Cosmos.Fluent
12761309
{
1310+
public class ChangeFeedPolicyDefinition
1311+
{
1312+
public ContainerBuilder Attach();
1313+
}
12771314
public sealed class ClientEncryptionPolicyDefinition
12781315
{
12791316
public ContainerBuilder Attach();
@@ -1305,6 +1342,7 @@ namespace Microsoft.Azure.Cosmos.Fluent
13051342
public Task<ContainerResponse> CreateAsync(Nullable<int> throughput=default(Nullable<int>), CancellationToken cancellationToken=default(CancellationToken));
13061343
public Task<ContainerResponse> CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken));
13071344
public Task<ContainerResponse> CreateIfNotExistsAsync(Nullable<int> throughput=default(Nullable<int>), CancellationToken cancellationToken=default(CancellationToken));
1345+
public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention);
13081346
public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy();
13091347
public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion);
13101348
public ConflictResolutionDefinition WithConflictResolution();

Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ internal ChangeFeedMode()
5353
/// but no events for deletes or intermediary updates would be included.
5454
/// </remarks>
5555
/// <returns>A <see cref="ChangeFeedMode"/> to receive notifications for insertions, updates, and delete operations.</returns>
56-
#if PREVIEW
57-
public
58-
#else
59-
internal
60-
#endif
61-
static ChangeFeedMode AllVersionsAndDeletes => ChangeFeedModeFullFidelity.Instance;
56+
public static ChangeFeedMode AllVersionsAndDeletes => ChangeFeedModeFullFidelity.Instance;
6257
}
6358
}

Microsoft.Azure.Cosmos/src/Fluent/Settings/ChangeFeedPolicyDefinition.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ namespace Microsoft.Azure.Cosmos.Fluent
99
/// <summary>
1010
/// <see cref="ChangeFeedPolicy"/> fluent definition.
1111
/// </summary>
12-
#if PREVIEW
13-
public
14-
#else
15-
internal
16-
#endif
17-
class ChangeFeedPolicyDefinition
12+
public class ChangeFeedPolicyDefinition
1813
{
1914
private readonly ContainerBuilder parent;
2015
private readonly Action<ChangeFeedPolicy> attachCallback;

Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ public ConflictResolutionDefinition WithConflictResolution()
7878
/// </summary>
7979
/// <param name="retention"> Indicates for how long operation logs have to be retained. <see cref="ChangeFeedPolicy.FullFidelityRetention"/>.</param>
8080
/// <returns>An instance of <see cref="ChangeFeedPolicyDefinition"/>.</returns>
81-
#if PREVIEW
82-
public
83-
#else
84-
internal
85-
#endif
86-
ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention)
81+
public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention)
8782
{
8883
return new ChangeFeedPolicyDefinition(
8984
this,

Microsoft.Azure.Cosmos/src/Resource/FullFidelity/ChangeFeedItem.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ namespace Microsoft.Azure.Cosmos
4949
/// </code>
5050
/// </example>
5151
/// <remarks><see cref="ChangeFeedItem{T}"/> is an optional helper class that uses Newtonsoft serialization libraries. Users are welcome to create their own custom helper class.</remarks>
52-
#if PREVIEW
53-
public
54-
#else
55-
internal
56-
#endif
57-
class ChangeFeedItem<T>
52+
public class ChangeFeedItem<T>
5853
{
5954
/// <summary>
6055
/// The current version of the item for all versions and deletes change feed mode.

Microsoft.Azure.Cosmos/src/Resource/FullFidelity/ChangeFeedMetadata.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ namespace Microsoft.Azure.Cosmos
1515
/// <summary>
1616
/// The metadata of a change feed resource with <see cref="ChangeFeedMode"/> is initialized to <see cref="ChangeFeedMode.AllVersionsAndDeletes"/>.
1717
/// </summary>
18-
#if PREVIEW
19-
public
20-
#else
21-
internal
22-
#endif
23-
class ChangeFeedMetadata
18+
public class ChangeFeedMetadata
2419
{
2520
private readonly static DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
2621

Microsoft.Azure.Cosmos/src/Resource/FullFidelity/ChangeFeedOperationType.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ namespace Microsoft.Azure.Cosmos
99
/// <summary>
1010
/// The operation type of a change feed resource with <see cref="ChangeFeedMode"/> is initialized to <see cref="ChangeFeedMode.AllVersionsAndDeletes"/>. Upsert operations will yield <see cref="Create"/> or <see cref="Replace"/>.
1111
/// </summary>
12-
#if PREVIEW
13-
public
14-
#else
15-
internal
16-
#endif
17-
enum ChangeFeedOperationType
12+
public enum ChangeFeedOperationType
1813
{
1914
/// <summary>
2015
/// The create operation type.

Microsoft.Azure.Cosmos/src/Resource/Settings/ChangeFeedPolicy.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ namespace Microsoft.Azure.Cosmos
3131
/// </code>
3232
/// </example>
3333
/// <seealso cref="ContainerProperties"/>
34-
#if PREVIEW
35-
public
36-
#else
37-
internal
38-
#endif
39-
sealed class ChangeFeedPolicy
34+
public sealed class ChangeFeedPolicy
4035
{
4136
[JsonProperty(PropertyName = Constants.Properties.LogRetentionDuration)]
4237
private int retentionDurationInMinutes = 0;

Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,7 @@ public FullTextPolicy FullTextPolicy
379379
/// The change feed policy associated with the container.
380380
/// </value>
381381
[JsonIgnore]
382-
#if PREVIEW
383-
public
384-
#else
385-
internal
386-
#endif
387-
ChangeFeedPolicy ChangeFeedPolicy
382+
public ChangeFeedPolicy ChangeFeedPolicy
388383
{
389384
get
390385
{

0 commit comments

Comments
 (0)