com presentations: Added phongo and hippo slides: phphhvm-tek15.xml slides/mongodb/api-new.xml slides/mongodb/api-old.xml slides/mongodb/hhvmhack.png slides/mongodb/hippo-impl-2.xml slides/mongodb/hippo-impl.xml slides/mongodb/hippo.jpg slides/mongodb/hippo.xml slides/mongodb/mongo-x2.png slides/mongodb/mongo-x2b.png slides/mongodb/phongo.xml

[email protected] (Derick Rethans) Tue, 19 May 2015 21:52:56 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    1da6c1e256f7c21be9aabda450d149c4f6910f43
Author:    Derick Rethans <[email protected]>         Tue, 19 May 2015 16:52:56 -0500
Parents:   db3a92219dbece8bdabe35f5498d868140f5f7d7
Branches:  master

Link:       http://git.php.net/?p=presentations.git;a=commitdiff;h=1da6c1e256f7c21be9aabda450d149c4f6910f43

Log:
Added phongo and hippo slides

Changed paths:
  M  phphhvm-tek15.xml
  A  slides/mongodb/api-new.xml
  A  slides/mongodb/api-old.xml
  A  slides/mongodb/hhvmhack.png
  A  slides/mongodb/hippo-impl-2.xml
  A  slides/mongodb/hippo-impl.xml
  A  slides/mongodb/hippo.jpg
  A  slides/mongodb/hippo.xml
  A  slides/mongodb/mongo-x2.png
  A  slides/mongodb/mongo-x2b.png
  A  slides/mongodb/phongo.xml


Diff:
diff --git a/phphhvm-tek15.xml b/phphhvm-tek15.xml
index f6cc067..0b144e9 100644
--- a/phphhvm-tek15.xml
+++ b/phphhvm-tek15.xml
@@ -119,8 +119,15 @@ Composer
 <slide>slides/mongodb/libbson.xml</slide>
 <slide>slides/mongodb/libmongoc.xml</slide>
 
+<slide>slides/mongodb/phongo.xml</slide>
 <slide>slides/mongodb/new-driver-bc.xml</slide>
 <slide>slides/mongodb/new-driver-bc2.xml</slide>
+<slide>slides/mongodb/api-old.xml</slide>
+<slide>slides/mongodb/api-new.xml</slide>
+
+<slide>slides/mongodb/hippo.xml</slide>
+<slide>slides/mongodb/hippo-impl.xml</slide>
+<slide>slides/mongodb/hippo-impl-2.xml</slide>
 
 <!-- ISSUES -->
 
