You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/10/11 09:09:29 UTC

[pulsar] branch asf-site updated: Updated site at revision 6b15a6b

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 64678ca  Updated site at revision 6b15a6b
64678ca is described below

commit 64678cad6e7680132a8fa923699feba20117ff4f
Author: jenkins <bu...@apache.org>
AuthorDate: Thu Oct 11 09:09:18 2018 +0000

    Updated site at revision 6b15a6b
---
 content/api/python/functions/serde.m.html | 66 ++++++++++++++++++++++++++-----
 content/swagger/swagger.json              | 46 ++++++++++-----------
 2 files changed, 80 insertions(+), 32 deletions(-)

diff --git a/content/api/python/functions/serde.m.html b/content/api/python/functions/serde.m.html
index c5619b4..01e4355 100644
--- a/content/api/python/functions/serde.m.html
+++ b/content/api/python/functions/serde.m.html
@@ -979,6 +979,7 @@ table {
         
           
   <ul>
+    <li class="mono"><a href="#pulsar.functions.serde.IdentitySerDe.__init__">__init__</a></li>
     <li class="mono"><a href="#pulsar.functions.serde.IdentitySerDe.deserialize">deserialize</a></li>
     <li class="mono"><a href="#pulsar.functions.serde.IdentitySerDe.serialize">serialize</a></li>
   </ul>
@@ -1097,12 +1098,22 @@ class PickleSerDe(SerDe):
       return pickle.loads(input_bytes)
 
 class IdentitySerDe(SerDe):
-  """Pickle based serializer"""
+  """Simple Serde that just conversion to string and back"""
+  def __init__(self):
+    self._types = [int, float, complex, str]
+
   def serialize(self, input):
-    return input
+    if type(input) in self._types:
+      return str(input).encode('utf-8')
+    raise TypeError
 
   def deserialize(self, input_bytes):
-    return input_bytes
+    for typ in self._types:
+      try:
+        return typ(input_bytes.decode('utf-8'))
+      except:
+        pass
+    raise TypeError
 </code></pre>
   </div>
 
@@ -1117,17 +1128,27 @@ class IdentitySerDe(SerDe):
       <p id="pulsar.functions.serde.IdentitySerDe" class="name">class <span class="ident">IdentitySerDe</span></p>
       
   
-    <div class="desc"><p>Pickle based serializer</p></div>
+    <div class="desc"><p>Simple Serde that just conversion to string and back</p></div>
   <div class="source_cont">
   <p class="source_link"><a href="javascript:void(0);" onclick="toggle('source-pulsar.functions.serde.IdentitySerDe', this);">Show source &equiv;</a></p>
   <div id="source-pulsar.functions.serde.IdentitySerDe" class="source">
     <pre><code>class IdentitySerDe(SerDe):
-  """Pickle based serializer"""
+  """Simple Serde that just conversion to string and back"""
+  def __init__(self):
+    self._types = [int, float, complex, str]
+
   def serialize(self, input):
-    return input
+    if type(input) in self._types:
+      return str(input).encode('utf-8')
+    raise TypeError
 
   def deserialize(self, input_bytes):
-    return input_bytes
+    for typ in self._types:
+      try:
+        return typ(input_bytes.decode('utf-8'))
+      except:
+        pass
+    raise TypeError
 </code></pre>
   </div>
 </div>
@@ -1143,6 +1164,26 @@ class IdentitySerDe(SerDe):
           <h3>Methods</h3>
             
   <div class="item">
+    <div class="name def" id="pulsar.functions.serde.IdentitySerDe.__init__">
+    <p>def <span class="ident">__init__</span>(</p><p>self)</p>
+    </div>
+    
+
+    
+  
+  <div class="source_cont">
+  <p class="source_link"><a href="javascript:void(0);" onclick="toggle('source-pulsar.functions.serde.IdentitySerDe.__init__', this);">Show source &equiv;</a></p>
+  <div id="source-pulsar.functions.serde.IdentitySerDe.__init__" class="source">
+    <pre><code>def __init__(self):
+  self._types = [int, float, complex, str]
+</code></pre>
+  </div>
+</div>
+
+  </div>
+  
+            
+  <div class="item">
     <div class="name def" id="pulsar.functions.serde.IdentitySerDe.deserialize">
     <p>def <span class="ident">deserialize</span>(</p><p>self, input_bytes)</p>
     </div>
@@ -1159,7 +1200,12 @@ class IdentitySerDe(SerDe):
   <p class="source_link"><a href="javascript:void(0);" onclick="toggle('source-pulsar.functions.serde.IdentitySerDe.deserialize', this);">Show source &equiv;</a></p>
   <div id="source-pulsar.functions.serde.IdentitySerDe.deserialize" class="source">
     <pre><code>def deserialize(self, input_bytes):
-  return input_bytes
+  for typ in self._types:
+    try:
+      return typ(input_bytes.decode('utf-8'))
+    except:
+      pass
+  raise TypeError
 </code></pre>
   </div>
 </div>
@@ -1184,7 +1230,9 @@ class IdentitySerDe(SerDe):
   <p class="source_link"><a href="javascript:void(0);" onclick="toggle('source-pulsar.functions.serde.IdentitySerDe.serialize', this);">Show source &equiv;</a></p>
   <div id="source-pulsar.functions.serde.IdentitySerDe.serialize" class="source">
     <pre><code>def serialize(self, input):
-  return input
+  if type(input) in self._types:
+    return str(input).encode('utf-8')
+  raise TypeError
 </code></pre>
   </div>
 </div>
diff --git a/content/swagger/swagger.json b/content/swagger/swagger.json
index 559059c..3ab3b71 100644
--- a/content/swagger/swagger.json
+++ b/content/swagger/swagger.json
@@ -6721,41 +6721,41 @@
           "type" : "number",
           "format" : "double"
         },
