GitHub    Download    Forum
Overview
How to start
Download
Concepts
Detailed concepts
15 | Transactions
16 | Object Checklist
17 | Linking Objects
25 | ACID Transaction Concept
Tutorial
C++ API
C# API
WinRT API
DTDL
DADL
Setup

DataFS - Transactions

In this Article we dive deeper into Transactions and how they exactly work in DataFS.

Functions

DataFS uses 4 functions: open, create, load or store inside it's transactions. These functions are queued in a special list waiting to be executed (1 & 2 - see in image below). In WDomain this list is called Transaction and in UStorage it's called ActionGroup.
IMPORTANT: "Open" or "create" on an object should always be enqueued before "load" and "store" on that same object for expected behaviour, which is why they are depicted in their respective arrows.
    WSomeObject::Open(&pSomeObject, &pSomeObjectLink->oiObjectId, pDomain);
    WSomeObject::Create(&pSomeObject, pDomain);
    SomeObject->Load();
    SomeObject->Store();
As soon as we execute the transaction (3) the system starts the request (a) to the server which in turn responds (b) with an answer.
When we open or load, our object will then be updated by the List (c).
    domain->Execute(Transaction::Load)
    domain->Execute(Transaction::Store)
open/load
store

Advanced Use of DataFS Transactions

Let's look at DataFS Transactions (3) and the appertaining functions a little closer, because before we deliberately abstracted them so the basic concept is clear.

Transaction / ActionGroup - write and read

Each Transaction/ActionGroup List actually can do both write and read, whereas we have to keep in mind that all write statements are always executed before the read statements. In DataFS we have two standard Transactions/ActionGroups: One has the handle "Load" and the second one has the handle "Store", but both could still execute write and/or store operations.
Why are'nt they just called "1" and "2" instead of "Load" and "Store" since they can do both? - For this we look at the functions to enqueue objects into transactions. In C++ (in all other languages we have to specify them manually) we have default parameters programmed like this:
someObject->Load();
is actually
someObject->Load(Transaction::Load);
someObject->Store();
is actually
someObject->Store(Transaction::Store);
WSomeObject::Open(&pSomeObject, &oi, pDomain);
uses the handle
Transaction::Load
These parameters mean that we by default enqueue the object we want to open or load into the Transaction/ActionGroup "1" with the handle "Transaction::Load" and the object to store into Transaction/ActionGroup "2" with the handle "Transaction::Store".
In practice this makes sence since we more often than not use the standard transactions like this:
If we want to do it differently we can of course create our own Transaction/ActionGroup with its own handle, but for our convenience these two Standart-Transactions are already there and could also be used like any other transaction. If that is the case we just have to be more careful to not make a mess in our transaction.

The Create Function and Enqueuing

The "create" function is a little special in regards of enqueuing. Create doesn't use a handle at all, but it still has to be enqueued into the transaction list. Luckily we don't have to do that in an manual extra-step, create get's enqueued automatically in the same transaction right before where you use the store function on that object.
WSomeObject::Create(&Object47, pDomain);
Object47->Store(List302);
If we would take a look into the transaction with the handle "List302" we would find "Object47->create" neatly enqueued in right before "Object47->store" in the write segment of the transaction.

Now we hope transactions are clear and you can use them to your heart's content.
© 2025 Mobiland AG