VolumeManagerDatabaseCopy.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2014-2016 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Utilities;
  11. namespace DiskAccessLibrary.LogicalDiskManager
  12. {
  13. /// <summary>
  14. /// A Volume Manager Database copy stored on a specific disk
  15. /// </summary>
  16. public class VolumeManagerDatabaseCopy : VolumeManagerDatabase
  17. {
  18. private DynamicDisk m_disk;
  19. private VolumeManagerDatabaseHeader m_databaseHeader;
  20. private List<DatabaseRecord> m_databaseRecords;
  21. private KernelUpdateLog m_kernelUpdateLog;
  22. public VolumeManagerDatabaseCopy(DynamicDisk disk, VolumeManagerDatabaseHeader databaseHeader, List<DatabaseRecord> databaseRecords, KernelUpdateLog kernelUpdateLog) :
  23. base(databaseHeader, databaseRecords, kernelUpdateLog)
  24. {
  25. m_disk = disk;
  26. m_databaseHeader = databaseHeader;
  27. m_databaseRecords = databaseRecords;
  28. m_kernelUpdateLog = kernelUpdateLog;
  29. }
  30. public override void WriteDatabaseHeader()
  31. {
  32. VolumeManagerDatabaseHeader.WriteToDisk(m_disk, m_databaseHeader);
  33. }
  34. public override void WriteDatabaseRecordFragment(DatabaseRecordFragment fragment)
  35. {
  36. WriteDatabaseRecordFragment(m_disk, fragment, (int)m_databaseHeader.BlockSize);
  37. }
  38. public override void SetKernelUpdateLogLastEntry(ulong committedTransactionID, ulong pendingTransactionID)
  39. {
  40. m_kernelUpdateLog.SetLastEntry(m_disk, committedTransactionID, pendingTransactionID);
  41. }
  42. }
  43. }