InfAdoptedSessionReplay: libinfinity-0.7 Reference Manual

## InfAdoptedSessionReplay InfAdoptedSessionReplay — Replay a record of a session |

## Stability Level

Unstable, unless otherwise indicated

## Functions

InfAdoptedSessionReplay * | inf_adopted_session_replay_new ()
gboolean | inf_adopted_session_replay_set_record ()
InfAdoptedSession * | inf_adopted_session_replay_get_session ()
gboolean | inf_adopted_session_replay_play_next ()
gboolean | inf_adopted_session_replay_play_to_end ()

## Properties

gchar * | filename | Read
InfAdoptedSession * | session | Read

## Types and Values

enum | InfAdoptedSessionReplayError
struct | InfAdoptedSessionReplay
struct | InfAdoptedSessionReplayClass

## Object Hierarchy

        GObject
        ╰── InfAdoptedSessionReplay

## Includes

    #include <libinfinity/adopted/inf-adopted-session-replay.h>

## Description

InfAdoptedSessionReplay can be used to replay a record created with InfAdoptedSessionRecord.

Use `inf_adopted_session_replay_set_record()` to specify the recording to replay, and then use `inf_adopted_session_replay_get_session()` to obtain the replayed session.

## Functions

### inf_adopted_session_replay_new ()

    InfAdoptedSessionReplay *
    inf_adopted_session_replay_new (void);

Creates a new InfAdoptedSessionReplay. Use `inf_adopted_session_replay_set_record()` to start the recording, and `inf_adopted_session_replay_play_next()` or `inf_adopted_session_replay_play_to_end()` to play it.

[constructor]

#### Returns

A new InfAdoptedSessionReplay. Free with `g_object_unref()` when no longer in use.

[transfer full]

### inf_adopted_session_replay_set_record ()

    gboolean
    inf_adopted_session_replay_set_record (InfAdoptedSessionReplay *replay,
                                           const gchar *filename,
                                           const InfcNotePlugin *plugin,
                                           GError **error);

Set the record file for `replay` to play. It should have been created with InfAdoptedSessionRecord. `plugin` should match the type of the recorded session. If an error occurs, the function returns `FALSE` and `error` is set.

#### Parameters

replay | A InfAdoptedSessionReplay. |
filename | Path to the record file to play. | [type filename]
plugin | A InfcNotePlugin for the note type of the recorded session. |
error | Location to store error information, if any. |

#### Returns

`TRUE` on success, or `FALSE` if the record file could not be set.

### inf_adopted_session_replay_get_session ()

    InfAdoptedSession *
    inf_adopted_session_replay_get_session
                                   (InfAdoptedSessionReplay *replay);

Returns the played back session, or `NULL` if `inf_adopted_session_replay_set_record()` was not yet called.

#### Parameters

replay | A InfAdoptedSessionReplay. |

#### Returns

A InfAdoptedSessionReplay, or `NULL`.

[transfer none]

### inf_adopted_session_replay_play_next ()

    gboolean
    inf_adopted_session_replay_play_next (InfAdoptedSessionReplay *replay,
                                          GError **error);

Reads the next request from the record and passes it to the session. Note that this might do nothing if that request is not yet causally ready, meaning that it depends on another request that has not yet been played. In that case it will be executed as soon as it is ready, that is after some future `inf_adopted_session_replay_play_next()` call. Therefore, it is also possible that this function executes more than one request.

If an error occurs, then this function returns `FALSE` and `error` is set. If the end of the recording is reached, then it also returns `FALSE`, but `error` is left untouched. If the next request has been read, then it returns `TRUE`.

#### Parameters

replay | A InfAdoptedSessionReplay. |
error | Location to store error information, if any. |

#### Returns

`TRUE` if a request was read, otherwise `FALSE`.

### inf_adopted_session_replay_play_to_end ()

    gboolean
    inf_adopted_session_replay_play_to_end
                                   (InfAdoptedSessionReplay *replay,
                                    GError **error);

Plays all requests that are contained in the recording, so that the replay's session has the same state as the recorded session when the recording was stopped.

Note that, depending on the size of the record, this function may take some time to finish.

If an error occurs during replay, then the function returns `FALSE` and `error` is set. Otherwise it returns `TRUE`.

#### Parameters

replay | A InfAdoptedSessionReplay. |
error | Location to store error information, if any. |

#### Returns

`TRUE` on success, or `FALSE` if an error occurs.

## Types and Values

### enum InfAdoptedSessionReplayError

Error codes for the `INF_ADOPTED_SESSION_REPLAY_ERROR` error domain. These can occur while loading or replaying a session with InfAdoptedSessionReplay.

#### Members

INF_ADOPTED_SESSION_REPLAY_ERROR_BAD_FILE | The record file could not be opened for reading. |
INF_ADOPTED_SESSION_REPLAY_ERROR_BAD_XML | The record file contains invalid XML. |
INF_ADOPTED_SESSION_REPLAY_ERROR_BAD_DOCUMENT | The record file is not a session recording. |
INF_ADOPTED_SESSION_REPLAY_ERROR_BAD_SESSION_TYPE | The record file is a session recording for a different type of session than the one provided. |
INF_ADOPTED_SESSION_REPLAY_ERROR_BAD_FORMAT | The record file is invalid. |
INF_ADOPTED_SESSION_REPLAY_ERROR_UNEXPECTED_EOF | More data was expected to be read from the record file, but the end of file was reached. |

### struct InfAdoptedSessionReplay

    struct InfAdoptedSessionReplay;

InfAdoptedSessionReplay is an opaque data type. You should only access it via the public API functions.

### struct InfAdoptedSessionReplayClass

    struct InfAdoptedSessionReplayClass {
    };

This structure does not contain any public fields.

## Property Details

### The `“filename”` property

      “filename”                 gchar *

The filename of the record to play.

Flags: Read

Default value: NULL

### The `“session”` property

      “session”                  InfAdoptedSession *

The replayed session.

Flags: Read

## See Also

InfAdoptedSession, InfAdoptedSessionRecord