From 29ae7b9aeb46ac297ba5c3253d73cd4cd325c042 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 1 Jul 2019 18:24:35 +0200 Subject: [PATCH] Add docs --- .../Data/BaseSqliteRepository.cs | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index 6e061c154..9bc0bb945 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -16,28 +16,78 @@ namespace Emby.Server.Implementations.Data Logger = logger; } + /// + /// Gets or sets the path to the DB file. + /// + /// Path to the DB file. protected string DbFilePath { get; set; } + /// + /// Gets the logger. + /// + /// The logger. protected ILogger Logger { get; } + /// + /// Gets the default connection flags. + /// + /// The default connection flags. protected virtual ConnectionFlags DefaultConnectionFlags => ConnectionFlags.NoMutex; + /// + /// Gets the transaction mode. + /// + /// The transaction mode.> protected TransactionMode TransactionMode => TransactionMode.Deferred; + /// + /// Gets the transaction mode for read-only operations. + /// + /// The transaction mode. protected TransactionMode ReadTransactionMode => TransactionMode.Deferred; + /// + /// Gets the cache size. + /// + /// The cache size or null. protected virtual int? CacheSize => null; + /// + /// Gets the journal mode. + /// + /// The journal mode. protected virtual string JournalMode => "WAL"; + /// + /// Gets the page size. + /// + /// The page size or null. protected virtual int? PageSize => null; + /// + /// Gets the temp store mode. + /// + /// The temp store mode. + /// protected virtual TempStoreMode TempStore => TempStoreMode.Default; + /// + /// Gets the synchronous mode. + /// + /// The synchronous mode or null. + /// protected virtual SynchronousMode? Synchronous => null; + /// + /// Gets or sets the write lock. + /// + /// The write lock. protected SemaphoreSlim WriteLock { get; set; } = new SemaphoreSlim(1, 1); + /// + /// Gets or sets the write connection. + /// + /// The write connection. protected SQLiteDatabaseConnection WriteConnection { get; set; } protected ManagedConnection GetConnection(bool _ = false) @@ -182,18 +232,54 @@ namespace Emby.Server.Implementations.Data } } + /// + /// The disk synchronization mode, controls how aggressively SQLite will write data + /// all the way out to physical storage. + /// public enum SynchronousMode { + /// + /// SQLite continues without syncing as soon as it has handed data off to the operating system + /// Off = 0, + + /// + /// SQLite database engine will still sync at the most critical moments + /// Normal = 1, + + /// + /// SQLite database engine will use the xSync method of the VFS + /// to ensure that all content is safely written to the disk surface prior to continuing. + /// Full = 2, + + /// + /// EXTRA synchronous is like FULL with the addition that the directory containing a rollback journal + /// is synced after that journal is unlinked to commit a transaction in DELETE mode. + /// Extra = 3 } + /// + /// Storage mode used by temporary database files. + /// public enum TempStoreMode { + /// + /// The compile-time C preprocessor macro SQLITE_TEMP_STORE + /// is used to determine where temporary tables and indices are stored. + /// Default = 0, + + /// + /// Temporary tables and indices are stored in a file. + /// File = 1, + + /// + /// Temporary tables and indices are kept in as if they were pure in-memory databases memory. + /// Memory = 2 } }