source: geniuswebcore/geniusweb/protocol/session/SessionState.py@ 78

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

Fix for IssueValue hashcode.

File size: 2.2 KB
Line 
1from abc import abstractmethod
2from typing import List, Optional
3
4
5from geniusweb.actions.Action import Action
6from geniusweb.inform.Agreements import Agreements
7from geniusweb.progress.Progress import Progress
8from geniusweb.protocol.NegoState import NegoState
9from geniusweb.protocol.session.SessionResult import SessionResult
10from geniusweb.protocol.session.SessionSettings import SessionSettings
11
12
13class SessionState(NegoState):
14 '''
15 The current state of the session. E.g. typically contains the actions so far
16 and the parties currently connected. <br>
17 The state checks if transitions (Actions from the party) are following the
18 protocol, and thus implement most of the protocol . <br>
19
20 If protocol errors occur, these should be stored in the state and the state
21 should become {@link #isFinal(long)}. Throwing should happen only in case of
22 a bug.<br>
23
24 Implementations should be immutable (to ensure thread safety, testability
25 etc).
26
27 States must be serializable so that listeners can follow what is going on in
28 the protocol. As uaual, mark non-serializable fields as transient.
29 '''
30 @abstractmethod
31 def getSettings(self)->SessionSettings:
32 '''
33 @return the SessionSettings
34 '''
35
36 @abstractmethod
37 def getActions(self)->List[Action]:
38 '''
39 @return unmodifyable list of actions done so far, in the order in which
40 they arrived. List of list allows implementations to add some
41 extra structure to the actions, eg one list per phase
42 '''
43
44 @abstractmethod
45 def getProgress(self) -> Optional[Progress]:
46 '''
47 @return the progress of the session. Can return null if the session did
48 not even start yet. Notice that the protocol determines when a
49 session officially starts (eg, in SAOP it starts after all
50 parties were connected succesfully).
51 '''
52
53 @abstractmethod
54 def getAgreements(self)->Agreements :
55 '''
56 @return the current standing agreements
57 An agreement does not necessarily mean {@link #isFinal(long)}.
58 '''
59
60 @abstractmethod
61 def getResult(self)->Optional[SessionResult]:
62 '''
63 @return the {@link SessionResult} which is a short report of the final
64 outcome. Assumes {@link #isFinal(long)}. result may be undefined
65 if not.
66 '''
Note: See TracBrowser for help on using the repository browser.