OpFlex Framework 1.7.0

A mutator represents a set of changes to apply to the data store. More...

Typedefs

typedef ofobj_p ofmutator_p
 A pointer to a mutator object.
 

Functions

ofstatus ofmutator_create (offramework_p framework, const char *owner, ofmutator_p *mutator)
 Create a new mutator that will work with the provided framework instance.
 
ofstatus ofmutator_destroy (ofmutator_p *mutator)
 Destroy a mutator, and zero the pointer.
 
ofstatus ofmutator_commit (ofmutator_p mutator)
 Commit the changes stored in the mutator.
 

Detailed Description

A mutator represents a set of changes to apply to the data store.

When modifying data through the managed object accessor classes, changes are not actually written into the store, but rather are written into the Mutator registered using the framework in a thread-local variable. These changes will not become visible until the mutator is committed by calling ofmutator_commit()

The changes are applied to the data store all at once but not necessarily guaranteed to be atomic. That is, a read in another thread could see some objects updated but not others. Each individual object update is applied atomically, however, so the fields within that object will either all be modified or none.

This is most similar to a database transaction with an isolation level set to read uncommitted.

Function Documentation

◆ ofmutator_commit()

ofstatus ofmutator_commit ( ofmutator_p mutator)

Commit the changes stored in the mutator.

If this function is not called, these changes will simply be lost.

Parameters
mutatorthe mutator
Returns
a status code

◆ ofmutator_create()

ofstatus ofmutator_create ( offramework_p framework,
const char * owner,
ofmutator_p * mutator )

Create a new mutator that will work with the provided framework instance.

Parameters
frameworkthe framework instance
ownerthe owner string that will control which fields can be modified.
mutatora pointer to memory that will receive the pointer to the newly-allocated object.
Returns
a status code

◆ ofmutator_destroy()

ofstatus ofmutator_destroy ( ofmutator_p * mutator)

Destroy a mutator, and zero the pointer.

Any uncommitted changes will be lost.

Parameters
mutatora pointer to memory containing the OF framework pointer.
Returns
a status code