Skip to content

Various ticket: Remove deprecated API #1717

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

Merged
merged 2 commits into from
Aug 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/Couchbase.Lite.Shared/API/Database/Collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ public sealed unsafe class Collection : IChangeObservable<CollectionChangedEvent
#region Properties

// Must be called inside self lock
#if !XAMARINIOS && !MONODROID
[MemberNotNullWhen(false, nameof(c4Db), nameof(_c4coll))]
#endif
internal bool IsClosed => c4Db == null || _c4coll == null || !NativeSafe.c4coll_isValid(_c4coll);

// Must be called inside self lock
Expand Down Expand Up @@ -948,9 +946,7 @@ internal bool IsIndexTrained(string name)
/// <summary>
/// Throws if this collection has been deleted, or its database closed.
/// </summary>
#if !XAMARINIOS && !MONOANDROID
[MemberNotNull(nameof(c4Db), nameof(_c4coll))]
#endif
internal void CheckCollectionValid()
{
using var scope = ThreadSafety.BeginLockedScope();
Expand Down Expand Up @@ -987,7 +983,7 @@ internal void PostDatabaseChanged()
if (nChanges == 0 || external != newExternal || docIDs.Count > 1000) {
if (docIDs.Count > 0) {
// Only notify if there are actually changes to send
var args = new CollectionChangedEventArgs(this, docIDs, Database);
var args = new CollectionChangedEventArgs(this, docIDs);
_databaseChanged.Fire(this, args);
docIDs = new List<string>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.
//

using System;
using System.Collections.Generic;
using System.Diagnostics;

Expand All @@ -24,9 +25,7 @@ namespace Couchbase.Lite
/// <summary>
/// The parameters of a collection changed event
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
public sealed class CollectionChangedEventArgs : DatabaseChangedEventArgs
#pragma warning restore CS0618 // Type or member is obsolete
public sealed class CollectionChangedEventArgs : EventArgs
{
#region Properties

Expand All @@ -35,14 +34,18 @@ public sealed class CollectionChangedEventArgs : DatabaseChangedEventArgs
/// </summary>
public Collection Collection { get; }

/// <summary>
/// Gets the document that was changed
/// </summary>
public IReadOnlyList<string> DocumentIDs { get; }

#endregion

#region Constructors

internal CollectionChangedEventArgs(Collection collection, IReadOnlyList<string> documentIDs,
Database database)
:base(database, documentIDs)
internal CollectionChangedEventArgs(Collection collection, IReadOnlyList<string> documentIDs)
{
DocumentIDs = documentIDs;
Collection = collection;
}

Expand Down
317 changes: 1 addition & 316 deletions src/Couchbase.Lite.Shared/API/Database/Database.cs

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions src/Couchbase.Lite.Shared/API/Database/DatabaseChangedEventArgs.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ public sealed class DocumentChangedEventArgs : EventArgs
/// </summary>
public string DocumentID { get; }

/// <summary>
/// [DEPRECATED] The source of the document that changed
/// </summary>
[Obsolete("Database is deprecated, please use Collection property instead")]
public Database Database { get; }

/// <summary>
/// The source of the document that changed
/// </summary>
Expand All @@ -52,9 +46,6 @@ internal DocumentChangedEventArgs(string documentID, Collection collection)
{
DocumentID = documentID;
Collection = collection;
#pragma warning disable CS0618 // Type or member is obsolete
Database = collection.Database;
#pragma warning restore CS0618 // Type or member is obsolete
}

#endregion
Expand Down
2 changes: 0 additions & 2 deletions src/Couchbase.Lite.Shared/API/Database/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ internal bool DeleteCollection(string name, string scope)

#region Private Methods

#if !XAMARINIOS && !MONODROID
[MemberNotNull(nameof(c4Db))]
#endif
private void CheckOpen()
{
if (c4Db == null) {
Expand Down
39 changes: 0 additions & 39 deletions src/Couchbase.Lite.Shared/API/Info/Defaults_Deprecated.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/Couchbase.Lite.Shared/API/Query/DataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,6 @@ public static IDataSourceAs Collection(Collection collection)
return new DatabaseSource(c, c.ThreadSafety);
}

/// <summary>
/// [DEPRECATED] Creates a data source for an <see cref="IQuery" /> that gets results from the given
/// <see cref="Database" />
/// </summary>
/// <param name="database">The database to operate on</param>
/// <returns>The source of data for the <see cref="IQuery" /></returns>
[Obsolete("DataSource.Database is deprecated, please use DataSource.Collection")]
public static IDataSourceAs Database(Database database)
{
var db = CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(database), database);

return new DatabaseSource(database, db.ThreadSafety);
}

#endregion
}
}
46 changes: 0 additions & 46 deletions src/Couchbase.Lite.Shared/API/Query/FullTextExpression.cs

This file was deleted.

21 changes: 0 additions & 21 deletions src/Couchbase.Lite.Shared/API/Query/FullTextFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,6 @@ namespace Couchbase.Lite.Query
/// </summary>
public static class FullTextFunction
{
/// <summary>
/// Create a full-text matching function that will check for matches between given
/// full text index name and the given query expression
/// </summary>
/// <param name="indexName">The name of the full-text index to perform the
/// check against</param>
/// <param name="query">The query expression to perform the check against</param>
/// <returns>A function that will perform the matching</returns>
[Obsolete("Use Match(index, query) instead")]
public static IExpression Match(string indexName, string query) =>
Match(Expression.FullTextIndex(indexName), query);

/// <summary>
/// Creates a full-text ranking value function indicating how well the current
/// query result matches the full-text query when performing the match comparison.
/// </summary>
/// <param name="indexName">The FTS index name to use when performing the calculation</param>
/// <returns>A function that will perform the ranking</returns>
[Obsolete("Use Rank(index) instead")]
public static IExpression Rank(string indexName) => Rank(Expression.FullTextIndex(indexName));

/// <summary>
/// Create a full-text matching function that will check for matches between given
/// full text index name and the given query expression
Expand Down
16 changes: 0 additions & 16 deletions src/Couchbase.Lite.Shared/API/Query/IExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ public interface IExpression
/// <returns>The expression representing the new operation</returns>
IExpression IsNot(IExpression expression);

/// <summary>
/// [DEPRECATED] Gets an expression representing if the current expression is null
/// or missing (i.e. does not have a value)
/// </summary>
/// <returns>The expression representing the new operation</returns>
[Obsolete("This query expression deprecated, please use IsNotValued().")]
IExpression IsNullOrMissing();

/// <summary>
/// Gets an expression representing if the current expression has a value
/// </summary>
Expand Down Expand Up @@ -184,14 +176,6 @@ public interface IExpression
/// <returns>The expression representing the new operation</returns>
IExpression NotEqualTo(IExpression expression);

/// <summary>
/// [DEPRECATED] Gets an expression representing if the current expression is neither null
/// nor missing (i.e. has a value)
/// </summary>
/// <returns>The expression representing the new operation</returns>
[Obsolete("This query expression deprecated, please use IsValued().")]
IExpression NotNullOrMissing();

/// <summary>
/// Logically "ors" the given expression with the current expression
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Foundation;
using LiteCore.Interop;
using System;
using System.Linq;
using System.Threading;
using UIKit;

Expand All @@ -46,7 +47,7 @@ private NSFileProtection FileProtection
{
get {
#pragma warning disable CS0618 // Type or member is obsolete
var attrs = NSFileManager.DefaultManager.GetAttributes(Config.Database.Path!);
var attrs = NSFileManager.DefaultManager.GetAttributes(Config.Collections.First().Database.Path!);
return attrs?.ProtectionKey ?? NSFileProtection.None;
#pragma warning restore CS0618 // Type or member is obsolete
}
Expand Down
30 changes: 0 additions & 30 deletions src/Couchbase.Lite.Shared/API/Sync/Replicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,36 +373,6 @@ public void Stop()
});
}

/// <summary>
/// [DEPRECATED] Gets a list of document IDs that are going to be pushed, but have not been pushed yet
/// <item type="bullet">
/// <description>API is a snapshot and results may change between the time the call was made and the time</description>
/// </item>
/// </summary>
/// <returns>An immutable set of strings, each of which is a document ID</returns>
/// <exception cref="CouchbaseLiteException">Thrown if no push replication</exception>
/// <exception cref="CouchbaseException">Thrown if an error condition is returned from LiteCore</exception>
[Obsolete("GetPendingDocumentIDs() is deprecated, please use GetPendingDocumentIDs(Collection collection)")]
public IImmutableSet<string> GetPendingDocumentIDs()
{
return GetPendingDocumentIDs(Config.Database.GetDefaultCollection());
}

/// <summary>
/// [DEPRECATED] Checks whether or not a document with the given ID has any pending revisions to push
/// </summary>
/// <param name="documentID">The document ID</param>
/// <returns>A bool which represents whether or not the document with the corresponding ID has one or more pending revisions.
/// <c>true</c> means that one or more revisions have not been pushed to the remote yet,
/// and <c>false</c> means that all revisions on the document have been pushed</returns>
/// <exception cref="CouchbaseLiteException">Thrown if no push replication</exception>
/// <exception cref="CouchbaseException">Thrown if an error condition is returned from LiteCore</exception>
[Obsolete("IsDocumentPending(string documentID) is deprecated, please use IsDocumentPending(string documentID, Collection collection)")]
public bool IsDocumentPending(string documentID)
{
return IsDocumentPending(documentID, Config.Database.GetDefaultCollection());
}

/// <summary>
/// Checks whether or not a document with the given ID in the given collection is pending to push or not.
/// If the given collection is not part of the replication, an Invalid Parameter Exception will be thrown.
Expand Down
Loading