Revision 5ce54458 trunk/Pithos.Core.Test/MockStatusKeeper.cs
b/trunk/Pithos.Core.Test/MockStatusKeeper.cs | ||
---|---|---|
6 | 6 |
using System.Text; |
7 | 7 |
using System.Threading; |
8 | 8 |
using Pithos.Interfaces; |
9 |
using Pithos.Network; |
|
9 | 10 |
|
10 | 11 |
namespace Pithos.Core.Test |
11 | 12 |
{ |
... | ... | |
95 | 96 |
throw new NotImplementedException(); |
96 | 97 |
} |
97 | 98 |
|
98 |
ConcurrentDictionary<string, NetworkState> _networkState = new ConcurrentDictionary<string, NetworkState>();
|
|
99 |
ConcurrentDictionary<string, NetworkOperation> _networkState = new ConcurrentDictionary<string, NetworkOperation>();
|
|
99 | 100 |
|
100 | 101 |
|
101 |
public void SetNetworkState(string path, NetworkState state)
|
|
102 |
public void SetNetworkState(string path, NetworkOperation operation)
|
|
102 | 103 |
{ |
103 |
_networkState[path.ToLower()] = state;
|
|
104 |
_networkState[path.ToLower()] = operation;
|
|
104 | 105 |
//Removing may fail so we store the "None" value anyway |
105 |
if (state == NetworkState.None)
|
|
106 |
if (operation == NetworkOperation.None)
|
|
106 | 107 |
{ |
107 |
NetworkState oldState;
|
|
108 |
_networkState.TryRemove(path, out oldState);
|
|
108 |
NetworkOperation oldOperation;
|
|
109 |
_networkState.TryRemove(path, out oldOperation);
|
|
109 | 110 |
} |
110 | 111 |
} |
111 | 112 |
|
112 |
public NetworkState GetNetworkState(string path)
|
|
113 |
public NetworkOperation GetNetworkState(string path)
|
|
113 | 114 |
{ |
114 |
NetworkState state;
|
|
115 |
if (_networkState.TryGetValue(path, out state))
|
|
116 |
return state;
|
|
117 |
return NetworkState.None;
|
|
115 |
NetworkOperation operation;
|
|
116 |
if (_networkState.TryGetValue(path, out operation))
|
|
117 |
return operation;
|
|
118 |
return NetworkOperation.None;
|
|
118 | 119 |
} |
119 | 120 |
|
120 | 121 |
public void StartProcessing(CancellationToken token) |
... | ... | |
124 | 125 |
|
125 | 126 |
public string BlockHash { get; set; } |
126 | 127 |
|
128 |
public int BlockSize { get; set; } |
|
129 |
|
|
127 | 130 |
|
128 | 131 |
private PithosStatus _pithosStatus = PithosStatus.InSynch; |
129 | 132 |
public void SetPithosStatus(PithosStatus status) |
Also available in: Unified diff