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. More... | |
ofstatus | ofmutator_destroy (ofmutator_p *mutator) |
Destroy a mutator, and zero the pointer. More... | |
ofstatus | ofmutator_commit (ofmutator_p mutator) |
Commit the changes stored in the mutator. More... | |
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.
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.
mutator | the mutator |
ofstatus ofmutator_create | ( | offramework_p | framework, |
const char * | owner, | ||
ofmutator_p * | mutator | ||
) |
Create a new mutator that will work with the provided framework instance.
framework | the framework instance |
owner | the owner string that will control which fields can be modified. |
mutator | a pointer to memory that will receive the pointer to the newly-allocated object. |
ofstatus ofmutator_destroy | ( | ofmutator_p * | mutator | ) |
Destroy a mutator, and zero the pointer.
Any uncommitted changes will be lost.
mutator | a pointer to memory containing the OF framework pointer. |