1 | <?php |
||
27 | class Openstack implements Simulator |
||
28 | { |
||
29 | /** |
||
30 | * OpenStack identify url |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $authUrl; |
||
35 | |||
36 | /** |
||
37 | * OpenStack region |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $region; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $username; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $password; |
||
52 | |||
53 | /** |
||
54 | * Object Store container name |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $containerName; |
||
59 | |||
60 | /** |
||
61 | * OpenStack service name |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $serviceName; |
||
66 | |||
67 | /** |
||
68 | * Max stream upload size, files over this size have to be uploaded as Dynamic Large Objects |
||
69 | * |
||
70 | * @var int |
||
71 | */ |
||
72 | protected $maxStreamUploadSize = 5368709120; |
||
73 | |||
74 | /** |
||
75 | * Path where to copy the backup. |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | protected $path = ''; |
||
80 | |||
81 | /** |
||
82 | * (non-PHPDoc) |
||
83 | * |
||
84 | * @see \phpbu\App\Backup\Sync::setup() |
||
85 | * @param array $config |
||
86 | * @throws \phpbu\App\Backup\Sync\Exception |
||
87 | */ |
||
88 | 9 | public function setup(array $config) |
|
108 | |||
109 | /** |
||
110 | * Make sure all mandatory keys are present in given config. |
||
111 | * |
||
112 | * @param array $config |
||
113 | * @throws \phpbu\App\Backup\Sync\Exception |
||
114 | */ |
||
115 | 9 | protected function validateConfig(array $config) |
|
123 | |||
124 | /** |
||
125 | * Execute the sync. |
||
126 | * |
||
127 | * @see \phpbu\App\Backup\Sync::sync() |
||
128 | * @param \phpbu\App\Backup\Target $target |
||
129 | * @param \phpbu\App\Result $result |
||
130 | * @throws \phpbu\App\Backup\Sync\Exception |
||
131 | */ |
||
132 | public function sync(Target $target, Result $result) |
||
172 | |||
173 | /** |
||
174 | * Simulate the sync execution. |
||
175 | * |
||
176 | * @param \phpbu\App\Backup\Target $target |
||
177 | * @param \phpbu\App\Result $result |
||
178 | */ |
||
179 | 1 | public function simulate(Target $target, Result $result) |
|
189 | |||
190 | /** |
||
191 | * @param ObjectStoreService $service |
||
192 | * @return \OpenStack\ObjectStore\v1\Models\Container |
||
193 | * @throws \OpenStack\Common\Error\BadResponseError |
||
194 | */ |
||
195 | protected function getContainer(ObjectStoreService $service, Result $result) |
||
203 | |||
204 | /** |
||
205 | * Get the upload path |
||
206 | * |
||
207 | * @param \phpbu\App\Backup\Target $target |
||
208 | * @return string |
||
209 | */ |
||
210 | 2 | public function getUploadPath(Target $target) |
|
214 | } |
||
215 |