[Groonga-commit] droonga/fluent-plugin-droonga at d9ed96d [master] Fix problem with serialization of Time instances

Back to archive index

Yoji Shidara null+****@clear*****
Mon Dec 16 14:54:24 JST 2013


Yoji Shidara	2013-12-16 14:54:24 +0900 (Mon, 16 Dec 2013)

  New Revision: d9ed96d0ba39fd3ed722d04545f8d72f6458ec4f
  https://github.com/droonga/fluent-plugin-droonga/commit/d9ed96d0ba39fd3ed722d04545f8d72f6458ec4f

  Message:
    Fix problem with serialization of Time instances

  Added files:
    test/command/fixture/event.jsons
    test/command/suite/search/time.expected
    test/command/suite/search/time.test
    test/command/suite/watch/subscribe.reject
  Modified files:
    lib/droonga/fluent_message_sender.rb

  Modified: lib/droonga/fluent_message_sender.rb (+4 -1)
===================================================================
--- lib/droonga/fluent_message_sender.rb    2013-12-16 14:53:39 +0900 (ff6e338)
+++ lib/droonga/fluent_message_sender.rb    2013-12-16 14:54:24 +0900 (a57bb73)
@@ -16,6 +16,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require "cool.io"
+require "droonga/message_pack_packer"
 
 module Droonga
   class FluentMessageSender
@@ -40,7 +41,9 @@ module Droonga
     def send(tag, data)
       $log.trace("#{log_tag}: send: start")
       connect if****@socke*****?
-      fluent_message = [tag, Time.now.to_i, data].to_msgpack
+      fluent_message = MessagePackPacker.to_msgpack(
+        [tag, Time.now.to_i, data]
+      )
       @socket.write(fluent_message)
       @loop.break_current_loop
       $log.trace("#{log_tag}: send: done")

  Added: test/command/fixture/event.jsons (+41 -0) 100644
===================================================================
--- /dev/null
+++ test/command/fixture/event.jsons    2013-12-16 14:54:24 +0900 (4c9efdc)
@@ -0,0 +1,41 @@
+#@disable-logging
+{
+  "type": "table_create",
+  "dataset": "Droonga",
+  "body": {
+    "name"  : "Event",
+    "flags" : "TABLE_HASH_KEY"
+  }
+}
+{
+  "type": "column_create",
+  "dataset": "Droonga",
+  "body": {
+    "table" : "Event",
+    "name"  : "start",
+    "type"  : "Time"
+  }
+}
+{
+  "dataset": "Droonga",
+  "type": "add",
+  "body": {
+    "table": "Event",
+    "key": "Groonga Night 3",
+    "values": {
+      "start": 1354183200
+    }
+  }
+}
+{
+  "dataset": "Droonga",
+  "type": "add",
+  "body": {
+    "table": "Event",
+    "key": "Groonga Night 4",
+    "values": {
+      "start": "2013-11-29T08:00:00Z"
+    }
+  }
+}
+#@enable-logging

  Added: test/command/suite/search/time.expected (+24 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/time.expected    2013-12-16 14:54:24 +0900 (cac44af)
@@ -0,0 +1,24 @@
+[
+  "droonga.message",
+  0,
+  {
+    "inReplyTo": null,
+    "statusCode": 200,
+    "type": "search.result",
+    "body": {
+      "result": {
+        "count": 2,
+        "records": [
+          [
+            "Groonga Night 3",
+            "2012-11-29T10:00:00Z"
+          ],
+          [
+            "Groonga Night 4",
+            "2013-11-29T08:00:00Z"
+          ]
+        ]
+      }
+    }
+  }
+]

  Added: test/command/suite/search/time.test (+24 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/time.test    2013-12-16 14:54:24 +0900 (ea96dbe)
@@ -0,0 +1,24 @@
+#@include fixture/event.jsons
+{
+  "type": "search",
+  "dataset": "Droonga",
+  "body": {
+    "queries": {
+      "result": {
+        "source": "Event",
+        "sortBy": ["_key"],
+        "output": {
+          "elements": [
+            "startTime",
+            "elapsedTime",
+            "count",
+            "attributes",
+            "records"
+          ],
+          "limit": -1,
+          "attributes": ["_key", "start"]
+        }
+      }
+    }
+  }
+}

  Added: test/command/suite/watch/subscribe.reject (+0 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/watch/subscribe.reject    2013-12-16 14:54:24 +0900 (e69de29)
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index