Пример #1
0
        private IPartition CreateNewParition(PartitionDate partitionDir, int partitionID, string fullPath, PartitionConfig config)
        {
            var newParition = new Partition(_metadata, _fileFactory, Access, partitionDir, partitionID, fullPath, _server, config);

            if (config == null && Access == EFileAccess.ReadWrite)
            {
                newParition.SaveConfig();
            }
            _allPartitions.Enqueue(newParition);
            return(newParition);
        }
Пример #2
0
        public void CommitTempPartition(IPartition partition, PartitionTxData txData)
        {
            // partition.Commit();

            // Close the files
            partition.Dispose();

            var partitionVersion = new PartitionDate(partition.StartDate, partition.Version,
                                                     _metadata.Settings.PartitionType);
            var path = Path.Combine(_metadata.Settings.DefaultPath, partitionVersion.Name);

            Directory.Move(partition.DirectoryPath, path);
        }
Пример #3
0
        public IPartition CreateTempPartition(int partitionID, DateTime startDateTime, int lastVersion)
        {
            var defaultPath = _metadata.Settings.DefaultPath;

            if (Access != EFileAccess.ReadWrite)
            {
                throw new NFSdbAccessException("Journal {0} is open as read only, unable to create temp partitions.",
                                               defaultPath);
            }
            var partitionType = _metadata.Settings.PartitionType;
            var newVersion    = new PartitionDate(startDateTime, lastVersion + 1, partitionType);
            var path          = Path.Combine(defaultPath, MetadataConstants.DEFAULT_TEMP_PARITION_PREFIX + newVersion.Name);
            var newPartition  = new Partition(_metadata, _fileFactory, EFileAccess.ReadWrite,
                                              newVersion, partitionID, path, _server);

            return(newPartition);
        }
Пример #4
0
        public Partition(IJournalMetadata metadata,
                         ICompositeFileFactory memeorymMappedFileFactory,
                         EFileAccess access,
                         PartitionDate partitionDate, int partitionID,
                         string path,
                         IJournalServer journalServer,
                         PartitionConfig config = null)
        {
            _memeorymMappedFileFactory = memeorymMappedFileFactory;
            _access        = access;
            _journalServer = journalServer;
            _config        = config;
            _metadata      = metadata;

            _partitionDate = partitionDate;
            EndDate        = PartitionManagerUtils.GetPartitionEndDate(
                partitionDate.Date, partitionDate.PartitionType);
            PartitionID   = partitionID;
            DirectoryPath = path;
        }
Пример #5
0
 public bool Equals(PartitionDate other)
 {
     return(PartitionType == other.PartitionType && Date.Equals(other.Date) && Version == other.Version);
 }