##// END OF EJS Templates
interfaces: make all methods on any repository Protocol class abstract...
Matt Harbison -
r53396:9358d786 default
parent child Browse files
Show More
@@ -155,6 +155,7 class _ipeerconnection(Protocol):
155 path: urlutil.path | None
155 path: urlutil.path | None
156 """a urlutil.path instance or None"""
156 """a urlutil.path instance or None"""
157
157
158 @abc.abstractmethod
158 def url(self):
159 def url(self):
159 """Returns a URL string representing this peer.
160 """Returns a URL string representing this peer.
160
161
@@ -167,6 +168,7 class _ipeerconnection(Protocol):
167 value.
168 value.
168 """
169 """
169
170
171 @abc.abstractmethod
170 def local(self):
172 def local(self):
171 """Returns a local repository instance.
173 """Returns a local repository instance.
172
174
@@ -174,9 +176,11 class _ipeerconnection(Protocol):
174 can be used to interface with it. Otherwise returns ``None``.
176 can be used to interface with it. Otherwise returns ``None``.
175 """
177 """
176
178
179 @abc.abstractmethod
177 def canpush(self):
180 def canpush(self):
178 """Returns a boolean indicating if this peer can be pushed to."""
181 """Returns a boolean indicating if this peer can be pushed to."""
179
182
183 @abc.abstractmethod
180 def close(self):
184 def close(self):
181 """Close the connection to this peer.
185 """Close the connection to this peer.
182
186
@@ -188,6 +192,7 class _ipeerconnection(Protocol):
188 class ipeercapabilities(Protocol):
192 class ipeercapabilities(Protocol):
189 """Peer sub-interface related to capabilities."""
193 """Peer sub-interface related to capabilities."""
190
194
195 @abc.abstractmethod
191 def capable(self, name):
196 def capable(self, name):
192 """Determine support for a named capability.
197 """Determine support for a named capability.
193
198
@@ -199,6 +204,7 class ipeercapabilities(Protocol):
199 Capability strings may or may not map to wire protocol capabilities.
204 Capability strings may or may not map to wire protocol capabilities.
200 """
205 """
201
206
207 @abc.abstractmethod
202 def requirecap(self, name, purpose):
208 def requirecap(self, name, purpose):
203 """Require a capability to be present.
209 """Require a capability to be present.
204
210
@@ -419,6 +425,7 class ipeerrequests(Protocol):
419 limitedarguments: bool
425 limitedarguments: bool
420 """True if the peer cannot receive large argument value for commands."""
426 """True if the peer cannot receive large argument value for commands."""
421
427
428 @abc.abstractmethod
422 def commandexecutor(self):
429 def commandexecutor(self):
423 """A context manager that resolves to an ipeercommandexecutor.
430 """A context manager that resolves to an ipeercommandexecutor.
424
431
@@ -580,9 +587,11 class ifilerevisionssequence(Protocol):
580 in the index.
587 in the index.
581 """
588 """
582
589
590 @abc.abstractmethod
583 def __len__(self):
591 def __len__(self):
584 """The total number of revisions."""
592 """The total number of revisions."""
585
593
594 @abc.abstractmethod
586 def __getitem__(self, rev):
595 def __getitem__(self, rev):
587 """Returns the object having a specific revision number.
596 """Returns the object having a specific revision number.
588
597
@@ -614,9 +623,11 class ifilerevisionssequence(Protocol):
614 recent revision.
623 recent revision.
615 """
624 """
616
625
626 @abc.abstractmethod
617 def __contains__(self, rev):
627 def __contains__(self, rev):
618 """Whether a revision number exists."""
628 """Whether a revision number exists."""
619
629
630 @abc.abstractmethod
620 def insert(self, i, entry):
631 def insert(self, i, entry):
621 """Add an item to the index at specific revision."""
632 """Add an item to the index at specific revision."""
622
633
@@ -1052,12 +1063,14 class idirs(Protocol):
1052 directories from a collection of paths.
1063 directories from a collection of paths.
1053 """
1064 """
1054
1065
1066 @abc.abstractmethod
1055 def addpath(self, path):
1067 def addpath(self, path):
1056 """Add a path to the collection.
1068 """Add a path to the collection.
1057
1069
1058 All directories in the path will be added to the collection.
1070 All directories in the path will be added to the collection.
1059 """
1071 """
1060
1072
1073 @abc.abstractmethod
1061 def delpath(self, path):
1074 def delpath(self, path):
1062 """Remove a path from the collection.
1075 """Remove a path from the collection.
1063
1076
@@ -1065,9 +1078,11 class idirs(Protocol):
1065 directory is removed from the collection.
1078 directory is removed from the collection.
1066 """
1079 """
1067
1080
1081 @abc.abstractmethod
1068 def __iter__(self):
1082 def __iter__(self):
1069 """Iterate over the directories in this collection of paths."""
1083 """Iterate over the directories in this collection of paths."""
1070
1084
1085 @abc.abstractmethod
1071 def __contains__(self, path):
1086 def __contains__(self, path):
1072 """Whether a specific directory is in this collection."""
1087 """Whether a specific directory is in this collection."""
1073
1088
@@ -1264,6 +1279,7 class imanifestrevisionbase(Protocol):
1264 as part of a larger interface.
1279 as part of a larger interface.
1265 """
1280 """
1266
1281
1282 @abc.abstractmethod
1267 def copy(self):
1283 def copy(self):
1268 """Obtain a copy of this manifest instance.
1284 """Obtain a copy of this manifest instance.
1269
1285
@@ -1272,6 +1288,7 class imanifestrevisionbase(Protocol):
1272 ``imanifestlog`` collection as this instance.
1288 ``imanifestlog`` collection as this instance.
1273 """
1289 """
1274
1290
1291 @abc.abstractmethod
1275 def read(self):
1292 def read(self):
1276 """Obtain the parsed manifest data structure.
1293 """Obtain the parsed manifest data structure.
1277
1294
@@ -2304,12 +2321,14 class iwireprotocolcommandcacher(Protoco
2304 instances to avoid this overhead.
2321 instances to avoid this overhead.
2305 """
2322 """
2306
2323
2324 @abc.abstractmethod
2307 def __enter__(self):
2325 def __enter__(self):
2308 """Marks the instance as active.
2326 """Marks the instance as active.
2309
2327
2310 Should return self.
2328 Should return self.
2311 """
2329 """
2312
2330
2331 @abc.abstractmethod
2313 def __exit__(self, exctype, excvalue, exctb):
2332 def __exit__(self, exctype, excvalue, exctb):
2314 """Called when cacher is no longer used.
2333 """Called when cacher is no longer used.
2315
2334
@@ -2317,6 +2336,7 class iwireprotocolcommandcacher(Protoco
2317 disconnecting network sockets, aborting a partially cached response.
2336 disconnecting network sockets, aborting a partially cached response.
2318 """
2337 """
2319
2338
2339 @abc.abstractmethod
2320 def adjustcachekeystate(self, state):
2340 def adjustcachekeystate(self, state):
2321 """Influences cache key derivation by adjusting state to derive key.
2341 """Influences cache key derivation by adjusting state to derive key.
2322
2342
@@ -2329,6 +2349,7 class iwireprotocolcommandcacher(Protoco
2329 existing keys.
2349 existing keys.
2330 """
2350 """
2331
2351
2352 @abc.abstractmethod
2332 def setcachekey(self, key):
2353 def setcachekey(self, key):
2333 """Record the derived cache key for this request.
2354 """Record the derived cache key for this request.
2334
2355
@@ -2341,6 +2362,7 class iwireprotocolcommandcacher(Protoco
2341 instance.
2362 instance.
2342 """
2363 """
2343
2364
2365 @abc.abstractmethod
2344 def lookup(self):
2366 def lookup(self):
2345 """Attempt to resolve an entry in the cache.
2367 """Attempt to resolve an entry in the cache.
2346
2368
@@ -2359,6 +2381,7 class iwireprotocolcommandcacher(Protoco
2359 would return if invoked or an equivalent representation thereof.
2381 would return if invoked or an equivalent representation thereof.
2360 """
2382 """
2361
2383
2384 @abc.abstractmethod
2362 def onobject(self, obj):
2385 def onobject(self, obj):
2363 """Called when a new object is emitted from the command function.
2386 """Called when a new object is emitted from the command function.
2364
2387
@@ -2370,6 +2393,7 class iwireprotocolcommandcacher(Protoco
2370 ``yield obj``.
2393 ``yield obj``.
2371 """
2394 """
2372
2395
2396 @abc.abstractmethod
2373 def onfinished(self):
2397 def onfinished(self):
2374 """Called after all objects have been emitted from the command function.
2398 """Called after all objects have been emitted from the command function.
2375
2399
General Comments 0
You need to be logged in to leave comments. Login now