Skip to content

Commit

Permalink
fix: rename cache token
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 6, 2024
1 parent 301a6e6 commit 0232a16
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ set(Z_FEATURE_TCP_NODELAY 1 CACHE STRING "Toggle TCP_NODELAY")
set(Z_FEATURE_LOCAL_SUBSCRIBER 0 CACHE STRING "Toggle local subscriptions")
set(Z_FEATURE_PUBLISHER_SESSION_CHECK 1 CACHE STRING "Toggle publisher session check")
set(Z_FEATURE_BATCHING 1 CACHE STRING "Toggle batching")
set(Z_FEATURE_MEMOIZATION 0 CACHE STRING "Toggle memoization")
set(Z_FEATURE_RX_CACHE 0 CACHE STRING "Toggle RX_CACHE")

add_compile_definitions("Z_BUILD_DEBUG=$<CONFIG:Debug>")
message(STATUS "Building with feature confing:\n\
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define Z_FEATURE_LOCAL_SUBSCRIBER 0
#define Z_FEATURE_PUBLISHER_SESSION_CHECK 1
#define Z_FEATURE_BATCHING 1
#define Z_FEATURE_MEMOIZATION 0
#define Z_FEATURE_RX_CACHE 0
// End of CMake generation

/*------------------ Runtime configuration properties ------------------*/
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define Z_FEATURE_LOCAL_SUBSCRIBER @Z_FEATURE_LOCAL_SUBSCRIBER@
#define Z_FEATURE_PUBLISHER_SESSION_CHECK @Z_FEATURE_PUBLISHER_SESSION_CHECK@
#define Z_FEATURE_BATCHING @Z_FEATURE_BATCHING@
#define Z_FEATURE_MEMOIZATION @Z_FEATURE_MEMOIZATION@
#define Z_FEATURE_RX_CACHE @Z_FEATURE_RX_CACHE@
// End of CMake generation

/*------------------ Runtime configuration properties ------------------*/
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/net/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef struct _z_session_t {
#if Z_FEATURE_SUBSCRIPTION == 1
_z_subscription_rc_list_t *_local_subscriptions;
_z_subscription_rc_list_t *_remote_subscriptions;
#if Z_FEATURE_MEMOIZATION == 1
#if Z_FEATURE_RX_CACHE == 1
_z_subscription_cache_t _subscription_cache;
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/session/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void _z_trigger_local_subscriptions(_z_session_t *zn, const _z_keyexpr_t *keyexp

#if Z_FEATURE_SUBSCRIPTION == 1

#if Z_FEATURE_MEMOIZATION == 1
#if Z_FEATURE_RX_CACHE == 1
void _z_subscription_cache_clear(_z_subscription_cache_t *cache);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/protocol/codec/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#define _Z_FRAME_VEC_BASE_SIZE 8 // Abritrary small value
#define _Z_FRAME_VEC_SIZE_FROM_ZBUF_LEN(len) \
_Z_FRAME_VEC_BASE_SIZE + (len) / Z_CONFIG_FRAME_AVG_MSG_SIZE // Approximate number of messages in frame
(_Z_FRAME_VEC_BASE_SIZE + (len) / Z_CONFIG_FRAME_AVG_MSG_SIZE) // Approximate number of messages in frame

uint8_t _z_whatami_to_uint8(z_whatami_t whatami) {
return (whatami >> 1) & 0x03; // get set bit index; only first 3 bits can be set
Expand Down
6 changes: 3 additions & 3 deletions src/session/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define _Z_SUBINFOS_VEC_SIZE 4 // Arbitrary initial size

#if Z_FEATURE_MEMOIZATION == 1
#if Z_FEATURE_RX_CACHE == 1
static inline bool _z_subscription_get_from_cache(_z_session_t *zn, const _z_keyexpr_t *ke, _z_keyexpr_t *ke_val,
_z_subscription_infos_svec_t *infos_val) {
if (!_z_keyexpr_equals(ke, &zn->_subscription_cache.ke_in)) {
Expand Down Expand Up @@ -77,7 +77,7 @@ static inline void _z_subscription_update_cache(_z_session_t *zn, const _z_keyex
_ZP_UNUSED(infos);
return;
}
#endif // Z_FEATURE_MEMOIZATION == 1
#endif // Z_FEATURE_RX_CACHE == 1

// Subscription
bool _z_subscription_eq(const _z_subscription_t *other, const _z_subscription_t *this_) {
Expand Down Expand Up @@ -226,7 +226,7 @@ z_result_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t *keyexp
}
// Clean up
_z_sample_clear(&sample);
#if Z_FEATURE_MEMOIZATION != 1
#if Z_FEATURE_RX_CACHE != 1
_z_subscription_infos_svec_release(&subs); // Otherwise it's released with cache
#endif
return _Z_RES_OK;
Expand Down
4 changes: 2 additions & 2 deletions src/session/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ z_result_t _z_session_init(_z_session_rc_t *zsrc, _z_id_t *zid) {
#if Z_FEATURE_SUBSCRIPTION == 1
zn->_local_subscriptions = NULL;
zn->_remote_subscriptions = NULL;
#if Z_FEATURE_MEMOIZATION == 1
#if Z_FEATURE_RX_CACHE == 1
memset(&zn->_subscription_cache, 0, sizeof(zn->_subscription_cache));
#endif
#endif
Expand Down Expand Up @@ -114,7 +114,7 @@ void _z_session_clear(_z_session_t *zn) {
_z_flush_resources(zn);
#if Z_FEATURE_SUBSCRIPTION == 1
_z_flush_subscriptions(zn);
#if Z_FEATURE_MEMOIZATION == 1
#if Z_FEATURE_RX_CACHE == 1
_z_subscription_cache_clear(&zn->_subscription_cache);
#endif
#endif
Expand Down

0 comments on commit 0232a16

Please sign in to comment.