Esempio n. 1
0
        public IEnumerable<RemoteManifestEntry> GetAllManifestEntries()
        {
            IList <RemoteManifestEntry> entries = new List <RemoteManifestEntry> ();

            ParseNodes(
                requester.GetAllHashesReader (),
                "post",
                reader => {
                    RemoteManifestEntry entry = new RemoteManifestEntry ();

                    entry.MetaHash = reader.GetAttribute ("meta");
                    entry.UrlHash = reader.GetAttribute ("url");

                    entries.Add (entry);
                });

            return entries;
        }
Esempio n. 2
0
        PartialCrawlCommand PreparePartialCommandFromRemoteEntry(
			RemoteManifestEntry remoteEntry,
			IDictionary <string, LocalManifestEntry> localEntries)
        {
            PartialCrawlCommand newCommand = null;

            // If the local manifest contains the remote entry,
            // then update the local entry, otherwise add a new one
            if (localEntries.ContainsKey (remoteEntry.UrlHash))
            {
                LocalManifestEntry localEntry = localEntries [remoteEntry.UrlHash];

                // Update if the meta data has changed.
                // Also pdate periodically to index changes to remote site content
                if (localEntry.MetaHash != remoteEntry.MetaHash
                    || localEntry.IsExpired)
                {
                    newCommand = new PartialCrawlCommand ();
                    newCommand.Action = CrawlAction.Update;
                    newCommand.Entry = remoteEntry;
                }
                else
                {
                    // Don't need to do anything with this entry; it's already synchronized
                }
            }
            else
            {
                newCommand = new PartialCrawlCommand ();
                newCommand.Action = CrawlAction.Add;
                newCommand.Entry = remoteEntry;
            }

            return newCommand;
        }