Infinity.AdoptedSession¶
- Subclasses:
None
Methods¶
- Inherited:
Infinity.Session (19), GObject.Object (37), Infinity.CommunicationObject (3)
- Structs:
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The adOPTed algorithm used for translating incoming requests |
||
r/w/co |
The IO object used for timeouts |
||
r/w/co |
The maximum number of requests to keep in all user’s logs |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted whenever the session received a request from a non-local user. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Infinity.AdoptedSession(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Infinity.AdoptedSession
is an opaque data type. You should only access it via the public API functions.- broadcast_request(request)¶
- Parameters:
request (
Infinity.AdoptedRequest
) – AInfinity.AdoptedRequest
obtained 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'sInfinity.AdoptedAlgorithm
.
- get_algorithm()¶
- Returns:
A
Infinity.AdoptedAlgorithm
, orNone
.- Return type:
Returns the
Infinity.AdoptedAlgorithm
object of self. ReturnsNone
if self has statusInfinity.SessionStatus.PRESYNC
orInfinity.SessionStatus.SYNCHRONIZING
because there the algorithm object is not yet created before successful synchronization.
- get_io()¶
- Returns:
A
Infinity.Io
.- Return type:
Returns the
Infinity.Io
object 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:
True
if the data could be read successfully,False
if the XML request does not contain valid request data, in which case error is set.- 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.
- 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.
- 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.
- write_request_info(request, diff_vec, xml, operation)¶
- Parameters:
request (
Infinity.AdoptedRequest
) – TheInfinity.AdoptedRequest
whose 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 (viaInfinity.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.
- do_check_request(request, user) virtual¶
- Parameters:
request (
Infinity.AdoptedRequest
) –user (
Infinity.AdoptedUser
) –
- Return type:
- 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
) –
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 signalrequest (
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
True
the request is rejected, i.e. only if all signal handlers returnFalse
it is accepted.
Property Details¶
- Infinity.AdoptedSession.props.algorithm¶
- Name:
algorithm
- Type:
- Default Value:
- Flags:
The adOPTed algorithm used for translating incoming requests
- Infinity.AdoptedSession.props.io¶
- Name:
io
- Type:
- Default Value:
- Flags:
The IO object used for timeouts
- Infinity.AdoptedSession.props.max_total_log_size¶
- Name:
max-total-log-size
- Type:
- Default Value:
2048
- Flags:
The maximum number of requests to keep in all user’s logs