public FeedsController(AutodetectFeeds detector, FeedMaintenance reader, PierceConfig config, Mongo db) : base(db) { _detector = detector; _reader = reader; _config = config; }
public AutodetectFeeds(Wget wget, FeedParser parser, ReadFeeds reader, Mongo db, ILogger logger) { _wget = wget; _parser = parser; _reader = reader; _db = db; _logger = logger; }
public void Save(Mongo db) { bool noId = string.IsNullOrEmpty(Id); db.Chunks.Save(this); if (noId) { foreach (var article in Articles) { article.ChunkId = Id; } db.Chunks.Save(this); } }
public static Chunk ById(string chunkId, Mongo db) { return db.Chunks.FindOneById(new ObjectId(chunkId)); }
public ChunkShuffler(Mongo db, ILogger logger) { _db = db; _logger = logger; }
public SubscriptionsHandler(Mongo db, PierceConfig config) { _db = db; _config = config; }
public BaseController(Mongo db) { this.db = db; log = LogManager.GetLogger(this.GetType()); }
public void Save(Mongo db) { if (string.IsNullOrEmpty(Id)) { // Ensure we have an id that we can set for our chunks. db.Feeds.Save(this); } // shouldn't happen... if (_head != null && !_chunkCache.Contains(_head)) { _chunkCache.Add(_head); } foreach (var chunk in _chunkCache.Where(x => !x.Articles.Any())) { Console.WriteLine("removing chunk {0} because it has {1} articles", chunk.Id, chunk.Articles.Count); ChunkIds.Remove(chunk.Id); } foreach (var chunk in _chunkCache.Where(x => x.Articles.Any()).OrderBy(x => x.Articles.First().PublishDate)) { Console.WriteLine("saving chunk {0} with {1} articles", chunk.Id, chunk.Articles.Count); chunk.FeedId = this.Id; chunk.Save(db); if (!ChunkIds.Contains(chunk.Id)) { ChunkIds.Add(chunk.Id); } } if (_head != null) { if (string.IsNullOrWhiteSpace(_head.Id)) { _head = null; HeadChunkId = ChunkIds.LastOrDefault(); } else if (HeadChunkId != _head.Id) { HeadChunkId = _head.Id; } } db.Feeds.Save(this); }
public UsersController(Mongo db, PierceConfig config) : base(db) { _config = config; }
public FeedMaintenance(IFeedTask[] tasks, Mongo db, ILogger logger) { _tasks = tasks.OrderBy(task => task.Priority).ToList(); _db = db; _logger = logger; }
public Chunk GetHeadChunk(Mongo db) { if (_head != null) { return _head; } if (string.IsNullOrEmpty(HeadChunkId)) { HeadChunkId = ChunkIds.LastOrDefault(); if (string.IsNullOrEmpty(HeadChunkId)) { _head = new Chunk { FeedId = Id }; CacheChunk(_head); return _head; } } _head = GetChunk(HeadChunkId, db); if (_head == null) { _head = new Chunk { FeedId = Id }; CacheChunk(_head); } return _head; }
public Chunk GetChunk(string id, Mongo db) { return _chunkCache.Where(x => x.Id == id).FirstOrDefault() ?? Chunk.ById(id, db); }
public static Feed ByUri(string uri, Mongo db) { return db.Feeds.Find(Query.EQ("Uri", uri)).FirstOrDefault(); }
public static Feed ById(string id, Mongo db) { return db.Feeds.Find(Query.EQ("_id", new ObjectId(id))).FirstOrDefault(); }
public OrphanChunkKiller(Mongo db, ILogger logger) { _db = db; _logger = logger; }
public GarbageCollector(Mongo db, PierceConfig config) { _db = db; _config = config; }
public FeedParser(Mongo db, ILogger logger) { _db = db; _logger = logger; }