Infinity.AdoptedRequest¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Time the request was executed, in microseconds |
||
r/w/co |
The operation of the request |
||
r/w/co |
Time the request was received, in microseconds |
||
r/w/co |
The type of the operation |
||
r/w/co |
The ID of the user that made the request |
||
r/w/co |
The vector time at which the request was made |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
||
priv |
r |
Class Details¶
- class Infinity.AdoptedRequest(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Infinity.AdoptedRequest
is an opaque data type. You should only access it via the public API functions.- classmethod new_do(vector, user_id, operation, received)¶
- Parameters:
vector (
Infinity.AdoptedStateVector
) – The vector time at which the request was made.user_id (
int
) – The ID of the user that made the request.operation (
Infinity.AdoptedOperation
) – The operation the user performed.received (
int
) – Time the request was received, in microseconds since the epoch.
- Returns:
A new DO request.
- Return type:
Creates a new
Infinity.AdoptedRequest
with typeInfinity.AdoptedRequestType.DO
.
- classmethod new_redo(vector, user_id, received)¶
- Parameters:
vector (
Infinity.AdoptedStateVector
) – The vector time at which the request was made.user_id (
int
) – The ID of the user that made the request.received (
int
) – Time the request was received, in microseconds since the epoch.
- Returns:
A new REDO request.
- Return type:
Creates a new
Infinity.AdoptedRequest
with typeInfinity.AdoptedRequestType.REDO
. The operation performed is implicitely defined by reverting the operation of the associated UNDO request, but must still be computed byInfinity.AdoptedAlgorithm
.
- classmethod new_undo(vector, user_id, received)¶
- Parameters:
vector (
Infinity.AdoptedStateVector
) – The vector time at which the request was made.user_id (
int
) – The ID of the user that made the request.received (
int
) – Time the request was received, in microseconds since the epoch.
- Returns:
A new UNDO request.
- Return type:
Creates a new
Infinity.AdoptedRequest
with typeInfinity.AdoptedRequestType.UNDO
. The operation performed is implicitely defined by reverting the operation of the associated DO or REDO request, but must still be computed byInfinity.AdoptedAlgorithm
.
- affects_buffer()¶
- Returns:
Whether self affects the session’s buffer.
- Return type:
Returns whether this request, when applied, changes the content of the buffer. If this is a
Infinity.AdoptedRequestType.UNDO
orInfinity.AdoptedRequestType.REDO
request, than it always affects the buffer, because only requests that affect the buffer can be undone or redone. If it is aInfinity.AdoptedRequestType.DO
request, than it returns whether its operation has theInfinity.AdoptedOperationFlags.AFFECTS_BUFFER
flag set.
- copy()¶
- Returns:
A new
Infinity.AdoptedRequest
.- Return type:
Creates a copy of self with an initial reference count of 1.
- fold(into, by)¶
- Parameters:
- Returns:
The folded request as a new
Infinity.AdoptedRequest
.- Return type:
Folds self as described in “Reducing the Problems of Group Undo” by Matthias Ressel and Rul Gunzenhäuser (http://portal.acm.org/citation.cfm?doid=320297.320312).
Note that by is the total amount of requests between the original and the fold request, and thus equivalent to 2j in the paper’s definition.
into must not be the same user as the one that issued self.
- get_execute_time()¶
- Returns:
The time when the function was executed, or 0.
- Return type:
Returns the time when the request was executed by an
Infinity.AdoptedAlgorithm
, seeInfinity.AdoptedAlgorithm.execute_request
(). The time is given in microseconds since January 1, 1970. If the request was not yet executed, the function returns 0.
- get_index()¶
- Returns:
The vector time component of the request’s own user.
- Return type:
Returns the vector time component of the request’s own users. This corresponds to the request index by that user.
- get_operation()¶
- Returns:
The request’s operation.
- Return type:
Returns the operation carried by the request. This can only be called if the request’s type is
Infinity.AdoptedRequestType.DO
.
- get_receive_time()¶
- Returns:
Time when the request was received.
- Return type:
Returns the time when the request was received, or, if it’s a local request, generated. The time is given in microseconds since January 1, 1970.
- get_request_type()¶
- Returns:
The type of self.
- Return type:
Returns the request type of self.
- get_user_id()¶
- Returns:
The request’s user ID.
- Return type:
Returns the user ID of the user that issued self.
- get_vector()¶
- Returns:
The state vector of self. The returned value should not be freed, it is owned by the
Infinity.AdoptedRequest
.- Return type:
Returns the vector time the request was made i.e. its operation can be applied to the buffer.
- mirror(by)¶
- Parameters:
by (
int
) – The number of requests between the original and the mirrored operation.- Returns:
The mirrored request as a new
Infinity.AdoptedRequest
.- Return type:
Mirrors self as described in “Reducing the Problems of Group Undo” by Matthias Ressel and Rul Gunzenhäuser (http://portal.acm.org/citation.cfm?doid=320297.320312).
Note that by is the total amount of requests between the original and mirrored request, and thus equivalent to 2j-1 in the paper’s definition.
self must be of type
Infinity.AdoptedRequestType.DO
and its operation must be reversible.
- need_concurrency_id(against)¶
- Parameters:
against (
Infinity.AdoptedRequest
) – The request to transform against.- Returns:
Whether transformation of self against against requires a concurrency ID.
- Return type:
Returns whether transforming self against against requires a concurrency ID. If this function returns
True
, you must provide the request_lcs and against_lcs parameters when callingInfinity.AdoptedRequest.transform
().Both request need to be of type
Infinity.AdoptedRequestType.DO
, and their state vectors must be the same.
- set_execute_time(time)¶
- Parameters:
time (
int
) – A time in microseconds since January 1, 1970.
Sets the time when self was executed. Usually this is called by
Infinity.AdoptedAlgorithm
when it executes a request, i.e. translates it to the current state of the document.
- transform(against, request_lcs, against_lcs)¶
- Parameters:
against (
Infinity.AdoptedRequest
) – The request to transform against.request_lcs (
Infinity.AdoptedRequest
) – The request to transform in a previous state, orNone
.against_lcs (
Infinity.AdoptedRequest
) – The request to transform against in a previous state, orNone
.
- Returns:
A new
Infinity.AdoptedRequest
, the result of the transformation.- Return type:
Transforms the operation of self against the operation of against. Both requests must be of type
Infinity.AdoptedRequestType.DO
, and their state vectors must be the same.If the function
Infinity.AdoptedRequest.need_concurrency_id
() returnsTrue
, request_lcs and against_lcs must not beNone
.
Property Details¶
- Infinity.AdoptedRequest.props.executed¶
-
Time the request was executed, in microseconds
- Infinity.AdoptedRequest.props.operation¶
- Name:
operation
- Type:
- Default Value:
- Flags:
The operation of the request
- Infinity.AdoptedRequest.props.received¶
- Name:
received
- Type:
- Default Value:
0
- Flags:
Time the request was received, in microseconds
- Infinity.AdoptedRequest.props.type¶
- Name:
type
- Type:
- Default Value:
- Flags:
The type of the operation
- Infinity.AdoptedRequest.props.user_id¶
- Name:
user-id
- Type:
- Default Value:
0
- Flags:
The ID of the user that made the request
- Infinity.AdoptedRequest.props.vector¶
- Name:
vector
- Type:
- Default Value:
- Flags:
The vector time at which the request was made