Revision 5ce54458 trunk/Pithos.Core/InMemStatusChecker.cs
b/trunk/Pithos.Core/InMemStatusChecker.cs | ||
---|---|---|
6 | 6 |
using System.Linq; |
7 | 7 |
using System.Threading; |
8 | 8 |
using Pithos.Interfaces; |
9 |
using Pithos.Network; |
|
9 | 10 |
|
10 | 11 |
namespace Pithos.Core |
11 | 12 |
{ |
... | ... | |
79 | 80 |
throw new NotImplementedException(); |
80 | 81 |
} |
81 | 82 |
|
82 |
ConcurrentDictionary<string, NetworkState> _networkState = new ConcurrentDictionary<string, NetworkState>();
|
|
83 |
ConcurrentDictionary<string, NetworkOperation> _networkState = new ConcurrentDictionary<string, NetworkOperation>();
|
|
83 | 84 |
|
84 | 85 |
|
85 |
public void SetNetworkState(string path, NetworkState state)
|
|
86 |
public void SetNetworkState(string path, NetworkOperation operation)
|
|
86 | 87 |
{ |
87 |
_networkState[path.ToLower()] = state;
|
|
88 |
_networkState[path.ToLower()] = operation;
|
|
88 | 89 |
//Removing may fail so we store the "None" value anyway |
89 |
if (state == NetworkState.None)
|
|
90 |
if (operation == NetworkOperation.None)
|
|
90 | 91 |
{ |
91 |
NetworkState oldState;
|
|
92 |
_networkState.TryRemove(path, out oldState);
|
|
92 |
NetworkOperation oldOperation;
|
|
93 |
_networkState.TryRemove(path, out oldOperation);
|
|
93 | 94 |
} |
94 | 95 |
} |
95 | 96 |
|
96 |
public NetworkState GetNetworkState(string path)
|
|
97 |
public NetworkOperation GetNetworkState(string path)
|
|
97 | 98 |
{ |
98 |
NetworkState state;
|
|
99 |
if (_networkState.TryGetValue(path, out state))
|
|
100 |
return state;
|
|
101 |
return NetworkState.None;
|
|
99 |
NetworkOperation operation;
|
|
100 |
if (_networkState.TryGetValue(path, out operation))
|
|
101 |
return operation;
|
|
102 |
return NetworkOperation.None;
|
|
102 | 103 |
} |
103 | 104 |
|
104 | 105 |
public void StartProcessing(CancellationToken token) |
... | ... | |
108 | 109 |
|
109 | 110 |
public string BlockHash { get; set; } |
110 | 111 |
|
112 |
public int BlockSize { get; set; } |
|
113 |
|
|
114 |
|
|
111 | 115 |
public void SetFileOverlayStatus(string path, FileOverlayStatus overlayStatus) |
112 | 116 |
{ |
113 | 117 |
_overlayCache[path] = overlayStatus; |
Also available in: Unified diff