Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
bad8bdfe
Commit
bad8bdfe
authored
Nov 7, 2023
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: support 'permanent' argument for put
parent
13194b66
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/opendht.pyx
+2
-2
2 additions, 2 deletions
python/opendht.pyx
python/opendht_cpp.pxd
+9
-2
9 additions, 2 deletions
python/opendht_cpp.pxd
with
11 additions
and
4 deletions
python/opendht.pyx
+
2
−
2
View file @
bad8bdfe
...
@@ -587,7 +587,7 @@ cdef class DhtRunner(_WithID):
...
@@ -587,7 +587,7 @@ cdef class DhtRunner(_WithID):
while
pending
>
0
:
while
pending
>
0
:
lock
.
wait
()
lock
.
wait
()
return
res
return
res
def
put
(
self
,
InfoHash
key
,
Value
val
,
done_cb
=
None
):
def
put
(
self
,
InfoHash
key
,
Value
val
,
done_cb
=
None
,
permanent
=
False
):
"""
Publish a new value on the DHT at key.
"""
Publish a new value on the DHT at key.
key -- the DHT key where to put the value
key -- the DHT key where to put the value
...
@@ -597,7 +597,7 @@ cdef class DhtRunner(_WithID):
...
@@ -597,7 +597,7 @@ cdef class DhtRunner(_WithID):
if
done_cb
:
if
done_cb
:
cb_obj
=
{
'
done
'
:
done_cb
}
cb_obj
=
{
'
done
'
:
done_cb
}
ref
.
Py_INCREF
(
cb_obj
)
ref
.
Py_INCREF
(
cb_obj
)
self
.
thisptr
.
get
().
put
(
key
.
_infohash
,
val
.
_value
,
cpp
.
bindDoneCb
(
done_callback
,
<
void
*>
cb_obj
))
self
.
thisptr
.
get
().
put
(
key
.
_infohash
,
val
.
_value
,
cpp
.
bindDoneCb
(
done_callback
,
<
void
*>
cb_obj
)
,
cpp
.
time_point
.
max
(),
permanent
)
else
:
else
:
lock
=
threading
.
Condition
()
lock
=
threading
.
Condition
()
pending
=
0
pending
=
0
...
...
This diff is collapsed.
Click to expand it.
python/opendht_cpp.pxd
+
9
−
2
View file @
bad8bdfe
...
@@ -26,7 +26,7 @@ from libc.string cimport const_char, const_uchar
...
@@ -26,7 +26,7 @@ from libc.string cimport const_char, const_uchar
ctypedef
uint16_t
in_port_t
ctypedef
uint16_t
in_port_t
ctypedef
unsigned
short
int
sa_family_t
;
ctypedef
unsigned
short
int
sa_family_t
;
cdef
extern
from
"
<
iostream
>
"
namespace
"
std::chrono
"
nogil
:
cdef
extern
from
"
<
chrono
>
"
namespace
"
std::chrono
"
nogil
:
cdef
cppclass
duration
[
ulong
]:
cdef
cppclass
duration
[
ulong
]:
duration
()
except
+
duration
()
except
+
...
@@ -59,6 +59,13 @@ cdef extern from "<future>" namespace "std" nogil:
...
@@ -59,6 +59,13 @@ cdef extern from "<future>" namespace "std" nogil:
bool
valid
()
const
bool
valid
()
const
shared_future
[
T
]
share
()
shared_future
[
T
]
share
()
cdef
extern
from
"
opendht/utils.h
"
namespace
"
dht
"
:
cdef
cppclass
time_point
:
@staticmethod
time_point
min
()
const
@staticmethod
time_point
max
()
const
cdef
extern
from
"
opendht/infohash.h
"
namespace
"
dht
"
:
cdef
extern
from
"
opendht/infohash.h
"
namespace
"
dht
"
:
cdef
cppclass
InfoHash
:
cdef
cppclass
InfoHash
:
InfoHash
()
except
+
InfoHash
()
except
+
...
@@ -254,7 +261,7 @@ cdef extern from "opendht/dhtrunner.h" namespace "dht":
...
@@ -254,7 +261,7 @@ cdef extern from "opendht/dhtrunner.h" namespace "dht":
string
getRoutingTablesLog
(
sa_family_t
af
)
const
string
getRoutingTablesLog
(
sa_family_t
af
)
const
string
getSearchesLog
(
sa_family_t
af
)
const
string
getSearchesLog
(
sa_family_t
af
)
const
void
get
(
InfoHash
key
,
GetCallback
get_cb
,
DoneCallback
done_cb
,
nullptr_t
f
,
Where
w
)
void
get
(
InfoHash
key
,
GetCallback
get_cb
,
DoneCallback
done_cb
,
nullptr_t
f
,
Where
w
)
void
put
(
InfoHash
key
,
shared_ptr
[
Value
]
val
,
DoneCallback
done_cb
)
void
put
(
InfoHash
key
,
shared_ptr
[
Value
]
val
,
DoneCallback
done_cb
,
time_point
created
,
bool
permanent
)
ListenToken
listen
(
InfoHash
key
,
ValueCallback
get_cb
)
ListenToken
listen
(
InfoHash
key
,
ValueCallback
get_cb
)
void
cancelListen
(
InfoHash
key
,
SharedListenToken
token
)
void
cancelListen
(
InfoHash
key
,
SharedListenToken
token
)
vector
[
unsigned
]
getNodeMessageStats
(
bool
i
)
vector
[
unsigned
]
getNodeMessageStats
(
bool
i
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment