DeeTransaction

DeeTransaction — A self contained change set for a DeeModel

Functions

Properties

DeeModel * target Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── DeeSerializableModel
        ╰── DeeTransaction

Implemented Interfaces

DeeTransaction implements

Includes

#include <dee.h>

Description

DeeTransaction is a self contained change set related to some particular DeeModel called the target model.

The transaction instance itself implements the DeeModel interface in a way that overlays the target model. In database terms the target model has isolation level READ_COMMITTED. Meaning that the target model is not modified until you call dee_transaction_commit().

To flush the changes to the target model call dee_transaction_commit(). After committing the transaction will become invalid and must be freed with g_object_unref(). It is a programming error to try and access a transaction that has been committed with the sole exception of calling dee_transaction_is_committed().

Functions

dee_transaction_new ()

DeeModel *
dee_transaction_new (DeeModel *target);

Parameters

target

The DeeModel the transaction applies against

 

Returns

A newly allocated DeeTransaction. Free with g_object_unref() when done using it - no matter if you call dee_transaction_commit() or not.

[transfer full][type Dee.Transaction]


dee_transaction_get_target ()

DeeModel *
dee_transaction_get_target (DeeTransaction *self);

Get the target model of a transaction. This is just a convenience method for accessing the :target property.

Parameters

self

The transaction to retrieve the target model for

 

Returns

The target model.

[transfer none]


dee_transaction_is_committed ()

gboolean
dee_transaction_is_committed (DeeTransaction *self);

Check if a DeeTransaction has been committed. This method is mainly for debugging and testing purposes.

Parameters

self

The transaction to inspect

 

Returns

TRUE if and only if dee_transaction_commit() has completed successfully on the transaction.


dee_transaction_commit ()

gboolean
dee_transaction_commit (DeeTransaction *self,
                        GError **error);

Apply a transaction to its target model. After this call the transaction is invalidated and must be freed with g_object_unref().

Parameters

self

The transaction to commit

 

error

Location to return a GError in or NULL to disregard errors.

[allow-none]

Returns

TRUE if and only if the transaction successfully applies to :target.


dee_transaction_error_quark ()

GQuark
dee_transaction_error_quark (void);

Types and Values

struct DeeTransaction

struct DeeTransaction;

All fields in the DeeTransaction structure are private and should never be accessed directly


DEE_TRANSACTION_ERROR

#define DEE_TRANSACTION_ERROR dee_transaction_error_quark()

Error domain for the DeeTransaction. Error codes will be from the DeeTransactionError enumeration


enum DeeTransactionError

Error codes for the DeeTransaction class. These codes will be set when the error domain is DEE_TRANSACTION_ERROR.

DEE_TRANSACTION_ERROR_CONCURRENT_MODIFICATION : The target model has been modified while the transaction was open.

DEE_TRANSACTION_ERROR_COMMITTED : Raised when someone tries to commit a transaction that has already been committed

Members

DEE_TRANSACTION_ERROR_CONCURRENT_MODIFICATION

   

DEE_TRANSACTION_ERROR_COMMITTED

   

Property Details

The “target” property

  “target”                   DeeModel *

Target model.

Flags: Read / Write / Construct Only