jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/375736 )

Change subject: BS3: Added new Data infrastructure
......................................................................


BS3: Added new Data infrastructure

Change-Id: I0d9c9afa4e71d1ff7e7d457a7085a2b57d472eab
---
A src/Data/DatabaseReader.php
A src/Data/DatabaseWriter.php
A src/Data/IReader.php
A src/Data/IStore.php
A src/Data/IWriter.php
A src/Data/ResultSet.php
6 files changed, 118 insertions(+), 0 deletions(-)

Approvals:
  Pwirth: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/Data/DatabaseReader.php b/src/Data/DatabaseReader.php
new file mode 100644
index 0000000..9c066f5
--- /dev/null
+++ b/src/Data/DatabaseReader.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace BlueSpice\Data;
+
+abstract class DatabaseReader implements IReader {
+
+       /**
+        *
+        * @var \DatabaseBase
+        */
+       protected $db = null;
+
+       /**
+        *
+        * @param \LoadBalancer $loadBalancer
+        */
+       public function __construct( $loadBalancer ) {
+               $this->db = $loadBalancer->getConnection( DB_REPLICA );
+       }
+}
diff --git a/src/Data/DatabaseWriter.php b/src/Data/DatabaseWriter.php
new file mode 100644
index 0000000..5e4fb98
--- /dev/null
+++ b/src/Data/DatabaseWriter.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace BlueSpice\Data;
+
+abstract class DatabaseWriter implements IWriter {
+
+       /**
+        *
+        * @var \DatabaseBase
+        */
+       protected $db = null;
+
+       /**
+        *
+        * @param \LoadBalancer $loadBalancer
+        */
+       public function __construct( $loadBalancer ) {
+               $this->db = $loadBalancer->getConnection( DB_MASTER );
+       }
+}
diff --git a/src/Data/IReader.php b/src/Data/IReader.php
new file mode 100644
index 0000000..f321a26
--- /dev/null
+++ b/src/Data/IReader.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace BlueSpice\Data;
+
+interface IReader {
+
+       /**
+        *
+        * @param  ReaderParams $params
+        * @return ResultSet
+        */
+       public function read( $params );
+}
\ No newline at end of file
diff --git a/src/Data/IStore.php b/src/Data/IStore.php
new file mode 100644
index 0000000..addb054
--- /dev/null
+++ b/src/Data/IStore.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace BlueSpice\Data;
+
+interface IStore {
+
+       /**
+        * @return IWriter
+        */
+       public function getWriter();
+
+       /**
+        * @return IReader
+        */
+       public function getReader();
+}
\ No newline at end of file
diff --git a/src/Data/IWriter.php b/src/Data/IWriter.php
new file mode 100644
index 0000000..5668374
--- /dev/null
+++ b/src/Data/IWriter.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace BlueSpice\Data;
+
+interface IWriter {
+
+       /**
+        *
+        * @param array $dataSet
+        * @return \Status
+        */
+       public function write( $dataSet );
+}
\ No newline at end of file
diff --git a/src/Data/ResultSet.php b/src/Data/ResultSet.php
new file mode 100644
index 0000000..c7e371e
--- /dev/null
+++ b/src/Data/ResultSet.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace BlueSpice\Data;
+
+class ResultSet {
+
+       /**
+        *
+        * @var \stdClass[]
+        */
+       protected $records = [];
+
+       /**
+        *
+        * @var int
+        */
+       protected $total = 0;
+
+       /**
+        *
+        * @param \stdClass[] $records
+        * @param int $total
+        */
+       public function __construct( $records, $total ) {
+               $this->records = $records;
+               $this->total = $total;
+       }
+
+       public function getRecords() {
+               return $this->records;
+       }
+
+       public function getTotal() {
+               return $this->total;
+       }
+}
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/375736
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d9c9afa4e71d1ff7e7d457a7085a2b57d472eab
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to