-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1520 from unoplatform/dev/nr/issue1516_2
chore: Adding docs for storage
- Loading branch information
Showing
10 changed files
with
122 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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 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 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
13 changes: 3 additions & 10 deletions
13
src/Uno.Extensions.Storage.UI/ServiceCollectionExtensions.cs
This file contains 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 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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
namespace Uno.Extensions.Storage; | ||
|
||
/// <summary> | ||
/// Interface for providing the data folder path for the application | ||
/// </summary> | ||
public interface IDataFolderProvider | ||
{ | ||
/// <summary> | ||
/// The path to the application data folder | ||
/// </summary> | ||
string? AppDataPath { get; } | ||
} |
24 changes: 1 addition & 23 deletions
24
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageConfiguration.cs
This file contains 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 |
---|---|---|
@@ -1,28 +1,6 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
public record KeyValueStorageConfiguration : KeyValueStorageSettings | ||
internal record KeyValueStorageConfiguration : KeyValueStorageSettings | ||
{ | ||
public IDictionary<string, KeyValueStorageSettings> Providers { get; init; } = new Dictionary<string, KeyValueStorageSettings>(); | ||
|
||
|
||
} | ||
|
||
internal static class KeyValueStorageConfigurationExtensions | ||
{ | ||
public static KeyValueStorageSettings GetSettingsOrDefault(this KeyValueStorageConfiguration? config, string name) | ||
{ | ||
if (config?.Providers.TryGetValue(name, out var settings) ?? false) | ||
{ | ||
return settings; | ||
} | ||
|
||
// If there isn't a match for settings for the supplied name, return | ||
// the default settings | ||
return config ?? new KeyValueStorageSettings(); | ||
} | ||
} | ||
|
||
public record KeyValueStorageSettings | ||
{ | ||
public bool DisableInMemoryCache { get; init; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageConfigurationExtensions.cs
This file contains 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,16 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
internal static class KeyValueStorageConfigurationExtensions | ||
{ | ||
public static KeyValueStorageSettings GetSettingsOrDefault(this KeyValueStorageConfiguration? config, string name) | ||
{ | ||
if (config?.Providers.TryGetValue(name, out var settings) ?? false) | ||
{ | ||
return settings; | ||
} | ||
|
||
// If there isn't a match for settings for the supplied name, return | ||
// the default settings | ||
return config ?? new KeyValueStorageSettings(); | ||
} | ||
} |
This file contains 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
12 changes: 12 additions & 0 deletions
12
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageSettings.cs
This file contains 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,12 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
/// <summary> | ||
/// Record for storing settings for a key value storage provider. | ||
/// </summary> | ||
public record KeyValueStorageSettings | ||
{ | ||
/// <summary> | ||
/// Gets or sets whether in-memory cache should be disabled. | ||
/// </summary> | ||
public bool DisableInMemoryCache { get; init; } | ||
} |
This file contains 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