Hoo man has submitted this change and it was merged. Change subject: Cleanup in Chunck* classes ......................................................................
Cleanup in Chunck* classes Change-Id: I7275b46e42cd8fa2551c565dded68c1b1a0b230a --- M lib/includes/store/ChunkAccess.php M lib/includes/store/ChunkCache.php 2 files changed, 21 insertions(+), 27 deletions(-) Approvals: Hoo man: Looks good to me, approved WikidataJenkins: Verified diff --git a/lib/includes/store/ChunkAccess.php b/lib/includes/store/ChunkAccess.php index a02c59a..e9de95f 100644 --- a/lib/includes/store/ChunkAccess.php +++ b/lib/includes/store/ChunkAccess.php @@ -1,21 +1,15 @@ <?php -/** - * Interface for DAO objects providing chunked access. - * - * @since 0.4 - * - * @licence GNU GPL v2+ - * @author Daniel Kinzler - */ namespace Wikibase; - /** * Interface for DAO objects providing chunked access based on sequential indexes. * "holes" in the index sequence are acceptable but should not be frequent. * - * @package Wikibase + * @since 0.4 + * + * @licence GNU GPL v2+ + * @author Daniel Kinzler */ interface ChunkAccess { diff --git a/lib/includes/store/ChunkCache.php b/lib/includes/store/ChunkCache.php index 794458b..47e179b 100644 --- a/lib/includes/store/ChunkCache.php +++ b/lib/includes/store/ChunkCache.php @@ -1,4 +1,9 @@ <?php + +namespace Wikibase; + +use MWException; + /** * Interface for DAO objects providing chunked access. * @@ -7,18 +12,12 @@ * @licence GNU GPL v2+ * @author Daniel Kinzler */ - -namespace Wikibase; - - -use MWException; - class ChunkCache implements ChunkAccess { /** * @var ChunkAccess */ - protected $source; + private $source; /** * Array containing cache entries; each entry is an associative array with the @@ -32,39 +31,39 @@ * * @var array */ - protected $entries = array(); + private $entries = array(); /** * @var int */ - protected $size = 0; + private $size = 0; /** * @var int */ - protected $maxSize; + private $maxSize; /** * @var int */ - protected $chunkSize; + private $chunkSize; /** * @var int */ - protected $hitCount = 0; + private $hitCount = 0; /** * @var int */ - protected $missCount = 0; + private $missCount = 0; /** * modification counter (logical clock) * * @var int */ - protected $modCount = 0; + private $modCount = 0; /** * @param ChunkAccess $source The source to load from @@ -221,7 +220,7 @@ * - next: the id the following chunk starts at (or after) * - touched: (logical) timestamp of the entry's creation (taken from $this->modCount) */ - protected function insertChunk( $start, $size, $before ) { + private function insertChunk( $start, $size, $before ) { assert( '$start >= 0' ); assert( '$size >= 0' ); assert( '$before >= 0' ); @@ -264,7 +263,7 @@ * * Note that this implementation is rather inefficient for large number of chunks. */ - protected function prune() { + private function prune() { if ( $this->size <= $this->maxSize ) { return; } @@ -291,7 +290,7 @@ * * @return bool */ - protected function dropChunk( $startKey ) { + private function dropChunk( $startKey ) { foreach ( $this->entries as $pos => $entry ) { if ( $entry['start'] === $startKey ) { unset( $this->entries[$pos] ); @@ -347,4 +346,5 @@ return $this->hitCount / $total; } + } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/137075 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7275b46e42cd8fa2551c565dded68c1b1a0b230a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits