diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2025-08-03 17:27:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-03 17:27:17 -0400 |
| commit | 4b6fb6c4bb2478badad068ce18aabe0c2955db48 (patch) | |
| tree | 15f986ee62327cceb8f5c8f009bcf08d10cfaa66 /src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration | |
| parent | e7bc86ebb8496615e0b3f73eb4f13ab4c0913dc8 (diff) | |
| parent | db7465e83d9cc07134a0bffad7ed17b1c7b873da (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration')
4 files changed, 98 insertions, 0 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOption.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOption.cs new file mode 100644 index 000000000..fcb8f41b3 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOption.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Jellyfin.Database.Implementations.DbConfiguration; + +/// <summary> +/// The custom value option for custom database providers. +/// </summary> +public class CustomDatabaseOption +{ + /// <summary> + /// Gets or sets the key of the value. + /// </summary> + public required string Key { get; set; } + + /// <summary> + /// Gets or sets the value. + /// </summary> + public required string Value { get; set; } +} diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOptions.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOptions.cs new file mode 100644 index 000000000..e2088704d --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/CustomDatabaseOptions.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Jellyfin.Database.Implementations.DbConfiguration; + +/// <summary> +/// Defines the options for a custom database connector. +/// </summary> +public class CustomDatabaseOptions +{ + /// <summary> + /// Gets or sets the Plugin name to search for database providers. + /// </summary> + public required string PluginName { get; set; } + + /// <summary> + /// Gets or sets the plugin assembly to search for providers. + /// </summary> + public required string PluginAssembly { get; set; } + + /// <summary> + /// Gets or sets the connection string for the custom database provider. + /// </summary> + public required string ConnectionString { get; set; } + + /// <summary> + /// Gets or sets the list of extra options for the custom provider. + /// </summary> +#pragma warning disable CA2227 // Collection properties should be read only + public Collection<CustomDatabaseOption> Options { get; set; } = []; +#pragma warning restore CA2227 // Collection properties should be read only +} diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseConfigurationOptions.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseConfigurationOptions.cs new file mode 100644 index 000000000..bc0cacf3c --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseConfigurationOptions.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Jellyfin.Database.Implementations.DbConfiguration; + +/// <summary> +/// Options to configure jellyfins managed database. +/// </summary> +public class DatabaseConfigurationOptions +{ + /// <summary> + /// Gets or Sets the type of database jellyfin should use. + /// </summary> + public required string DatabaseType { get; set; } + + /// <summary> + /// Gets or sets the options required to use a custom database provider. + /// </summary> + public CustomDatabaseOptions? CustomProviderOptions { get; set; } + + /// <summary> + /// Gets or Sets the kind of locking behavior jellyfin should perform. Possible options are "NoLock", "Pessimistic", "Optimistic". + /// Defaults to "NoLock". + /// </summary> + public DatabaseLockingBehaviorTypes LockingBehavior { get; set; } +} diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseLockingBehaviorTypes.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseLockingBehaviorTypes.cs new file mode 100644 index 000000000..3b2a55802 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/DbConfiguration/DatabaseLockingBehaviorTypes.cs @@ -0,0 +1,22 @@ +namespace Jellyfin.Database.Implementations.DbConfiguration; + +/// <summary> +/// Defines all possible methods for locking database access for concurrent queries. +/// </summary> +public enum DatabaseLockingBehaviorTypes +{ + /// <summary> + /// Defines that no explicit application level locking for reads and writes should be done and only provider specific locking should be relied on. + /// </summary> + NoLock = 0, + + /// <summary> + /// Defines a behavior that always blocks all reads while any one write is done. + /// </summary> + Pessimistic = 1, + + /// <summary> + /// Defines that all writes should be attempted and when fail should be retried. + /// </summary> + Optimistic = 2 +} |