diff --git a/slides/mongodb/api-new.xml b/slides/mongodb/api-new.xml
new file mode 100644
index 0000000..f1ee0f1
--- /dev/null
+++ b/slides/mongodb/api-new.xml
@@ -0,0 +1,30 @@
+<slide>
+<title>Phongo API (mongodb.so)</title>
+
+<example><![CDATA[<?php
+$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
+
+$c = new MongoDB\Driver\Command( [ 'drop' => 'test' ] );
+$cursor = $m->executeCommand( 'demo', $c );
+
+$doc = [
+    'string' => 'bar',
+    'number_i' => 55,
+    'number_l' => 12345678901234567,
+    'bool' => true,
+    'null' => null,
+    'float' => M_PI,
+];
+
+$r = $m->executeInsert( 'demo.test', $doc );
+
+$q = new MongoDB\Driver\Query( [] );
+$cursor = $m->executeQuery( 'demo.test', $q );
+
+foreach ( $cursor->toArray() as $key => $result )
+{
+    print_r( $result );
+}
+?>]]>
+</example>
+</slide>
diff --git a/slides/mongodb/api-old.xml b/slides/mongodb/api-old.xml
new file mode 100644
index 0000000..bb879e1
--- /dev/null
+++ b/slides/mongodb/api-old.xml
@@ -0,0 +1,30 @@
+<slide>
+<title>Old API (mongo.so)</title>
+
+<example><![CDATA[<?php
+$m = new MongoClient("mongodb://localhost:27017");
+
+$m->demo->test->drop();
+
+
+$doc = [
+    'string' => 'bar',
+    'number_i' => 55,
+    'number_l' => 12345678901234567,
+    'bool' => true,
+    'null' => null,
+    'float' => M_PI,
+];
+
+$r = $m->demo->test->insert( $doc );
+
+$cursor = $m->demo->test->find();
+
+
+foreach ( $cursor as $key => $result )
+{
+    print_r( $result );
+}
+?>]]>
+</example>
+</slide>
diff --git a/slides/mongodb/hhvmhack.png b/slides/mongodb/hhvmhack.png
new file mode 100644
index 0000000..3212b42
Binary files /dev/null and b/slides/mongodb/hhvmhack.png differ
diff --git a/slides/mongodb/hippo-impl-2.xml b/slides/mongodb/hippo-impl-2.xml
new file mode 100644
index 0000000..0a0f48f
--- /dev/null
+++ b/slides/mongodb/hippo-impl-2.xml
@@ -0,0 +1,53 @@
+<slide>
+<title>Hippo (implementation)</title>
+
+<blurb>%ext_mongo.php% (extract)</blurb>
+<example><![CDATA[<?hh
+namespace MongoDB\Driver;
+
+<<__NativeData("MongoDBDriverReadPreference")>>
+final class ReadPreference {
+    <<__Native>>
+    private function _setReadPreference(int $readPreference): void;
+
+    <<__Native>>
+    private function _setReadPreferenceTags(array $tagSets): void;
+
+    public function __construct(int $readPreference, mixed $tagSets = null)
+    {
+        if ($tagSets !== NULL && Utils::mustBeArrayOrObject('parameter 2', $tagSets)) {
+            return;
+        }
+
+        switch ($readPreference) {
+            case ReadPreference::RP_PRIMARY:
+            case ReadPreference::RP_PRIMARY_PREFERRED:
+            case ReadPreference::RP_SECONDARY:
+            case ReadPreference::RP_SECONDARY_PREFERRED:
+            case ReadPreference::RP_NEAREST:
+                // calling into Native
+                $this->_setReadPreference($readPreference);
+
+                if ($tagSets) {
+                    // calling into Native, might throw exception
+                    $this->_setReadPreferenceTags($tagSets);
+                }
+
+                break;
+
+            default:
+                Utils::throwHippoException(Utils::ERROR_INVALID_ARGUMENT, "Invalid ReadPreference");
+                break;
+        }
+    }
+}]]></example>
+
+<blurb>%src/MongoDB/Driver/Manager% (extract)</blurb>
+<example><![CDATA[void HHVM_METHOD(MongoDBDriverReadPreference, _setReadPreference, int readPreference)
+{
+    MongoDBDriverReadPreferenceData* data = Native::data<MongoDBDriverReadPreferenceData>(this_);
+
+    data->m_read_preference = mongoc_read_prefs_new((mongoc_read_mode_t) readPreference);
+} ]]></example>
+</slide>
+
diff --git a/slides/mongodb/hippo-impl.xml b/slides/mongodb/hippo-impl.xml
new file mode 100644
index 0000000..8d8caed
--- /dev/null
+++ b/slides/mongodb/hippo-impl.xml
@@ -0,0 +1,28 @@
+<slide>
+<title>Hippo (implementation)</title>
+
+<blurb>%ext_mongo.php% (extract)</blurb>
+<example><![CDATA[<?hh
+namespace MongoDB\Driver;
+
+<<__NativeData("MongoDBDriverManager")>>
+class Manager {
+    <<__Native>>
+    function __construct(string $dsn = "localhost", array $options = array(), array $driverOptions = array());
+}]]></example>
+
+<blurb>%src/MongoDB/Driver/Manager% (extract)</blurb>
+<example><![CDATA[void HHVM_METHOD(MongoDBDriverManager, __construct, const String &dsn, const Array &options, const Array &driverOptions)
+{
+    MongoDBDriverManagerData* data = Native::data<MongoDBDriverManagerData>(this_);
+    mongoc_client_t *client;
+
+    client = mongoc_client_new(dsn.c_str());
+
+    if (!client) {
+        throw Object(SystemLib::AllocExceptionObject("Can't connect"));
+    }
+
+    data->m_client = client;
+}]]></example>
+</slide>
diff --git a/slides/mongodb/hippo.jpg b/slides/mongodb/hippo.jpg
new file mode 100644
index 0000000..78cc7e6
Binary files /dev/null and b/slides/mongodb/hippo.jpg differ
diff --git a/slides/mongodb/hippo.xml b/slides/mongodb/hippo.xml
new file mode 100644
index 0000000..a20fcf8
--- /dev/null
+++ b/slides/mongodb/hippo.xml
@@ -0,0 +1,14 @@
+<slide>
+<title>Hippo</title>
+
+<image filename="hippo.jpg" align="right" attr="Sander van der Wel - https://www.flickr.com/photos/jar0d/4023203232/"/>
+<list>
+<bullet>"Same" implementation of phongo APIs as extension for HHVM</bullet>
+<bullet>Drop-in replacement</bullet>
+<bullet>No shared code, as this is C++</bullet>
+<bullet>Parts of it can be written in Hack</bullet>
+</list>
+
+<break lines="3"/>
+<image filename="hhvmhack.png" align="center"/>
+</slide>
diff --git a/slides/mongodb/mongo-x2.png b/slides/mongodb/mongo-x2.png
new file mode 100644
index 0000000..3e70c3b
Binary files /dev/null and b/slides/mongodb/mongo-x2.png differ
diff --git a/slides/mongodb/mongo-x2b.png b/slides/mongodb/mongo-x2b.png
new file mode 100644
index 0000000..83b05ba
Binary files /dev/null and b/slides/mongodb/mongo-x2b.png differ
diff --git a/slides/mongodb/phongo.xml b/slides/mongodb/phongo.xml
new file mode 100644
index 0000000..b068f43
--- /dev/null
+++ b/slides/mongodb/phongo.xml
@@ -0,0 +1,10 @@
+<slide>
+<title>Phongo</title>
+
+<list>
+	<bullet>New backwards breaking MongoDB extension for PHP 5.3 and higher</bullet>
+	<bullet>Very minimal API</bullet>
+	<bullet>Meant to be build upon by PHP libraries (like the 0.8.4 driver)</bullet>
+	<bullet>Uses PHP namespaces</bullet>
+</list>
+</slide>