|
|
@ -2,6 +2,7 @@ |
|
|
|
# cython: language_level = 3 |
|
|
|
# cython: language_level = 3 |
|
|
|
from libcpp cimport bool |
|
|
|
from libcpp cimport bool |
|
|
|
from libcpp.string cimport string |
|
|
|
from libcpp.string cimport string |
|
|
|
|
|
|
|
from libcpp.vector cimport vector |
|
|
|
import threading |
|
|
|
import threading |
|
|
|
|
|
|
|
|
|
|
|
cdef extern from "common/params.h": |
|
|
|
cdef extern from "common/params.h": |
|
|
@ -22,6 +23,7 @@ cdef extern from "common/params.h": |
|
|
|
bool checkKey(string) nogil |
|
|
|
bool checkKey(string) nogil |
|
|
|
string getParamPath(string) nogil |
|
|
|
string getParamPath(string) nogil |
|
|
|
void clearAll(ParamKeyType) |
|
|
|
void clearAll(ParamKeyType) |
|
|
|
|
|
|
|
vector[string] allKeys() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ensure_bytes(v): |
|
|
|
def ensure_bytes(v): |
|
|
@ -99,6 +101,9 @@ cdef class Params: |
|
|
|
cdef string key_bytes = ensure_bytes(key) |
|
|
|
cdef string key_bytes = ensure_bytes(key) |
|
|
|
return self.p.getParamPath(key_bytes).decode("utf-8") |
|
|
|
return self.p.getParamPath(key_bytes).decode("utf-8") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def all_keys(self): |
|
|
|
|
|
|
|
return self.p.allKeys() |
|
|
|
|
|
|
|
|
|
|
|
def put_nonblocking(key, val, d=""): |
|
|
|
def put_nonblocking(key, val, d=""): |
|
|
|
threading.Thread(target=lambda: Params(d).put(key, val)).start() |
|
|
|
threading.Thread(target=lambda: Params(d).put(key, val)).start() |
|
|
|
|
|
|
|
|
|
|
|