Revision 283809f3 trunk/Pithos.Core/InMemStatusChecker.cs
b/trunk/Pithos.Core/InMemStatusChecker.cs | ||
---|---|---|
73 | 73 |
return _pithosStatus; |
74 | 74 |
} |
75 | 75 |
|
76 |
public void SetStatus(string path, Action<FileState> setter) |
|
77 |
{ |
|
78 |
throw new NotImplementedException(); |
|
79 |
} |
|
80 |
|
|
81 |
ConcurrentDictionary<string, NetworkState> _networkState = new ConcurrentDictionary<string, NetworkState>(); |
|
82 |
|
|
83 |
|
|
84 |
public void SetNetworkState(string path, NetworkState state) |
|
85 |
{ |
|
86 |
_networkState[path.ToLower()] = state; |
|
87 |
//Removing may fail so we store the "None" value anyway |
|
88 |
if (state == NetworkState.None) |
|
89 |
{ |
|
90 |
NetworkState oldState; |
|
91 |
_networkState.TryRemove(path, out oldState); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
public NetworkState GetNetworkState(string path) |
|
96 |
{ |
|
97 |
NetworkState state; |
|
98 |
if (_networkState.TryGetValue(path, out state)) |
|
99 |
return state; |
|
100 |
return NetworkState.None; |
|
101 |
} |
|
102 |
|
|
76 | 103 |
public void SetFileOverlayStatus(string path, FileOverlayStatus overlayStatus) |
77 | 104 |
{ |
78 | 105 |
_overlayCache[path] = overlayStatus; |
... | ... | |
97 | 124 |
_statusCache[path] = status; |
98 | 125 |
} |
99 | 126 |
|
127 |
public void SetFileState(string path, FileStatus fileStatus, FileOverlayStatus overlayStatus) |
|
128 |
{ |
|
129 |
if (String.IsNullOrWhiteSpace(path)) |
|
130 |
throw new ArgumentNullException("path","path can't be empty"); |
|
131 |
_statusCache[path] = fileStatus; |
|
132 |
_overlayCache[path] = overlayStatus; |
|
133 |
} |
|
134 |
|
|
135 |
public void StoreInfo(string path, ObjectInfo objectInfo) |
|
136 |
{ |
|
137 |
if (String.IsNullOrWhiteSpace(path)) |
|
138 |
throw new ArgumentNullException("path", "path can't be empty"); |
|
139 |
if (objectInfo == null) |
|
140 |
throw new ArgumentNullException("objectInfo", "objectInfo can't be empty"); |
|
141 |
|
|
142 |
_statusCache[path] = FileStatus.Unchanged; |
|
143 |
_overlayCache[path] = FileOverlayStatus.Normal; |
|
144 |
_checksums[path] = objectInfo.Hash; |
|
145 |
|
|
146 |
|
|
147 |
} |
|
148 |
|
|
149 |
public T GetStatus<T>(string path, Func<FileState, T> getter, T defaultValue) |
|
150 |
{ |
|
151 |
throw new NotImplementedException(); |
|
152 |
} |
|
153 |
|
|
100 | 154 |
public FileStatus GetFileStatus(string path) |
101 | 155 |
{ |
102 | 156 |
if (!_statusCache.ContainsKey(path)) |
Also available in: Unified diff