ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/FileSystem.cpp
Revision: 713
Committed: 2006-03-27T00:50:21-08:00 (19 years, 2 months ago) by douglas
File size: 1944 byte(s)
Log Message:
Stuff and things...

File Contents

# User Rev Content
1 douglas 688 // File System
2     //
3 douglas 686 // Douglas Thrift
4     //
5     // $Id$
6    
7     #include <cxx/standard.hh>
8    
9 douglas 705 #include <api/pcre/regex.hpp>
10    
11 douglas 686 #include "FileSystem.hpp"
12    
13 douglas 713 FileSystem::FileSystem(const cse::String &sitemap, const cse::String &base, ext::Queue<Url> &queue, api::ThreadMutex &queueLock, const _R<FileSystemCommand> &command) : CommandRunner(sitemap, queue, queueLock)
14 douglas 686 {
15 douglas 688 api::Cout << _B("File System") << ios::NewLine;
16 douglas 698
17 douglas 713 Directory(command->root, _S<ios::String>() << base << command->path, true);
18 douglas 686 }
19 douglas 705
20 douglas 713 void FileSystem::Directory(const api::Path &directory, const cse::String &base, bool root)
21 douglas 705 {
22 douglas 713 ext::RedBlackSet<cse::String> excludes(GetProperties<ext::RedBlackSet<cse::String> >(_B("GoogleTron:Exclude"), directory.GetPath()));
23 douglas 705
24 douglas 713 if (root)
25 douglas 705 excludes.Insert(sitemap);
26    
27     _foreach (const _L<Subversion::Entry>, entry, client.GetEntries(directory.GetPath()))
28     if (!entry->GetName().StartsWith('.') && !excludes.Contains(entry->GetName()) && client.GetProperty(_B("svn:mime-type"), directory.GetChild(entry->GetName()).GetPath()).IsEmpty())
29     switch (entry->GetKind())
30     {
31     case Subversion::file:
32     File(directory.GetChild(entry->GetName()), base, *entry);
33     break;
34     case Subversion::dir:
35     Directory(directory.GetChild(entry->GetName()), _S<ios::String>() << base << entry->GetName() << _B("/"));
36     break;
37     _nodefault
38     }
39     }
40    
41     void FileSystem::File(const api::Path &file, const cse::String &base, const Subversion::Entry &entry)
42     {
43     _S<ios::String> location(base);
44    
45     if (!api::Pcre::RegEx(_B("^index\\..+$"))(entry.GetName()))
46     {
47     cse::String actually(client.GetProperty(_B("GoogleTron:Actually"), file.GetPath()));
48    
49     if (actually.IsEmpty())
50     location << entry.GetName();
51     else
52     location << actually;
53     }
54    
55     Url url(location, entry.GetModified(), GetFrequency(client.GetProperty(_B("GoogleTron:Frequency"), file.GetPath())), GetPriority(client.GetProperty(_B("GoogleTron:Priority"), file.GetPath())));
56    
57     _synchronized (queueLock)
58     queue.Push(url);
59     }

Properties

Name Value
svn:eol-style native
svn:keywords Id