Infinity.AdoptedSession¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | Infinity.Session (19), GObject.Object (37), Infinity.CommunicationObject (3) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| broadcast_request(request) | |
| get_algorithm() | |
| get_io() | |
| read_request_info(xml, diff_vec) | |
| redo(user, n) | |
| undo(user, n) | |
| write_request_info(request, diff_vec, xml, operation) | 
Virtual Methods¶
| Inherited: | Infinity.Session (11), GObject.Object (7), Infinity.CommunicationObject (3) | 
|---|
| do_check_request(request, user) | |
| do_request_to_xml(xml, request, diff_vec, for_sync) | 
Properties¶
| Inherited: | Infinity.Session (7) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| algorithm | Infinity.AdoptedAlgorithm | r | The adOPTed algorithm used for translating incoming requests | 
| io | Infinity.Io | r/w/co | The IO object used for timeouts | 
| max-total-log-size | int | r/w/co | The maximum number of requests to keep in all user’s logs | 
Signals¶
| Inherited: | Infinity.Session (6), GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| check-request | This signal is emitted whenever the session received a request from a non-local user. | 
Fields¶
| Inherited: | Infinity.Session (6), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent | Infinity.Session | r | 
Class Details¶
- 
class Infinity.AdoptedSession(**kwargs)¶
- Bases: - Infinity.Session- Abstract: - No - Structure: - Infinity.AdoptedSessionClass- Infinity.AdoptedSessionis an opaque data type. You should only access it via the public API functions.- 
broadcast_request(request)¶
- Parameters: - request ( - Infinity.AdoptedRequest) – A- Infinity.AdoptedRequestobtained from self’s algorithm.- Sends a request to all subscribed connections. The request should originate from a call to - Infinity.AdoptedAlgorithm.generate_request(), with self’s- Infinity.AdoptedAlgorithm.
 - 
get_algorithm()¶
- Returns: - A - Infinity.AdoptedAlgorithm, or- None.- Return type: - Infinity.AdoptedAlgorithm- Returns the - Infinity.AdoptedAlgorithmobject of self. Returns- Noneif self has status- Infinity.SessionStatus.PRESYNCor- Infinity.SessionStatus.SYNCHRONIZINGbecause there the algorithm object is not yet created before successful synchronization.
 - 
get_io()¶
- Returns: - A - Infinity.Io.- Return type: - Infinity.Io- Returns the - Infinity.Ioobject of self.
 - 
read_request_info(xml, diff_vec)¶
- Parameters: - xml (libxml2.NodePtr) – The XML to read the data from.
- diff_vec (Infinity.AdoptedStateVector) – The reference vector of the time vector of the request, orNone.
 - Raises: - Returns: - Trueif the data could be read successfully,- Falseif the XML request does not contain valid request data, in which case error is set.- user: - Location to store the user of the request, or - None.- time: - Location to store the state the request was made, or - None.- operation: - Location to store the operation of the request, or - None.- Return type: - ( - bool, user:- Infinity.AdoptedUser, time:- Infinity.AdoptedStateVector, operation:- libxml2.NodePtr)- This function reads common information such as the state vector the request was made and the user that made the request from XML. It is most likely to be used by implementations of the xml_to_request virtual function. 
- xml (
 - 
redo(user, n)¶
- Parameters: - user (Infinity.AdoptedUser) – A localInfinity.AdoptedUser.
- n (int) – The number of redo requests to issue.
 - This is a shortcut for creating n redo requests and broadcasting them. If n > 1 then this is also more efficient. 
- user (
 - 
undo(user, n)¶
- Parameters: - user (Infinity.AdoptedUser) – A localInfinity.AdoptedUser.
- n (int) – The number of undo requests to issue.
 - This is a shortcut for creating n undo requests and broadcasting them. If n > 1 then this is also more efficient. 
- user (
 - 
write_request_info(request, diff_vec, xml, operation)¶
- Parameters: - request (Infinity.AdoptedRequest) – TheInfinity.AdoptedRequestwhose info to write.
- diff_vec (Infinity.AdoptedStateVector) – A reference state vector, orNone.
- xml (libxml2.NodePtr) – The XML node to write the data into.
- operation (libxml2.NodePtr) – An XML node representing the operation of the request, orNone.
 - This function writes common data from request, such as the user that issued the request and the state in which the request was made into xml. If diff_vec is given, then the state is written as a diff to this vector, see - Infinity.AdoptedStateVector.to_string_diff(). Deserializing this data again (via- Infinity.AdoptedSession.read_request_info()) requires the same diff_vec then.- This function is most likely to be used by implementations of the request_to_xml virtual function. 
- request (
 - 
do_check_request(request, user) virtual¶
- Parameters: - request (Infinity.AdoptedRequest) –
- user (Infinity.AdoptedUser) –
 - Return type: 
- request (
 - 
do_request_to_xml(xml, request, diff_vec, for_sync) virtual¶
- Parameters: - xml (libxml2.NodePtr) –
- request (Infinity.AdoptedRequest) –
- diff_vec (Infinity.AdoptedStateVector) –
- for_sync (bool) –
 
- xml (
 
- 
Signal Details¶
- 
Infinity.AdoptedSession.signals.check_request(adopted_session, request, user)¶
- Signal Name: - check-request- Flags: - Parameters: - adopted_session (Infinity.AdoptedSession) – The object which received the signal
- request (Infinity.AdoptedRequest) – The request to be processed.
- user (Infinity.AdoptedUser) – The user who issued the request.
 - Return type: - This signal is emitted whenever the session received a request from a non-local user. It is used to decide whether the request should be processed or not. Note that generally not processing a request results is loss of synchronization, since other hosts might process the request. Only if the same condition can be applied on all sites a request should be rejected. Another possibility is to reject a request at a central host before it gets distributed to all other clients. If there is one signal handler returning - Truethe request is rejected, i.e. only if all signal handlers return- Falseit is accepted.
- adopted_session (
Property Details¶
- 
Infinity.AdoptedSession.props.algorithm¶
- Name: - algorithm- Type: - Infinity.AdoptedAlgorithm- Default Value: - None- Flags: - READABLE- The adOPTed algorithm used for translating incoming requests 
- 
Infinity.AdoptedSession.props.io¶
- Name: - io- Type: - Infinity.Io- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The IO object used for timeouts 
- 
Infinity.AdoptedSession.props.max_total_log_size¶
- Name: - max-total-log-size- Type: - int- Default Value: - 2048- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The maximum number of requests to keep in all user’s logs