private void OnInotify(Inotify.Watch watch,
                               string path, string subitem, string srcpath,
                               Inotify.EventType type)
        {
            long offset = 0;

            path = Path.Combine(path, subitem);
            if (ThisScheduler.ContainsByTag(path))
            {
                Log.Debug("Not adding task for already running task: {0}", path);
                return;
            }

            lock (initial_log_files) {
                if (initial_log_files.Contains(path))
                {
                    Log.Debug("{0} is already scheduled for initial indexing", path);
                    return;
                }
            }

            if (session_offset_table.ContainsKey(path))
            {
                offset = session_offset_table [path];
            }

            SessionIndexableGenerator generator = new SessionIndexableGenerator(this, path, offset);

            Scheduler.Task task = NewAddTask(generator);
            task.Tag    = path;
            task.Source = this;
            ThisScheduler.Add(task);
        }
 public LogIndexableGenerator(KonversationQueryable q, string log_dir)
 {
     this.queryable  = q;
     this.files      = Directory.GetFiles(log_dir);
     this.file_index = 0;
     this.log_dir    = log_dir;
     this.generator  = null;
 }
            public bool HasNextIndexable()
            {
                if (generator != null && generator.HasNextIndexable())
                {
                    return(true);
                }

                // Move to the next file
                if (!MoveToNextFile())
                {
                    queryable.IsIndexing = false;
                    return(false);
                }

                generator = new SessionIndexableGenerator(queryable, files [file_index], 0);
                file_index++;
                if (!generator.HasNextIndexable())
                {
                    queryable.IsIndexing = false;
                    return(false);
                }

                return(true);
            }
			public bool HasNextIndexable ()
			{
				if (generator != null && generator.HasNextIndexable ())
					return true;

				// Move to the next file
				if (! MoveToNextFile ()) {
					queryable.IsIndexing = false;
					return false;
				}

				generator = new SessionIndexableGenerator (queryable, files [file_index], 0);
				file_index ++;
				if (! generator.HasNextIndexable ()) {
					queryable.IsIndexing = false;
					return false;
				}

				return true;
			}
			public LogIndexableGenerator (KonversationQueryable q, string log_dir)
			{
				this.queryable = q;
				this.files = Directory.GetFiles (log_dir);
				this.file_index = 0;
				this.log_dir = log_dir;
				this.generator = null;
			}
		private void OnInotify (Inotify.Watch watch,
					string path, string subitem, string srcpath,
					Inotify.EventType type)
		{
			long offset = 0;
			path = Path.Combine (path, subitem);
			if (ThisScheduler.ContainsByTag (path)) {
				Log.Debug ("Not adding task for already running task: {0}", path);
				return;
			}

			lock (initial_log_files) {
				if (initial_log_files.Contains (path)) {
					Log.Debug ("{0} is already scheduled for initial indexing", path);
					return;
				}
			}

			if (session_offset_table.ContainsKey (path))
				offset = session_offset_table [path];

			SessionIndexableGenerator generator = new SessionIndexableGenerator (this, path, offset);
			Scheduler.Task task = NewAddTask (generator);
			task.Tag = path;
			task.Source = this;
			ThisScheduler.Add (task);
		}