1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* src/Jobs/WritePoints.php. |
4
|
|
|
* |
5
|
|
|
* @author Austin Heap <[email protected]> |
6
|
|
|
* @version v0.1.7 |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace AustinHeap\Database\InfluxDb\Jobs; |
11
|
|
|
|
12
|
|
|
use AustinHeap\Database\InfluxDb\InfluxDbServiceProvider; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class WritePoints. |
16
|
|
|
*/ |
17
|
|
|
class WritePoints extends Job |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var string PRECISION_NANOSECONDS |
21
|
|
|
*/ |
22
|
|
|
const PRECISION_NANOSECONDS = 'n'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string PRECISION_MICROSECONDS |
26
|
|
|
*/ |
27
|
|
|
const PRECISION_MICROSECONDS = 'u'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string PRECISION_MILLISECONDS |
31
|
|
|
*/ |
32
|
|
|
const PRECISION_MILLISECONDS = 'ms'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string PRECISION_SECONDS |
36
|
|
|
*/ |
37
|
|
|
const PRECISION_SECONDS = 's'; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string PRECISION_MINUTES |
41
|
|
|
*/ |
42
|
|
|
const PRECISION_MINUTES = 'm'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string PRECISION_HOURS |
46
|
|
|
*/ |
47
|
|
|
const PRECISION_HOURS = 'h'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var array |
51
|
|
|
*/ |
52
|
|
|
public $points = null; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
public $precision = null; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string|null |
61
|
|
|
*/ |
62
|
|
|
public $retentionPolicy = null; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* WritePoints constructor. |
66
|
|
|
* |
67
|
|
|
* @param \InfluxDB\Point[] $points |
68
|
|
|
* @param string $precision |
69
|
|
|
* @param string|null $retentionPolicy |
70
|
|
|
*/ |
71
|
|
|
public function __construct(array $points, $precision = self::PRECISION_SECONDS, $retentionPolicy = null) |
72
|
|
|
{ |
73
|
|
|
$this->points = $points; |
74
|
|
|
$this->precision = $precision; |
75
|
|
|
$this->retentionPolicy = $retentionPolicy; |
76
|
|
|
|
77
|
|
|
parent::__construct( |
78
|
|
|
[ |
79
|
|
|
'points' => $this->points, |
80
|
|
|
'precision' => $this->precision, |
81
|
|
|
'retentionPolicy' => $this->retentionPolicy, |
82
|
|
|
] |
83
|
|
|
); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return void |
88
|
|
|
*/ |
89
|
|
|
public function handle() |
90
|
|
|
{ |
91
|
|
|
InfluxDbServiceProvider::getInstance() |
92
|
|
|
->writePoints( |
|
|
|
|
93
|
|
|
$this->points, |
94
|
|
|
$this->precision, |
95
|
|
|
$this->retentionPolicy |
96
|
|
|
); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return array |
101
|
|
|
*/ |
102
|
|
|
public function tags(): array |
103
|
|
|
{ |
104
|
|
|
return [static::class.':'.count($this->points)]; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.