MTXStorage: Add transactions
FossilOrigin-Name: 5d9f93730cae9ba8132f233ccab7d0aa1a47d26a6e56085558bd2b8a2b483ca5
This commit is contained in:
parent
884d033dfb
commit
328d6dd529
2 changed files with 18 additions and 0 deletions
|
@ -82,6 +82,11 @@
|
||||||
@")"];
|
@")"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)transactionWithBlock: (mtx_storage_transaction_block_t)block
|
||||||
|
{
|
||||||
|
[_conn transactionWithBlock: block];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setNextBatch: (OFString *)nextBatch
|
- (void)setNextBatch: (OFString *)nextBatch
|
||||||
forDeviceID: (OFString *)deviceID
|
forDeviceID: (OFString *)deviceID
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,10 +24,23 @@
|
||||||
|
|
||||||
OF_ASSUME_NONNULL_BEGIN
|
OF_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A block which will be treated as a single transaction for the storage.
|
||||||
|
*
|
||||||
|
* @return Whether the transaction should be committed (`true`) or rolled back
|
||||||
|
* (`false`).
|
||||||
|
*/
|
||||||
|
typedef bool (^mtx_storage_transaction_block_t)(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A protocol for a storage to be used by @ref MTXClient.
|
* @brief A protocol for a storage to be used by @ref MTXClient.
|
||||||
*/
|
*/
|
||||||
@protocol MTXStorage <OFObject>
|
@protocol MTXStorage <OFObject>
|
||||||
|
/**
|
||||||
|
* @brief Performs all operations inside the block as a transaction.
|
||||||
|
*/
|
||||||
|
- (void)transactionWithBlock: (mtx_storage_transaction_block_t)block;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Stores the next batch for the specified device.
|
* @brief Stores the next batch for the specified device.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue