From 14cf0b3142820dee24da8e7162db6155cdd01ceb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 19 May 2016 17:00:38 -0400
Subject: [PATCH] python: add size proprety

---
 python/opendht.pyx     | 3 +++
 python/opendht_cpp.pxd | 1 +
 2 files changed, 4 insertions(+)

diff --git a/python/opendht.pyx b/python/opendht.pyx
index dd6425a1..aeeb3fa1 100644
--- a/python/opendht.pyx
+++ b/python/opendht.pyx
@@ -158,6 +158,9 @@ cdef class Value(object):
             return self._value.get().id
         def __set__(self, cpp.uint64_t value):
             self._value.get().id = value
+    property size:
+        def __get__(self):
+            return self._value.get().size()
 
 cdef class NodeSetIter(object):
     cdef map[cpp.InfoHash, cpp.shared_ptr[cpp.Node]]* _nodes
diff --git a/python/opendht_cpp.pxd b/python/opendht_cpp.pxd
index f89bf4ba..ca333428 100644
--- a/python/opendht_cpp.pxd
+++ b/python/opendht_cpp.pxd
@@ -85,6 +85,7 @@ cdef extern from "opendht/value.h" namespace "dht":
         Value(vector[uint8_t]) except +
         Value(const uint8_t* dat_ptr, size_t dat_len) except +
         string toString() const
+        size_t size() const
         uint64_t id
         shared_ptr[PublicKey] owner
         InfoHash recipient
-- 
GitLab