@@ -8,8 +8,6 @@ |
||
8 | 8 | use Exception; |
9 | 9 | use Tarantool\Mapper\Entity; |
10 | 10 | use Tarantool\Mapper\Plugin\Procedure; |
11 | -use Tarantool\Mapper\Procedure\FindOrCreate; |
|
12 | -use Tarantool\Mapper\Repository; |
|
13 | 11 | |
14 | 12 | class Executor |
15 | 13 | { |
@@ -14,14 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - box.begin() |
|
18 | - for i, t in box.space.job_queue.index.status_id:pairs('transfered') do |
|
19 | - local result = box.space.job_result.index.service_hash:count({t.recipient, t.hash}) |
|
20 | - if result > 0 then |
|
21 | - box.space.job_queue:delete(t.id) |
|
22 | - end |
|
23 | - end |
|
24 | - box.commit() |
|
25 | - LUA; |
|
26 | - } |
|
27 | -} |
@@ -14,14 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - box.begin() |
|
18 | - for i, t in box.space.job_queue.index.status_id:pairs('transfered') do |
|
19 | - local result = box.space.job_result.index.service_hash:count({t.recipient, t.hash}) |
|
20 | - if result > 0 then |
|
21 | - box.space.job_queue:delete(t.id) |
|
22 | - end |
|
23 | - end |
|
24 | - box.commit() |
|
25 | - LUA; |
|
26 | - } |
|
27 | -} |
@@ -14,14 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - box.begin() |
|
18 | - local tuples = box.space.job_queue.index.status_id:select({'new'}, { limit = 1}) |
|
19 | - if #tuples > 0 then |
|
20 | - local request = box.space.job_queue:update(tuples[1].id, {{'=', 2, 'processing'}}) |
|
21 | - box.commit() |
|
22 | - return request |
|
23 | - end |
|
24 | - box.rollback() |
|
25 | - LUA; |
|
26 | - } |
|
27 | -} |
@@ -14,14 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - box.begin() |
|
18 | - local tuples = box.space.job_queue.index.status_id:select({'new'}, { limit = 1}) |
|
19 | - if #tuples > 0 then |
|
20 | - local request = box.space.job_queue:update(tuples[1].id, {{'=', 2, 'processing'}}) |
|
21 | - box.commit() |
|
22 | - return request |
|
23 | - end |
|
24 | - box.rollback() |
|
25 | - LUA; |
|
26 | - } |
|
27 | -} |
@@ -14,9 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - return box.space.job_result:pairs() |
|
18 | - :filter(function(r) return r.service ~= service end) |
|
19 | - :totable() |
|
20 | - LUA; |
|
21 | - } |
|
22 | -} |
@@ -14,9 +14,3 @@ |
||
14 | 14 | public function getBody(): string |
15 | 15 | { |
16 | 16 | return <<<LUA |
17 | - return box.space.job_result:pairs() |
|
18 | - :filter(function(r) return r.service ~= service end) |
|
19 | - :totable() |
|
20 | - LUA; |
|
21 | - } |
|
22 | -} |
@@ -79,6 +79,9 @@ discard block |
||
79 | 79 | return $this->get(Mapper::class)->getRepository($space); |
80 | 80 | } |
81 | 81 | |
82 | + /** |
|
83 | + * @param string $tube |
|
84 | + */ |
|
82 | 85 | public function getQueue($tube) |
83 | 86 | { |
84 | 87 | $alias = "queue.$tube"; |
@@ -105,6 +108,9 @@ discard block |
||
105 | 108 | return $this->getRepository($space)->remove($params); |
106 | 109 | } |
107 | 110 | |
111 | + /** |
|
112 | + * @param string $fields |
|
113 | + */ |
|
108 | 114 | protected function select($fields, string $table, array $params) |
109 | 115 | { |
110 | 116 | return $this->get(Clickhouse::class)->select($fields, $table, $params); |
@@ -115,6 +121,9 @@ discard block |
||
115 | 121 | return $this->get(Clickhouse::class)->insert($table, $data, $headers); |
116 | 122 | } |
117 | 123 | |
124 | + /** |
|
125 | + * @param string $contents |
|
126 | + */ |
|
118 | 127 | protected function upload(string $filename, $contents) : string |
119 | 128 | { |
120 | 129 | return $this->get(Storage::class)->upload($filename, $contents); |