syncer.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_SYNCER_HH
00021 #define PALUDIS_GUARD_PALUDIS_SYNCER_HH 1
00022
00023 #include <paludis/util/exception.hh>
00024 #include <paludis/repository.hh>
00025 #include <string>
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace paludis
00039 {
00040 namespace n
00041 {
00042 struct environment;
00043 struct filter_file;
00044 struct local;
00045 struct options;
00046 struct output_deviant;
00047 struct output_prefix;
00048 struct remote;
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058 struct SyncOptions
00059 {
00060 NamedValue<n::filter_file, FSEntry> filter_file;
00061 NamedValue<n::options, std::string> options;
00062
00063
00064
00065
00066
00067 NamedValue<n::output_deviant, std::tr1::shared_ptr<const OutputDeviant> > output_deviant;
00068
00069 NamedValue<n::output_prefix, std::string> output_prefix;
00070 };
00071
00072
00073
00074
00075
00076
00077
00078
00079 struct SyncerParams
00080 {
00081 NamedValue<n::environment, const Environment *> environment;
00082 NamedValue<n::local, std::string> local;
00083 NamedValue<n::remote, std::string> remote;
00084 };
00085
00086
00087
00088
00089
00090
00091 class PALUDIS_VISIBLE Syncer :
00092 private InstantiationPolicy<Syncer, instantiation_method::NonCopyableTag>
00093 {
00094 protected:
00095
00096
00097
00098 Syncer();
00099
00100 public:
00101
00102
00103
00104 virtual ~Syncer();
00105
00106
00107
00108
00109 virtual void sync(const SyncOptions &) const = 0;
00110 };
00111
00112
00113
00114
00115
00116
00117 class PALUDIS_VISIBLE DefaultSyncer :
00118 public Syncer
00119 {
00120 private:
00121 std::string _local, _remote;
00122 const Environment *_environment;
00123
00124 std::string _syncer;
00125
00126 public:
00127
00128
00129
00130 DefaultSyncer(const SyncerParams &);
00131
00132
00133
00134
00135 virtual ~DefaultSyncer();
00136
00137
00138
00139
00140 virtual void sync(const SyncOptions &) const;
00141 };
00142
00143
00144
00145
00146
00147
00148
00149 class PALUDIS_VISIBLE SyncFailedError :
00150 public Exception
00151 {
00152 public:
00153
00154
00155
00156 SyncFailedError(const std::string & msg) throw ();
00157
00158
00159
00160
00161 SyncFailedError(const std::string & local, const std::string & remote) throw ();
00162 };
00163
00164
00165
00166
00167
00168
00169
00170 class PALUDIS_VISIBLE NoSuchSyncerError : public SyncFailedError
00171 {
00172 public:
00173
00174
00175
00176 NoSuchSyncerError(const std::string & format) throw ();
00177 };
00178 }
00179
00180 #endif