private void ThrowIfNotInMode(TransactionLogOperatingMode expectedLogMode)
 {
     if (currentLogMode != expectedLogMode)
     {
         new InvalidOperationException($"Log has to be in {expectedLogMode} mode, but it is in {currentLogMode} mode.");
     }
 }
        /// <summary>
        /// Exit recovery and enter Append Mode.
        /// </summary>
        public Task EndRecovery()
        {
            ThrowIfNotInMode(TransactionLogOperatingMode.RecoveryMode);

            currentLogMode = TransactionLogOperatingMode.AppendMode;

            return(Task.CompletedTask);
        }
        /// <summary>
        /// Initialize the log (in Recovery Mode). This method must be called before any other method
        /// is called on the log.
        /// </summary>
        /// <returns></returns>
        public async Task Initialize()
        {
            currentLogMode = TransactionLogOperatingMode.RecoveryMode;

            transactionLogStorage = await storageFactory();
        }
        public TransactionLog(Factory <Task <ITransactionLogStorage> > storageFactory)
        {
            this.storageFactory = storageFactory;

            currentLogMode = TransactionLogOperatingMode.Uninitialized;
        }
Exemple #5
0
        /// <summary>
        /// Initialize the log (in Recovery Mode). This method must be called before any other method
        /// is called on the log.
        /// </summary>
        /// <returns></returns>
        public Task Initialize()
        {
            currentLogMode = TransactionLogOperatingMode.RecoveryMode;

            return(transactionLogStorage.Initialize());
        }
Exemple #6
0
        public TransactionLog(ITransactionLogStorage transactionLogStorage)
        {
            this.transactionLogStorage = transactionLogStorage;

            currentLogMode = TransactionLogOperatingMode.Uninitialized;
        }