source: geniuswebcore/geniusweb/connection/ConnectionFactory.py@ 74

Last change on this file since 74 was 73, checked in by Bart Vastenhouw, 3 years ago

Fix for IssueValue hashcode.

File size: 1.4 KB
Line 
1from abc import ABC, abstractmethod
2from typing import TypeVar, Generic
3
4from geniusweb.connection.ConnectionEnd import ConnectionEnd
5from geniusweb.references.Reference import Reference
6
7
8INTYPE = TypeVar('INTYPE')
9OUTTYPE = TypeVar('OUTTYPE')
10
11class ConnectionFactory(ABC, Generic[INTYPE,OUTTYPE]):
12 '''
13 factory that can turn a {@link Reference} into a connection to that
14 reference.
15
16
17 @param <INTYPE> the type of incoming messages. Incoming messages are
18 received through Listener#not. Incoming messages are usually
19 asynchronous.
20 @param <OUTTYPE> the type of outgoing messages. Outgoing messages can be sent
21 directly with #send.
22 '''
23 @abstractmethod
24 def connect(self, reference:Reference) -> ConnectionEnd[INTYPE, OUTTYPE]:
25 '''
26 @param reference the {@link Reference} to a {@link Connectable}
27 @return connection to provided reference
28 @throws ConnectionError if the connection can not be made because
29 of a network or address related problem.
30 This points to something non-trivially
31 that may require user intervention to fix
32 something.
33 @throws NoResourcesNowException if the connection can not be made at this
34 moment because of lack of resources on
35 the server. This suggest to retry later.
36 '''
Note: See TracBrowser for help on using the repository browser.