using System.ComponentModel.Composition;
using System.Diagnostics.Contracts;
using System.Linq;
+using System.Threading;
using Pithos.Interfaces;
namespace Pithos.Core
return files.GetConsumingEnumerable();
}
+ public void Stop()
+ {
+
+ }
+
private PithosStatus _pithosStatus = PithosStatus.InSynch;
public void SetPithosStatus(PithosStatus status)
return _pithosStatus;
}
+ public void SetStatus(string path, Action<FileState> setter)
+ {
+ throw new NotImplementedException();
+ }
+
+ ConcurrentDictionary<string, NetworkState> _networkState = new ConcurrentDictionary<string, NetworkState>();
+
+
+ public void SetNetworkState(string path, NetworkState state)
+ {
+ _networkState[path.ToLower()] = state;
+ //Removing may fail so we store the "None" value anyway
+ if (state == NetworkState.None)
+ {
+ NetworkState oldState;
+ _networkState.TryRemove(path, out oldState);
+ }
+ }
+
+ public NetworkState GetNetworkState(string path)
+ {
+ NetworkState state;
+ if (_networkState.TryGetValue(path, out state))
+ return state;
+ return NetworkState.None;
+ }
+
+ public void StartProcessing(CancellationToken token)
+ {
+
+ }
+
public void SetFileOverlayStatus(string path, FileOverlayStatus overlayStatus)
{
_overlayCache[path] = overlayStatus;
_statusCache[path] = status;
}
+ public void SetFileState(string path, FileStatus fileStatus, FileOverlayStatus overlayStatus)
+ {
+ if (String.IsNullOrWhiteSpace(path))
+ throw new ArgumentNullException("path","path can't be empty");
+ _statusCache[path] = fileStatus;
+ _overlayCache[path] = overlayStatus;
+ }
+
+ public void StoreInfo(string path, ObjectInfo objectInfo)
+ {
+ if (String.IsNullOrWhiteSpace(path))
+ throw new ArgumentNullException("path", "path can't be empty");
+ if (objectInfo == null)
+ throw new ArgumentNullException("objectInfo", "objectInfo can't be empty");
+
+ _statusCache[path] = FileStatus.Unchanged;
+ _overlayCache[path] = FileOverlayStatus.Normal;
+ _checksums[path] = objectInfo.Hash;
+
+
+ }
+
+ public T GetStatus<T>(string path, Func<FileState, T> getter, T defaultValue)
+ {
+ throw new NotImplementedException();
+ }
+
public FileStatus GetFileStatus(string path)
{
if (!_statusCache.ContainsKey(path))