Revision 5120f3cb trunk/Pithos.Core/Agents/StatusAgent.cs
b/trunk/Pithos.Core/Agents/StatusAgent.cs | ||
---|---|---|
26 | 26 |
private Agent<Action> _persistenceAgent; |
27 | 27 |
|
28 | 28 |
|
29 |
private static readonly ILog log = LogManager.GetLogger(typeof(StatusAgent));
|
|
29 |
private static readonly ILog Log = LogManager.GetLogger("StatusAgent");
|
|
30 | 30 |
|
31 | 31 |
public StatusAgent() |
32 | 32 |
{ |
... | ... | |
84 | 84 |
var connectionString = String.Format(@"Data Source={0}\pithos.db;Version=3", pithosDbPath); |
85 | 85 |
properties.Add("connection.connection_string", connectionString); |
86 | 86 |
|
87 |
var source = new InPlaceConfigurationSource(); |
|
88 |
|
|
87 |
var source = new InPlaceConfigurationSource(); |
|
89 | 88 |
source.Add(typeof (ActiveRecordBase), properties); |
89 |
source.SetDebugFlag(false); |
|
90 | 90 |
return source; |
91 | 91 |
} |
92 | 92 |
|
... | ... | |
107 | 107 |
} |
108 | 108 |
catch (Exception ex) |
109 | 109 |
{ |
110 |
Trace.TraceError("[ERROR] STATE \n{0}",ex);
|
|
110 |
Log.ErrorFormat("[ERROR] STATE \n{0}",ex);
|
|
111 | 111 |
} |
112 | 112 |
queue.DoAsync(loop); |
113 | 113 |
}); |
... | ... | |
192 | 192 |
public string BlockHash { get; set; } |
193 | 193 |
|
194 | 194 |
public int BlockSize { get; set; } |
195 |
public void ChangeRoots(string oldPath, string newPath) |
|
196 |
{ |
|
197 |
if (String.IsNullOrWhiteSpace(oldPath)) |
|
198 |
throw new ArgumentNullException("oldPath"); |
|
199 |
if (!Path.IsPathRooted(oldPath)) |
|
200 |
throw new ArgumentException("oldPath must be an absolute path", "oldPath"); |
|
201 |
if (string.IsNullOrWhiteSpace(newPath)) |
|
202 |
throw new ArgumentNullException("newPath"); |
|
203 |
if (!Path.IsPathRooted(newPath)) |
|
204 |
throw new ArgumentException("newPath must be an absolute path", "newPath"); |
|
205 |
Contract.EndContractBlock(); |
|
206 |
|
|
207 |
FileState.ChangeRootPath(oldPath,newPath); |
|
208 |
|
|
209 |
} |
|
195 | 210 |
|
196 | 211 |
private PithosStatus _pithosStatus=PithosStatus.InSynch; |
197 | 212 |
|
... | ... | |
226 | 241 |
} |
227 | 242 |
catch (Exception exc) |
228 | 243 |
{ |
229 |
Trace.TraceError(exc.ToString());
|
|
244 |
Log.ErrorFormat(exc.ToString());
|
|
230 | 245 |
return defaultValue; |
231 | 246 |
} |
232 | 247 |
} |
... | ... | |
298 | 313 |
var state = FileState.FindByFilePath(filePath); |
299 | 314 |
if (state == null) |
300 | 315 |
{ |
301 |
Trace.TraceWarning("[NOFILE] Unable to set status for {0}.", filePath);
|
|
316 |
Log.WarnFormat("[NOFILE] Unable to set status for {0}.", filePath);
|
|
302 | 317 |
return; |
303 | 318 |
} |
304 | 319 |
setter(state); |
... | ... | |
327 | 342 |
var state = FileState.Find(stateID); |
328 | 343 |
if (state == null) |
329 | 344 |
{ |
330 |
Trace.TraceWarning("[NOFILE] Unable to set status for {0}.", stateID);
|
|
345 |
Log.WarnFormat("[NOFILE] Unable to set status for {0}.", stateID);
|
|
331 | 346 |
return; |
332 | 347 |
} |
333 | 348 |
setter(state); |
... | ... | |
352 | 367 |
} |
353 | 368 |
catch (Exception exc) |
354 | 369 |
{ |
355 |
Trace.TraceError(exc.ToString());
|
|
370 |
Log.ErrorFormat(exc.ToString());
|
|
356 | 371 |
return FileOverlayStatus.Unversioned; |
357 | 372 |
} |
358 | 373 |
} |
... | ... | |
423 | 438 |
|
424 | 439 |
if (state == null) |
425 | 440 |
{ |
426 |
Trace.TraceWarning("[NOFILE] Unable to set status for {0}.", oldPath);
|
|
441 |
Log.WarnFormat("[NOFILE] Unable to set status for {0}.", oldPath);
|
|
427 | 442 |
return; |
428 | 443 |
} |
429 | 444 |
//NOTE: This will cause problems if path is used as a key in relationships |
... | ... | |
546 | 561 |
var state = FileState.FindByFilePath(path); |
547 | 562 |
if (state == null) |
548 | 563 |
{ |
549 |
Trace.TraceWarning("[NOFILE] Unable to set checkesum for {0}.", path);
|
|
564 |
Log.WarnFormat("[NOFILE] Unable to set checkesum for {0}.", path);
|
|
550 | 565 |
return; |
551 | 566 |
} |
552 | 567 |
state.Checksum = checksum; |
Also available in: Unified diff