+        "underLoaded" : {
+          "type" : "boolean"
+        },
         "bandwidthIn" : {
           "$ref" : "#/definitions/ResourceUsage"
         },
-        "msgThroughputOut" : {
-          "type" : "number",
-          "format" : "double"
+        "bandwidthOut" : {
+          "$ref" : "#/definitions/ResourceUsage"
         },
         "memory" : {
           "$ref" : "#/definitions/ResourceUsage"
         },
-        "msgThroughputIn" : {
-          "type" : "number",
-          "format" : "double"
+        "directMemory" : {
+          "$ref" : "#/definitions/ResourceUsage"
         },
-        "underLoaded" : {
-          "type" : "boolean"
+        "cpu" : {
+          "$ref" : "#/definitions/ResourceUsage"
         },
         "overLoaded" : {
           "type" : "boolean"
         },
-        "cpu" : {
-          "$ref" : "#/definitions/ResourceUsage"
-        },
         "loadReportType" : {
           "type" : "string"
         },
-        "bandwidthOut" : {
-          "$ref" : "#/definitions/ResourceUsage"
+        "msgThroughputIn" : {
+          "type" : "number",
+          "format" : "double"
+        },
+        "msgThroughputOut" : {
+          "type" : "number",
+          "format" : "double"
         },
         "lastUpdate" : {
           "type" : "integer",
           "format" : "int64"
-        },
-        "directMemory" : {
-          "$ref" : "#/definitions/ResourceUsage"
         }
       }
     },
@@ -7684,15 +7684,15 @@
     "ResourceDescription" : {
       "type" : "object",
       "properties" : {
+        "usagePct" : {
+          "type" : "integer",
+          "format" : "int32"
+        },
         "resourceUsage" : {
           "type" : "object",
           "additionalProperties" : {
             "$ref" : "#/definitions/ResourceUsage"
           }
-        },
-        "usagePct" : {
-          "type" : "integer",
-          "format" : "int32"
         }
       }
     },
@@ -7727,11 +7727,11 @@
     "ResourceUnit" : {
       "type" : "object",
       "properties" : {
-        "availableResource" : {
-          "$ref" : "#/definitions/ResourceDescription"
-        },
         "resourceId" : {
           "type" : "string"
+        },
+        "availableResource" : {
+          "$ref" : "#/definitions/ResourceDescription"
         }
       }
     },