function __construct(CACHEDB $cache, MASK $mask, INTERVAL $ivl, $type, $amount, $limit, $resolution, $flags = 0) { $this->cache =& $cache; $this->ids = sizeof($mask->ids); $this->ivl =& $ivl; $this->mask =& $mask; $this->type = $type; $this->limit = $limit; $this->amount = $amount; if ($resolution === false) { $this->resolution = $cache->resolution->Get($this->ivl, $this->amount); } else { $this->resolution = $resolution; } $this->operation_info = array(); $this->options = array(); $this->flags = $flags; $resolution = $cache->resolution->GetWindowSize($this->resolution); $size = $ivl->GetWindowSize(); if ($limit) { $mingap = $size / $limit; if ($resolution) { $mingap = ceil($mingap / $resolution) * $resolution; } } else { if ($resolution) { $mingap = $resolution; } else { $mingap = 0; } } $this->expected_gap = $mingap; if ($mingap && ($this->flags & CACHE::REPORT_EMPTY || $this->flags & CACHE::MISSING_INFO)) { $res = $cache->resolution->Minimal(); $this->allowed_gap = $cache->resolution->GetWindowSize($res); } else { $this->allowed_gap = false; } /* echo $amount . " , " . $limit . "\n"; echo $mingap . "\n"; exit; */ }
function ExportGroup(REQUEST $req, READER $rdr, LOGGROUP $grp, INTERVAL $ivl, MASK $msk = NULL, $title = false) { global $ROOT_COMBIHIST_LIMIT; if (!$title) { $title = $this->GetGroupName($rdr->srvid, $rdr->dbname, $grp->gid, $msk ? $msk->name : ""); } $opts =& $req->GetOptions(); $subseconds = !$opts->Get('ignore_subsecond'); if ($this->stream && !$this->handler->multigroup) { $stream_args = array_merge($this->stream_args, array("expected_blocks" => $this->expected_groups, "block_title" => $title, "block_number" => 0)); $stream_args["extension"] = $this->handler->GetExtension(); if (in_array("ROOT", $this->specials)) { if (!isset($ROOT_COMBIHIST_LIMIT) || $ivl->GetWindowSize() < $ROOT_COMBIHIST_LIMIT) { $stream_args['root__combhist'] = 1; } else { $stream_args['root__combhist'] = 0; } } $this->stream->BlockStart($stream_args); } $this->handler->GroupStart($title, $subseconds); $rdr->Export($this->handler, $grp, $msk, $ivl, $this->resample, "", $this->dmcb); $this->handler->GroupEnd(); if ($this->stream && !$this->handler->multigroup) { $this->stream->BlockEnd(); } }