Revision 283809f3 trunk/Pithos.Core.Test/MockStatusKeeper.cs
b/trunk/Pithos.Core.Test/MockStatusKeeper.cs | ||
---|---|---|
62 | 62 |
throw new NotImplementedException(); |
63 | 63 |
} |
64 | 64 |
|
65 |
public void SetFileState(string path, FileStatus fileStatus, FileOverlayStatus overlayStatus) |
|
66 |
{ |
|
67 |
if (String.IsNullOrWhiteSpace(path)) |
|
68 |
throw new ArgumentNullException("path", "path can't be empty"); |
|
69 |
SetFileStatus(path, fileStatus); |
|
70 |
SetFileOverlayStatus(path, overlayStatus); |
|
71 |
} |
|
72 |
|
|
73 |
public void StoreInfo(string path, ObjectInfo objectInfo) |
|
74 |
{ |
|
75 |
if (String.IsNullOrWhiteSpace(path)) |
|
76 |
throw new ArgumentNullException("path", "path can't be empty"); |
|
77 |
if (objectInfo == null) |
|
78 |
throw new ArgumentNullException("objectInfo", "objectInfo can't be empty"); |
|
79 |
|
|
80 |
_statusCache[path] = FileStatus.Unchanged; |
|
81 |
_overlayCache[path] = FileOverlayStatus.Normal; |
|
82 |
_checksums[path] = objectInfo.Hash; |
|
83 |
|
|
84 |
|
|
85 |
} |
|
86 |
|
|
87 |
public T GetStatus<T>(string path, Func<FileState, T> getter, T defaultValue) |
|
88 |
{ |
|
89 |
throw new NotImplementedException(); |
|
90 |
} |
|
91 |
|
|
92 |
public void SetStatus(string path, Action<FileState> setter) |
|
93 |
{ |
|
94 |
throw new NotImplementedException(); |
|
95 |
} |
|
96 |
|
|
97 |
ConcurrentDictionary<string, NetworkState> _networkState = new ConcurrentDictionary<string, NetworkState>(); |
|
98 |
|
|
99 |
|
|
100 |
public void SetNetworkState(string path, NetworkState state) |
|
101 |
{ |
|
102 |
_networkState[path.ToLower()] = state; |
|
103 |
//Removing may fail so we store the "None" value anyway |
|
104 |
if (state == NetworkState.None) |
|
105 |
{ |
|
106 |
NetworkState oldState; |
|
107 |
_networkState.TryRemove(path, out oldState); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 |
public NetworkState GetNetworkState(string path) |
|
112 |
{ |
|
113 |
NetworkState state; |
|
114 |
if (_networkState.TryGetValue(path, out state)) |
|
115 |
return state; |
|
116 |
return NetworkState.None; |
|
117 |
} |
|
118 |
|
|
65 | 119 |
|
66 | 120 |
private PithosStatus _pithosStatus = PithosStatus.InSynch; |
67 | 121 |
public void SetPithosStatus(PithosStatus status) |
Also available in: Unified diff