diff --git a/Images/logo.png b/Images/logo.png new file mode 100644 index 00000000..3a1c0b7b Binary files /dev/null and b/Images/logo.png differ diff --git a/src/Akavache.Core/BlobCache/CacheEntry.cs b/src/Akavache.Core/BlobCache/CacheEntry.cs index de0f98b9..68ed2ae7 100644 --- a/src/Akavache.Core/BlobCache/CacheEntry.cs +++ b/src/Akavache.Core/BlobCache/CacheEntry.cs @@ -17,7 +17,6 @@ namespace Akavache; /// The date and time when the entry expires. public class CacheEntry(string? typeName, byte[] value, DateTimeOffset createdAt, DateTimeOffset? expiresAt) { - /// /// Gets or sets the date and time when the entry was created. /// diff --git a/src/Akavache.Core/BlobCache/IObjectWrapper.cs b/src/Akavache.Core/BlobCache/IObjectWrapper.cs index 40636a71..d3ad1fcc 100644 --- a/src/Akavache.Core/BlobCache/IObjectWrapper.cs +++ b/src/Akavache.Core/BlobCache/IObjectWrapper.cs @@ -8,6 +8,4 @@ namespace Akavache; /// /// A wrapper around a object. /// -internal interface IObjectWrapper -{ -} \ No newline at end of file +internal interface IObjectWrapper; \ No newline at end of file diff --git a/src/Akavache.Core/BlobCache/ISecureBlobCache.cs b/src/Akavache.Core/BlobCache/ISecureBlobCache.cs index 6535c4bb..83d5b4f6 100644 --- a/src/Akavache.Core/BlobCache/ISecureBlobCache.cs +++ b/src/Akavache.Core/BlobCache/ISecureBlobCache.cs @@ -15,6 +15,4 @@ namespace Akavache; /// saved to disk cannot be easily read by a third party. /// /// -public interface ISecureBlobCache : IBlobCache -{ -} +public interface ISecureBlobCache : IBlobCache; diff --git a/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs b/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs index d37a5604..c2b5875b 100644 --- a/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs +++ b/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs @@ -59,7 +59,7 @@ public InMemoryBlobCache(IEnumerable> initialConten public InMemoryBlobCache(IScheduler? scheduler, IEnumerable>? initialContents) { Scheduler = scheduler ?? CurrentThreadScheduler.Instance; - foreach (var item in initialContents ?? Enumerable.Empty>()) + foreach (var item in initialContents ?? []) { _cache[item.Key] = new(null, item.Value, Scheduler.Now, null); } @@ -155,7 +155,7 @@ public IObservable Insert(string key, byte[] data, DateTimeOffset? absolut { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } lock (_cache) @@ -168,7 +168,7 @@ public IObservable Insert(string key, byte[] data, DateTimeOffset? absolut /// public IObservable Flush() => _disposed ? - ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache") : + ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)) : Observable.Return(Unit.Default); /// @@ -176,7 +176,7 @@ public IObservable Get(string key) { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } CacheEntry? entry; @@ -211,7 +211,7 @@ public IObservable Get(string key) { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } CacheEntry? entry; @@ -233,7 +233,7 @@ public IObservable> GetAllKeys() { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException>("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException>(nameof(InMemoryBlobCache)); } lock (_cache) @@ -250,7 +250,7 @@ public IObservable Invalidate(string key) { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } lock (_cache) @@ -266,7 +266,7 @@ public IObservable InvalidateAll() { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } lock (_cache) @@ -282,7 +282,7 @@ public IObservable InsertObject(string key, T value, DateTimeOffset? ab { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } var data = SerializeObject(value); @@ -300,7 +300,7 @@ public IObservable GetObject(string key) { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } CacheEntry? entry; @@ -340,7 +340,7 @@ public IObservable> GetAllObjects() { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException>("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException>(nameof(InMemoryBlobCache)); } lock (_cache) @@ -356,7 +356,7 @@ public IObservable> GetAllObjects() /// public IObservable InvalidateObject(string key) => _disposed ? - ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache") : + ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)) : Invalidate(key); /// @@ -364,7 +364,7 @@ public IObservable InvalidateAllObjects() { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } lock (_cache) @@ -384,7 +384,7 @@ public IObservable Vacuum() { if (_disposed) { - return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); + return ExceptionHelper.ObservableThrowObjectDisposedException(nameof(InMemoryBlobCache)); } lock (_cache) diff --git a/src/Akavache.Core/IsExternalInit.cs b/src/Akavache.Core/IsExternalInit.cs index 793e71a6..fccfb653 100644 --- a/src/Akavache.Core/IsExternalInit.cs +++ b/src/Akavache.Core/IsExternalInit.cs @@ -8,6 +8,4 @@ namespace System.Runtime.CompilerServices; [EditorBrowsable(EditorBrowsableState.Never)] -internal class IsExternalInit -{ -} +internal class IsExternalInit; diff --git a/src/Akavache.Sqlite3/IsExternalInit.cs b/src/Akavache.Sqlite3/IsExternalInit.cs index 793e71a6..fccfb653 100644 --- a/src/Akavache.Sqlite3/IsExternalInit.cs +++ b/src/Akavache.Sqlite3/IsExternalInit.cs @@ -8,6 +8,4 @@ namespace System.Runtime.CompilerServices; [EditorBrowsable(EditorBrowsableState.Never)] -internal class IsExternalInit -{ -} +internal class IsExternalInit; diff --git a/src/Akavache.Sqlite3/Operations/BulkInvalidateByTypeSqliteOperation.cs b/src/Akavache.Sqlite3/Operations/BulkInvalidateByTypeSqliteOperation.cs index 9a91e241..5dcf8cca 100644 --- a/src/Akavache.Sqlite3/Operations/BulkInvalidateByTypeSqliteOperation.cs +++ b/src/Akavache.Sqlite3/Operations/BulkInvalidateByTypeSqliteOperation.cs @@ -9,6 +9,4 @@ namespace Akavache.Sqlite3; // NB: This just makes OperationQueue's life easier by giving it a type // name. -internal class BulkInvalidateByTypeSqliteOperation(SQLiteConnection conn) : BulkInvalidateSqliteOperation(conn, true) -{ -} +internal class BulkInvalidateByTypeSqliteOperation(SQLiteConnection conn) : BulkInvalidateSqliteOperation(conn, true); diff --git a/src/Akavache.Sqlite3/Operations/BulkInvalidateSqliteOperation.cs b/src/Akavache.Sqlite3/Operations/BulkInvalidateSqliteOperation.cs index 1e3519b2..4b627ac2 100644 --- a/src/Akavache.Sqlite3/Operations/BulkInvalidateSqliteOperation.cs +++ b/src/Akavache.Sqlite3/Operations/BulkInvalidateSqliteOperation.cs @@ -47,7 +47,7 @@ public BulkInvalidateSqliteOperation(SQLiteConnection conn, bool useTypeInsteadO public Action PrepareToExecute(IEnumerable? toDelete) { - var deleteList = (toDelete ?? Array.Empty()).ToList(); + var deleteList = (toDelete ?? []).ToList(); if (deleteList.Count == 0) { return () => { }; diff --git a/src/Akavache.Sqlite3/Operations/BulkSelectByTypeSqliteOperation.cs b/src/Akavache.Sqlite3/Operations/BulkSelectByTypeSqliteOperation.cs index d0d7c696..19659c8c 100644 --- a/src/Akavache.Sqlite3/Operations/BulkSelectByTypeSqliteOperation.cs +++ b/src/Akavache.Sqlite3/Operations/BulkSelectByTypeSqliteOperation.cs @@ -7,6 +7,4 @@ namespace Akavache.Sqlite3; -internal class BulkSelectByTypeSqliteOperation(SQLiteConnection conn, IScheduler scheduler) : BulkSelectSqliteOperation(conn, true, scheduler) -{ -} +internal class BulkSelectByTypeSqliteOperation(SQLiteConnection conn, IScheduler scheduler) : BulkSelectSqliteOperation(conn, true, scheduler); diff --git a/src/Akavache.Sqlite3/Operations/BulkSelectSqliteOperation.cs b/src/Akavache.Sqlite3/Operations/BulkSelectSqliteOperation.cs index c9ecfae3..739d8ae5 100644 --- a/src/Akavache.Sqlite3/Operations/BulkSelectSqliteOperation.cs +++ b/src/Akavache.Sqlite3/Operations/BulkSelectSqliteOperation.cs @@ -50,10 +50,10 @@ public BulkSelectSqliteOperation(SQLiteConnection conn, bool useTypeInsteadOfKey public Func> PrepareToExecute(IEnumerable? toSelect) { - var selectList = (toSelect ?? Array.Empty()).ToList(); + var selectList = (toSelect ?? []).ToList(); if (selectList.Count == 0) { - return () => new List(); + return () => []; } var selectOp = _selectOps[selectList.Count - 1]; diff --git a/src/Akavache.Sqlite3/Queues/OperationQueue.cs b/src/Akavache.Sqlite3/Queues/OperationQueue.cs index 5ebb5b36..c63e7285 100644 --- a/src/Akavache.Sqlite3/Queues/OperationQueue.cs +++ b/src/Akavache.Sqlite3/Queues/OperationQueue.cs @@ -372,7 +372,7 @@ public void Dispose() _shouldQuit?.Dispose(); } - internal List DumpQueue() => _operationQueue.ToList(); + internal List DumpQueue() => [.. _operationQueue]; private static void MarshalCompletion(object completion, Action block, IObservable commitResult) { diff --git a/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs b/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs index b6178990..21fb8669 100644 --- a/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs +++ b/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs @@ -32,12 +32,13 @@ internal static List CoalesceOperations(List CoalesceUnrelatedItems(IEnumerabl items.GroupBy(x => x.OperationType) .SelectMany(group => group.Key switch { - OperationType.BulkSelectSqliteOperation => new[] { GroupUnrelatedSelects(group) }, - OperationType.BulkInsertSqliteOperation => new[] { GroupUnrelatedInserts(group) }, - OperationType.BulkInvalidateSqliteOperation => new[] { GroupUnrelatedDeletes(group) }, + OperationType.BulkSelectSqliteOperation => [GroupUnrelatedSelects(group)], + OperationType.BulkInsertSqliteOperation => [GroupUnrelatedInserts(group)], + OperationType.BulkInvalidateSqliteOperation => [GroupUnrelatedDeletes(group)], _ => (IEnumerable)group }); @@ -116,7 +117,7 @@ private static IEnumerable MultipleOpsTurnIntoSingleOp(IEnum { if (item.OperationType == opTypeToDedup) { - currentWrites ??= new(); + currentWrites ??= []; currentWrites.Add(item); continue; } @@ -185,9 +186,7 @@ private static OperationQueueItem GroupUnrelatedSelects(IEnumerable()); + elementMap[v].OnNext(resultMap.TryGetValue(v, out var value) ? EnumerableEx.Return(value) : []); elementMap[v].OnCompleted(); } @@ -228,7 +227,7 @@ private static OperationQueueItem GroupUnrelatedInserts(IEnumerable { subj.Subscribe(x.CompletionAsUnit); - return x.ParametersAsElements ?? Enumerable.Empty(); + return x.ParametersAsElements ?? []; }).ToList(); return OperationQueueItem.CreateInsert( @@ -259,7 +258,7 @@ private static OperationQueueItem GroupUnrelatedDeletes(IEnumerable { subj.Subscribe(x.CompletionAsUnit); - return x.ParametersAsKeys ?? Enumerable.Empty(); + return x.ParametersAsKeys ?? []; }).ToList(); return OperationQueueItem.CreateInvalidate( @@ -292,21 +291,17 @@ private static OperationQueueItem GroupUnrelatedDeletes(IEnumerable? subjects, OperationType opType) { - var subjectsList = (subjects ?? Enumerable.Empty()).ToList(); - switch (opType) + var subjectsList = (subjects ?? []).ToList(); + return opType switch { - case OperationType.BulkSelectSqliteOperation: - return CombineSubjects( - (AsyncSubject>)source, - subjectsList.Cast>>()); - case OperationType.BulkInsertSqliteOperation: - case OperationType.BulkInvalidateSqliteOperation: - return CombineSubjects( - (AsyncSubject)source, - subjectsList.Cast>()); - default: - throw new ArgumentException("Invalid operation type", nameof(opType)); - } + OperationType.BulkSelectSqliteOperation => CombineSubjects( + (AsyncSubject>)source, + subjectsList.Cast>>()), + OperationType.BulkInsertSqliteOperation or OperationType.BulkInvalidateSqliteOperation => CombineSubjects( + (AsyncSubject)source, + subjectsList.Cast>()), + _ => throw new ArgumentException("Invalid operation type", nameof(opType)), + }; } private static AsyncSubject CombineSubjects(AsyncSubject source, IEnumerable> subjs) diff --git a/src/Akavache.Sqlite3/SqlLiteCache/IObjectWrapper.cs b/src/Akavache.Sqlite3/SqlLiteCache/IObjectWrapper.cs index ddd9f88e..9d51280d 100644 --- a/src/Akavache.Sqlite3/SqlLiteCache/IObjectWrapper.cs +++ b/src/Akavache.Sqlite3/SqlLiteCache/IObjectWrapper.cs @@ -8,6 +8,4 @@ namespace Akavache.Sqlite3; /// /// A wrapper around a object. /// -internal interface IObjectWrapper -{ -} \ No newline at end of file +internal interface IObjectWrapper; diff --git a/src/Akavache.Sqlite3/SqlLiteCache/ObjectWrapper.cs b/src/Akavache.Sqlite3/SqlLiteCache/ObjectWrapper.cs index 5f2561c9..0eb7b65c 100755 --- a/src/Akavache.Sqlite3/SqlLiteCache/ObjectWrapper.cs +++ b/src/Akavache.Sqlite3/SqlLiteCache/ObjectWrapper.cs @@ -15,10 +15,7 @@ public ObjectWrapper() { } - public ObjectWrapper(T value) - { - Value = value; - } + public ObjectWrapper(T value) => Value = value; public T? Value { get; set; } } diff --git a/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs b/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs index cc7968b3..770d2170 100644 --- a/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs +++ b/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs @@ -101,8 +101,8 @@ public IObservable Insert(string key, byte[] data, DateTimeOffset? absolut return _initializer .SelectMany(_ => BeforeWriteToDiskFilter(data, Scheduler)) - .SelectMany(encData => _opQueue.Insert(new[] - { + .SelectMany(encData => _opQueue.Insert( + [ new CacheElement { Key = key, @@ -110,7 +110,7 @@ public IObservable Insert(string key, byte[] data, DateTimeOffset? absolut CreatedAt = createdAt, Expiration = exp, }, - })) + ])) .PublishLast().PermaRef(); } @@ -132,7 +132,7 @@ public IObservable Get(string key) return Observable.Throw(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.Select(new[] { key })) + return _initializer.SelectMany(_ => _opQueue.Select([key])) .SelectMany(x => { var cacheElements = x.ToList(); @@ -179,7 +179,7 @@ public IObservable> GetAllKeys() return Observable.Throw(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.Select(new[] { key })) + return _initializer.SelectMany(_ => _opQueue.Select([key])) .Select(x => { var cacheElements = x.ToList(); @@ -223,7 +223,7 @@ public IObservable Invalidate(string key) return Observable.Throw(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.Invalidate(new[] { key })) + return _initializer.SelectMany(_ => _opQueue.Invalidate([key])) .PublishLast().PermaRef(); } @@ -268,8 +268,8 @@ public IObservable InsertObject(string key, T value, DateTimeOffset? ab return _initializer .SelectMany(_ => BeforeWriteToDiskFilter(data, Scheduler)) - .SelectMany(encData => _opQueue.Insert(new[] - { + .SelectMany(encData => _opQueue.Insert( + [ new CacheElement { Key = key, @@ -278,7 +278,7 @@ public IObservable InsertObject(string key, T value, DateTimeOffset? ab CreatedAt = createdAt, Expiration = exp, }, - })) + ])) .PublishLast().PermaRef(); } @@ -300,7 +300,7 @@ public IObservable InsertObject(string key, T value, DateTimeOffset? ab return Observable.Throw(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.Select(new[] { key })) + return _initializer.SelectMany(_ => _opQueue.Select([key])) .SelectMany(x => { var cacheElements = x.ToList(); @@ -333,7 +333,7 @@ public IObservable> GetAllObjects() return Observable.Throw>(new InvalidOperationException("The generic type does not have a valid full name and is required")); } - return _initializer.SelectMany(_ => _opQueue.SelectTypes(new[] { typeFullName }) + return _initializer.SelectMany(_ => _opQueue.SelectTypes([typeFullName]) .SelectMany(x => x.ToObservable() .SelectMany(y => AfterReadFromDiskFilter(y.Value, Scheduler)) .SelectMany(DeserializeObject) @@ -367,7 +367,7 @@ public IObservable InvalidateAllObjects() return Observable.Throw(new InvalidOperationException("The generic type does not have a valid full name and is required")); } - return _initializer.SelectMany(_ => _opQueue.InvalidateTypes(new[] { typeFullName })) + return _initializer.SelectMany(_ => _opQueue.InvalidateTypes([typeFullName])) .PublishLast().PermaRef(); } @@ -779,9 +779,7 @@ private byte[] SerializeObject(T value) { try { -#pragma warning disable CS8602 // Dereference of a possibly null reference. var boxedVal = serializer.Deserialize>(reader).Value; -#pragma warning restore CS8602 // Dereference of a possibly null reference. return Observable.Return(boxedVal); } catch (Exception ex) diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.DotNet8_0.verified.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.DotNet8_0.verified.txt new file mode 100644 index 00000000..94eb6652 --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.DotNet8_0.verified.txt @@ -0,0 +1,283 @@ +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Drawing")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Mobile")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Sqlite3")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Akavache +{ + public class AkavacheHttpMixin : Akavache.IAkavacheHttpMixin + { + public AkavacheHttpMixin() { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + } + public static class BlobCache + { + public static string ApplicationName { get; set; } + public static System.DateTimeKind? ForcedDateTimeKind { get; set; } + public static Akavache.ISecureBlobCache InMemory { get; set; } + public static Akavache.IBlobCache LocalMachine { get; set; } + public static Akavache.ISecureBlobCache Secure { get; set; } + public static System.Reactive.Concurrency.IScheduler TaskpoolScheduler { get; set; } + public static Akavache.IBlobCache UserAccount { get; set; } + public static void EnsureInitialized() { } + public static System.Threading.Tasks.Task Shutdown() { } + } + public static class BulkOperationsMixin + { + public static System.IObservable> Get(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable> GetCreatedAt(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable> GetObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable Insert(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable Invalidate(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable InvalidateObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + } + public class CacheEntry + { + public CacheEntry(string? typeName, byte[] value, System.DateTimeOffset createdAt, System.DateTimeOffset? expiresAt) { } + public System.DateTimeOffset CreatedAt { get; set; } + public System.DateTimeOffset? ExpiresAt { get; set; } + public string? TypeName { get; set; } + public byte[] Value { get; set; } + } + public enum DataProtectionScope + { + CurrentUser = 0, + } + public class DefaultAkavacheHttpClientFactory : Akavache.IAkavacheHttpClientFactory + { + public DefaultAkavacheHttpClientFactory() { } + public System.Net.Http.HttpClient CreateClient(string name) { } + } + public static class DependencyResolverMixin + { + public static void InitializeAkavache(this Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } + public class EncryptionProvider : Akavache.IEncryptionProvider + { + public EncryptionProvider() { } + public System.IObservable DecryptBlock(byte[] block) { } + public System.IObservable EncryptBlock(byte[] block) { } + } + public static class HttpMixinExtensions + { + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + } + public interface IAkavacheHttpClientFactory + { + System.Net.Http.HttpClient CreateClient(string name); + } + public interface IAkavacheHttpMixin + { + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Net.Http.HttpMethod method, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + } + public interface IBlobCache : System.IDisposable + { + System.DateTimeKind? ForcedDateTimeKind { get; set; } + System.Reactive.Concurrency.IScheduler Scheduler { get; } + System.IObservable Shutdown { get; } + System.IObservable Flush(); + System.IObservable Get(string key); + System.IObservable> GetAllKeys(); + System.IObservable GetCreatedAt(string key); + System.IObservable Insert(string key, byte[] data, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable Invalidate(string key); + System.IObservable InvalidateAll(); + System.IObservable Vacuum(); + } + public interface IBulkBlobCache : Akavache.IBlobCache, System.IDisposable + { + System.IObservable> Get(System.Collections.Generic.IEnumerable keys); + System.IObservable> GetCreatedAt(System.Collections.Generic.IEnumerable keys); + System.IObservable Insert(System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable Invalidate(System.Collections.Generic.IEnumerable keys); + } + public interface IEncryptionProvider + { + System.IObservable DecryptBlock(byte[] block); + System.IObservable EncryptBlock(byte[] block); + } + public interface IFilesystemProvider + { + System.IObservable CreateRecursive(string path); + System.IObservable Delete(string path); + string? GetDefaultLocalMachineCacheDirectory(); + string? GetDefaultRoamingCacheDirectory(); + string? GetDefaultSecretCacheDirectory(); + System.IObservable OpenFileForReadAsync(string path, System.Reactive.Concurrency.IScheduler scheduler); + System.IObservable OpenFileForWriteAsync(string path, System.Reactive.Concurrency.IScheduler scheduler); + } + public interface IKeyedOperationQueue + { + System.IObservable EnqueueObservableOperation(string key, System.Func> asyncCalculationFunc); + System.IObservable EnqueueOperation(string key, System.Action action); + System.IObservable EnqueueOperation(string key, System.Func calculationFunc); + System.IObservable ShutdownQueue(); + } + public interface IObjectBlobCache : Akavache.IBlobCache, System.IDisposable + { + System.IObservable> GetAllObjects(); + System.IObservable GetObject(string key); + System.IObservable GetObjectCreatedAt(string key); + System.IObservable InsertObject(string key, T value, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable InvalidateAllObjects(); + System.IObservable InvalidateObject(string key); + } + public interface IObjectBulkBlobCache : Akavache.IBlobCache, Akavache.IBulkBlobCache, Akavache.IObjectBlobCache, System.IDisposable + { + System.IObservable> GetObjects(System.Collections.Generic.IEnumerable keys); + System.IObservable InsertObjects(System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable InvalidateObjects(System.Collections.Generic.IEnumerable keys); + } + public interface ISecureBlobCache : Akavache.IBlobCache, System.IDisposable { } + public class InMemoryBlobCache : Akavache.IBlobCache, Akavache.IObjectBlobCache, Akavache.ISecureBlobCache, Splat.IEnableLogger, System.IDisposable + { + public InMemoryBlobCache() { } + public InMemoryBlobCache(System.Collections.Generic.IEnumerable> initialContents) { } + public InMemoryBlobCache(System.Reactive.Concurrency.IScheduler scheduler) { } + public InMemoryBlobCache(System.Reactive.Concurrency.IScheduler? scheduler, System.Collections.Generic.IEnumerable>? initialContents) { } + public System.DateTimeKind? ForcedDateTimeKind { get; set; } + public System.Reactive.Concurrency.IScheduler Scheduler { get; set; } + public System.IObservable Shutdown { get; } + public void Dispose() { } + protected virtual void Dispose(bool isDisposing) { } + public System.IObservable Flush() { } + public System.IObservable Get(string key) { } + public System.IObservable> GetAllKeys() { } + public System.IObservable> GetAllObjects() { } + public System.IObservable GetCreatedAt(string key) { } + public System.IObservable GetObject(string key) { } + public System.IObservable GetObjectCreatedAt(string key) { } + public System.IObservable Insert(string key, byte[] data, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable InsertObject(string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable Invalidate(string key) { } + public System.IObservable InvalidateAll() { } + public System.IObservable InvalidateAllObjects() { } + public System.IObservable InvalidateObject(string key) { } + public System.IObservable Vacuum() { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Collections.Generic.IDictionary initialContents, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Collections.Generic.IDictionary initialContents, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Reactive.Concurrency.IScheduler? scheduler = null, params System.Collections.Generic.KeyValuePair[] initialContents) { } + } + public static class JsonSerializationMixin + { + public static System.IObservable> GetAllObjects(this Akavache.IBlobCache blobCache) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetObjectCreatedAt(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertAllObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InvalidateAllObjects(this Akavache.IBlobCache blobCache) { } + public static System.IObservable InvalidateObject(this Akavache.IBlobCache blobCache, string key) { } + } + public class KeyedOperationQueue : Akavache.IKeyedOperationQueue, Splat.IEnableLogger, System.IDisposable + { + public KeyedOperationQueue(System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.IObservable EnqueueObservableOperation(string key, System.Func> asyncCalculationFunc) { } + public System.IObservable EnqueueOperation(string key, System.Action action) { } + public System.IObservable EnqueueOperation(string key, System.Func calculationFunc) { } + public System.IObservable ShutdownQueue() { } + } + public class LoginInfo + { + public LoginInfo(string username, string password) { } + public string Password { get; } + public string UserName { get; } + } + public static class LoginMixin + { + public static System.IObservable EraseLogin(this Akavache.ISecureBlobCache blobCache, string host = "default") { } + public static System.IObservable GetLoginAsync(this Akavache.ISecureBlobCache blobCache, string host = "default") { } + public static System.IObservable SaveLogin(this Akavache.ISecureBlobCache blobCache, string user, string password, string host = "default", System.DateTimeOffset? absoluteExpiration = default) { } + } + public static class ProtectedData + { + public static byte[] Protect(byte[] originalData, byte[]? entropy, Akavache.DataProtectionScope scope = 0) { } + public static byte[] Unprotect(byte[] originalData, byte[]? entropy, Akavache.DataProtectionScope scope = 0) { } + } + public static class RelativeTimeMixin + { + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string url, System.TimeSpan expiration, System.Collections.Generic.Dictionary? headers = null, bool fetchAlways = false) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Uri url, System.TimeSpan expiration, System.Collections.Generic.Dictionary? headers = null, bool fetchAlways = false) { } + public static System.IObservable Insert(this Akavache.IBlobCache blobCache, string key, byte[] data, System.TimeSpan expiration) { } + public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.TimeSpan expiration) { } + public static System.IObservable SaveLogin(this Akavache.ISecureBlobCache blobCache, string user, string password, string host, System.TimeSpan expiration) { } + } + public class SimpleFilesystemProvider : Akavache.IFilesystemProvider + { + public SimpleFilesystemProvider() { } + public System.IObservable CreateRecursive(string path) { } + public System.IObservable Delete(string path) { } + public string GetDefaultLocalMachineCacheDirectory() { } + public string GetDefaultRoamingCacheDirectory() { } + public string GetDefaultSecretCacheDirectory() { } + public System.IObservable OpenFileForReadAsync(string path, System.Reactive.Concurrency.IScheduler scheduler) { } + public System.IObservable OpenFileForWriteAsync(string path, System.Reactive.Concurrency.IScheduler scheduler) { } + protected static string GetAssemblyDirectoryName() { } + } +} +namespace Akavache.Core +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } +} +namespace Akavache.Internal +{ + [System.Flags] + public enum FileAccess + { + Read = 1, + Write = 2, + ReadWrite = 3, + } + public enum FileMode + { + CreateNew = 1, + Create = 2, + Open = 3, + OpenOrCreate = 4, + Truncate = 5, + Append = 6, + } + [System.Flags] + public enum FileShare + { + None = 0, + Read = 1, + Write = 2, + ReadWrite = 3, + Delete = 4, + Inheritable = 16, + } +} \ No newline at end of file diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.DotNet8_0.verified.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.DotNet8_0.verified.txt new file mode 100644 index 00000000..6aaa6bf7 --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.DotNet8_0.verified.txt @@ -0,0 +1,21 @@ +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Akavache +{ + public static class BitmapImageMixin + { + public static System.IObservable LoadImage(this Akavache.IBlobCache blobCache, string key, float? desiredWidth = default, float? desiredHeight = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, System.Uri url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string key, string url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string key, System.Uri url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable ThrowOnBadImageBuffer(byte[] compressedImage) { } + } +} +namespace Akavache.Drawing +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } +} \ No newline at end of file diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.DotNet8_0.verified.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.DotNet8_0.verified.txt new file mode 100644 index 00000000..086e2eb0 --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.DotNet8_0.verified.txt @@ -0,0 +1,18 @@ +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Akavache +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + public static void Start(string applicationName) { } + } +} +namespace Akavache.Sqlite3 +{ + public static class LinkerPreserve { } + public class SQLitePersistentBlobCache : Akavache.Sqlite3.SqlRawPersistentBlobCache + { + public SQLitePersistentBlobCache(string databaseFile, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + } +} \ No newline at end of file diff --git a/src/Akavache.Tests/Akavache.Tests.csproj b/src/Akavache.Tests/Akavache.Tests.csproj index 15bedeed..2499c362 100644 --- a/src/Akavache.Tests/Akavache.Tests.csproj +++ b/src/Akavache.Tests/Akavache.Tests.csproj @@ -1,7 +1,7 @@  - net48;net6.0 + net48;net6.0;net8.0 $(NoWarn);CA1307;CA2000;CA1062 latest disable diff --git a/src/Akavache.sln b/src/Akavache.sln index f04ed739..0dc5ecf7 100644 --- a/src/Akavache.sln +++ b/src/Akavache.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 +# 17 VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9407D902-E9CF-4CB6-B601-77CDF74B9475}" @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.build.props = Directory.build.props Directory.build.targets = Directory.build.targets global.json = global.json + ..\README.md = ..\README.md ..\.github\workflows\release.yml = ..\.github\workflows\release.yml stylecop.json = stylecop.json ..\version.json = ..\version.json diff --git a/src/Akavache/SQLitePersistentBlobCache.cs b/src/Akavache/SQLitePersistentBlobCache.cs index 416f0606..94f23772 100644 --- a/src/Akavache/SQLitePersistentBlobCache.cs +++ b/src/Akavache/SQLitePersistentBlobCache.cs @@ -21,6 +21,4 @@ namespace Akavache.Sqlite3; /// /// The location of the database file which to store the blobs in. /// Scheduler to use for contained observables. -public class SQLitePersistentBlobCache(string databaseFile, IScheduler? scheduler = null) : SqlRawPersistentBlobCache(databaseFile, scheduler) -{ -} +public class SQLitePersistentBlobCache(string databaseFile, IScheduler? scheduler = null) : SqlRawPersistentBlobCache(databaseFile, scheduler); diff --git a/src/Directory.build.props b/src/Directory.build.props index 2c4c1e03..574ef045 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -3,7 +3,8 @@ Copyright (c) .NET Foundation and Contributors MIT https://github.com/reactiveui/akavache/ - https://raw.githubusercontent.com/reactiveui/styleguide/master/logo_akavache/main.png + logo.png + README.md .NET Foundation and Contributors xanaisbettsx;ghuntley Akavache;Cache;Xamarin;Sqlite3;Magic @@ -27,12 +28,14 @@ enable preview IDE1006;SA1313;SA1010 - netstandard2.0;netstandard2.1;net6.0;net7.0;net7.0-android;net7.0-ios;net7.0-tvos;net7.0-macos;net7.0-maccatalyst;net8.0;net8.0-android;net8.0-ios;net8.0-tvos;net8.0-macos;net8.0-maccatalyst + netstandard2.0;netstandard2.1;net6.0;net8.0;net8.0-android;net8.0-ios;net8.0-tvos;net8.0-macos;net8.0-maccatalyst + + @@ -44,15 +47,12 @@ - - - - + diff --git a/version.json b/version.json index eb08515d..1b10f643 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "10.0", + "version": "10.1", "publicReleaseRefSpec": [ "^refs/heads/main$", // we release out of master "^refs/heads/develop$", // we release out of develop