1 | <?php |
||
26 | final class Space |
||
27 | { |
||
28 | public const VSPACE_ID = 281; |
||
29 | public const VINDEX_ID = 289; |
||
30 | |||
31 | private $handler; |
||
32 | private $id; |
||
33 | private $indexes = []; |
||
34 | |||
35 | 2 | public function __construct(Handler $handler, int $id) |
|
40 | |||
41 | public function getId() : int |
||
45 | |||
46 | 2 | public function select(array $key = [], $index = 0, int $limit = \PHP_INT_MAX &0xffffffff, int $offset = 0, int $iteratorType = IteratorTypes::EQ) : array |
|
56 | |||
57 | public function insert(array $values) : array |
||
58 | { |
||
59 | $request = new Insert($this->id, $values); |
||
60 | |||
61 | return $this->handler->handle($request)->getBodyField(IProto::DATA); |
||
62 | } |
||
63 | |||
64 | public function replace(array $values) : array |
||
70 | |||
71 | public function update(array $key, array $operations, $index = 0) : array |
||
72 | { |
||
73 | if (\is_string($index)) { |
||
74 | $index = $this->getIndexIdByName($index); |
||
75 | } |
||
76 | |||
77 | $request = new Update($this->id, $index, $key, $operations); |
||
78 | |||
79 | return $this->handler->handle($request)->getBodyField(IProto::DATA); |
||
80 | } |
||
81 | |||
82 | public function upsert(array $values, array $operations) : array |
||
88 | |||
89 | public function delete(array $key, $index = 0) : array |
||
90 | { |
||
91 | if (\is_string($index)) { |
||
92 | $index = $this->getIndexIdByName($index); |
||
93 | } |
||
94 | |||
95 | $request = new Delete($this->id, $index, $key); |
||
96 | |||
97 | return $this->handler->handle($request)->getBodyField(IProto::DATA); |
||
98 | } |
||
99 | |||
100 | public function flushIndexes() : void |
||
104 | |||
105 | private function getIndexIdByName(string $indexName) : int |
||
106 | { |
||
107 | if (isset($this->indexes[$indexName])) { |
||
120 | } |
||
121 |