root / trunk / Pithos.Core / IStatusKeeper.cs @ 5ce54458
History | View | Annotate | Download (4.6 kB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Diagnostics.Contracts; |
4 |
using System.IO; |
5 |
using System.Linq; |
6 |
using System.Threading; |
7 |
using Pithos.Interfaces; |
8 |
|
9 |
namespace Pithos.Core |
10 |
{ |
11 |
[ContractClass(typeof(IStatusKeeperContract))] |
12 |
public interface IStatusKeeper |
13 |
{ |
14 |
void SetFileOverlayStatus(string path,FileOverlayStatus status); |
15 |
void UpdateFileChecksum(string path, string checksum); |
16 |
void RemoveFileOverlayStatus(string path); |
17 |
void SetFileStatus(string path, FileStatus status); |
18 |
FileStatus GetFileStatus(string path); |
19 |
void ClearFileStatus(string path); |
20 |
void SetPithosStatus(PithosStatus status); |
21 |
FileOverlayStatus GetFileOverlayStatus(string path); |
22 |
IEnumerable<string> StoreUnversionedFiles(ParallelQuery<string> paths); |
23 |
void Stop(); |
24 |
void SetFileState(string path, FileStatus fileStatus, FileOverlayStatus overlayStatus); |
25 |
void StoreInfo(string path, ObjectInfo objectInfo); |
26 |
T GetStatus<T>(string path,Func<FileState,T> getter,T defaultValue ); |
27 |
void SetStatus(string path, Action<FileState> setter); |
28 |
|
29 |
void StartProcessing(CancellationToken token); |
30 |
|
31 |
string BlockHash { get; set; } |
32 |
int BlockSize { get; set; } |
33 |
} |
34 |
|
35 |
[ContractClassFor(typeof(IStatusKeeper))] |
36 |
public abstract class IStatusKeeperContract : IStatusKeeper |
37 |
{ |
38 |
public void SetFileOverlayStatus(string path, FileOverlayStatus status) |
39 |
{ |
40 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
41 |
} |
42 |
|
43 |
public void UpdateFileChecksum(string path, string checksum) |
44 |
{ |
45 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
46 |
Contract.Requires(checksum!=null); |
47 |
} |
48 |
|
49 |
public void RemoveFileOverlayStatus(string path) |
50 |
{ |
51 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
52 |
} |
53 |
|
54 |
public void RenameFileOverlayStatus(string oldPath, string newPath) |
55 |
{ |
56 |
Contract.Requires(!String.IsNullOrWhiteSpace(oldPath)); |
57 |
Contract.Requires(!String.IsNullOrWhiteSpace(newPath)); |
58 |
|
59 |
} |
60 |
|
61 |
public void SetFileStatus(string path, FileStatus status) |
62 |
{ |
63 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
64 |
} |
65 |
|
66 |
public FileStatus GetFileStatus(string path) |
67 |
{ |
68 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
69 |
|
70 |
return default(FileStatus); |
71 |
} |
72 |
|
73 |
public FileOverlayStatus GetFileOverlayStatus(string path) |
74 |
{ |
75 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
76 |
|
77 |
return default(FileOverlayStatus); |
78 |
} |
79 |
|
80 |
public IEnumerable<string> StoreUnversionedFiles(ParallelQuery<string> paths) |
81 |
{ |
82 |
Contract.Requires(paths!=null); |
83 |
|
84 |
return default(IEnumerable<string>); |
85 |
} |
86 |
|
87 |
public void Stop() |
88 |
{ |
89 |
|
90 |
} |
91 |
|
92 |
public void SetFileState(string path, FileStatus fileStatus, FileOverlayStatus overlayStatus) |
93 |
{ |
94 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
95 |
} |
96 |
|
97 |
public void StoreInfo(string path, ObjectInfo objectInfo) |
98 |
{ |
99 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
100 |
Contract.Requires(objectInfo!=null); |
101 |
} |
102 |
|
103 |
public T GetStatus<T>(string path, Func<FileState, T> getter, T defaultValue) |
104 |
{ |
105 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
106 |
Contract.Requires(getter!=null); |
107 |
|
108 |
return default(T); |
109 |
} |
110 |
|
111 |
public void SetStatus(string path, Action<FileState> setter) |
112 |
{ |
113 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
114 |
Contract.Requires(setter != null); |
115 |
} |
116 |
|
117 |
public void SetNetworkState(string path, NetworkOperation operation) |
118 |
{ |
119 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
120 |
Contract.Requires(Path.IsPathRooted(path)); |
121 |
} |
122 |
|
123 |
public NetworkOperation GetNetworkState(string path) |
124 |
{ |
125 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
126 |
|
127 |
return default(NetworkOperation); |
128 |
} |
129 |
|
130 |
public void ClearFileStatus(string path) |
131 |
{ |
132 |
Contract.Requires(!String.IsNullOrWhiteSpace(path)); |
133 |
} |
134 |
|
135 |
public void SetPithosStatus(PithosStatus status) |
136 |
{ |
137 |
} |
138 |
|
139 |
public void StartProcessing(CancellationToken token) |
140 |
{ |
141 |
Contract.Requires(token != null, "token can't be empty"); |
142 |
} |
143 |
|
144 |
public abstract string BlockHash { get; set; } |
145 |
public abstract int BlockSize { get; set; } |
146 |
} |
147 |
} |