Exemple #1
0
 internal RepositoryFolderReader(IFolder folder, IReader reader)
 {
     _position         = new FolderReadingPosition(folder);
     this.TargetFolder = folder;
     MasterReader      = reader;
     // creating iterator; its direction will be set in SetDirection()
     _fileIterator = folder.Repository.ObjectFactory.GetDataFileIterator(folder, false);
     SetDirection(EnumerationDirection.Forwards);
 }
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return false;
     }
     FolderReadingPosition that = obj as FolderReadingPosition;
     if (obj == null)
     {
         return false;
     }
     return this.FolderKey == that.FolderKey && this.Time == that.Time && this.NumberOfItemsWithTheTimestampRead == that.NumberOfItemsWithTheTimestampRead
         && this.VerificationLastReadItemHash == that.VerificationLastReadItemHash;
 }
Exemple #3
0
        /// <summary>
        ///		Add a folder to the list of folders being read and prepare it for reading if the reader has data
        /// </summary>
        /// <param name="folder">
        ///		Repository folder
        /// </param>
        /// <returns>
        ///		<see langword="false"/> - the folder is already being read
        ///		<see langword="true"/> otherwise
        /// </returns>
        /// <remarks>
        ///		Starting new folder from last read item time, not next item time to be consistent
        ///		if no items has been read yet, using last seek time; this works transparently with restoring position;
        ///		say a reader was sought but there was no data or reading was interrupted; the reader should provide a position
        ///		upon restoration of which later all items added since the position was saved and which would have been read
        ///		had the seek been called after they were added, would be read by the reader.
        /// </remarks>
        /// <exception cref="ObjectDisposedException">
        ///		The reader has been disposed.
        /// </exception>
        public bool AddFolder(IRepositoryFolder folder)
        {
            CheckNotDisposed();
            Exceptions.DifferentRepositoriesExceptionHelper.Check(folder.Repository, Repository);
            // position if reading is under way; otherwise Seek will have to be called before reading
            // all additions should go through AddFolderImpl
            FolderReadingPosition position = null;

            if (IsPositioned)
            {
                position = new FolderReadingPosition(folder, _position.Time);
            }
            return(AddFolderImpl(folder, position));
        }