Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/fact/storage/PhabricatorFactIntDatapoint.php
12256 views
1
<?php
2
3
final class PhabricatorFactIntDatapoint extends PhabricatorFactDAO {
4
5
protected $keyID;
6
protected $objectID;
7
protected $dimensionID;
8
protected $value;
9
protected $epoch;
10
11
private $key;
12
private $objectPHID;
13
private $dimensionPHID;
14
15
protected function getConfiguration() {
16
return array(
17
self::CONFIG_TIMESTAMPS => false,
18
self::CONFIG_COLUMN_SCHEMA => array(
19
'id' => 'auto64',
20
'dimensionID' => 'id?',
21
'value' => 'sint64',
22
),
23
self::CONFIG_KEY_SCHEMA => array(
24
'key_dimension' => array(
25
'columns' => array('keyID', 'dimensionID'),
26
),
27
'key_object' => array(
28
'columns' => array('objectID'),
29
),
30
),
31
) + parent::getConfiguration();
32
}
33
34
public function setKey($key) {
35
$this->key = $key;
36
return $this;
37
}
38
39
public function getKey() {
40
return $this->key;
41
}
42
43
public function setObjectPHID($object_phid) {
44
$this->objectPHID = $object_phid;
45
return $this;
46
}
47
48
public function getObjectPHID() {
49
return $this->objectPHID;
50
}
51
52
public function setDimensionPHID($dimension_phid) {
53
$this->dimensionPHID = $dimension_phid;
54
return $this;
55
}
56
57
public function getDimensionPHID() {
58
return $this->dimensionPHID;
59
}
60
61
public function newDatapointVector() {
62
return $this->formatVector(
63
array(
64
$this->key,
65
$this->objectPHID,
66
$this->dimensionPHID,
67
$this->value,
68
$this->epoch,
69
));
70
}
71
72
public function newRawVector(array $spec) {
73
return $this->formatVector(
74
array(
75
$spec['key'],
76
$spec['objectPHID'],
77
$spec['dimensionPHID'],
78
$spec['value'],
79
$spec['epoch'],
80
));
81
}
82
83
private function formatVector(array $vector) {
84
return implode(':', $vector);
85
}
86
87
}
88
89