-
Notifications
You must be signed in to change notification settings - Fork 0
/
AssertVersionTask.php
61 lines (54 loc) · 1.44 KB
/
AssertVersionTask.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Aternos\Rados\Operation\Common\Task;
use Aternos\Rados\Operation\Common\CommonOperationTask;
use Aternos\Rados\Operation\Operation;
/**
* Ensure that the object exists and that its internal version
* number is equal to "ver". "ver" should be a
* version number previously obtained with rados_get_last_version().
* - If the object's version is greater than the asserted version
* then rados_read_op_operate will return -ERANGE instead of
* executing the op.
* - If the object's version is less than the asserted version
* then rados_read_op_operate will return -EOVERFLOW instead
* of executing the op.
*
* @extends CommonOperationTask<null>
*/
class AssertVersionTask extends CommonOperationTask
{
/**
* @param int $version
*/
public function __construct(protected int $version)
{
}
/**
* @inheritDoc
*/
protected function parseResult(): null
{
return null;
}
/**
* @inheritDoc
*/
protected function initTask(Operation $operation): void
{
$operation->getFFI()->{$this->getFunctionName($operation)}($operation->getCData(), $this->version);
}
/**
* @inheritDoc
*/
protected function getReadFunctionName(): string
{
return "rados_read_op_assert_version";
}
/**
* @inheritDoc
*/
protected function getWriteFunctionName(): string
{
return "rados_write_op_assert_version";
}
}