| 289 | VolumeAllocator::VolumeAllocator() = default; |
| 290 | |
| 291 | Errata |
| 292 | VolumeAllocator::load(swoc::file::path const &spanFile, swoc::file::path const &volumeFile) |
| 293 | { |
| 294 | Errata zret; |
| 295 | |
| 296 | if (volumeFile.empty()) { |
| 297 | zret.note("Volume config file not set"); |
| 298 | } |
| 299 | if (spanFile.empty()) { |
| 300 | zret.note("Span file not set"); |
| 301 | } |
| 302 | |
| 303 | if (zret) { |
| 304 | zret = _vols.load(volumeFile); |
| 305 | if (zret) { |
| 306 | zret = _cache.loadSpan(spanFile); |
| 307 | if (zret) { |
| 308 | CacheStripeBlocks total = _cache.calcTotalSpanConfiguredSize(); |
| 309 | _vols.convertToAbsolute(total); |
| 310 | for (auto &vol : _vols) { |
| 311 | CacheStripeBlocks size(0); |
| 312 | auto spot = _cache._volumes.find(vol._idx); |
| 313 | if (spot != _cache._volumes.end()) { |
| 314 | size = round_down(spot->second._size); |
| 315 | } |
| 316 | _av.push_back({vol, size, 0, 0}); |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | return zret; |
| 322 | } |
| 323 | |
| 324 | void |
| 325 | VolumeAllocator::dumpVolumes() |
no test coverage detected