Skip to content

Commit

Permalink
Merge pull request #597 from ZettaScaleLabs/shm_default
Browse files Browse the repository at this point in the history
Shm default
  • Loading branch information
Mallets authored Aug 14, 2024
2 parents 9938aae + 608f361 commit 3b506d3
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 102 deletions.
10 changes: 0 additions & 10 deletions examples/z_get_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ int main(int argc, char** argv) {
z_owned_config_t config;
z_config_default(&config);

// A probing procedure for shared memory is performed upon session opening. To operate over shared memory
// (and to not fallback on network mode), shared memory needs to be enabled in the configuration.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}

if (argc > 3) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[3]) < 0) {
printf(
Expand Down
10 changes: 0 additions & 10 deletions examples/z_ping_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ int main(int argc, char** argv) {
z_config_default(&config);
}

// A probing procedure for shared memory is performed upon session opening. To operate over shared memory
// (and to not fallback on network mode), shared memory needs to be enabled in the configuration.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}

z_owned_session_t session;
z_open(&session, z_move(config));
z_view_keyexpr_t ping;
Expand Down
12 changes: 0 additions & 12 deletions examples/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ int main(int argc, char** argv) {
z_config_default(&config);
}

#ifdef SHARED_MEMORY
// A probing procedure for shared memory is performed upon session opening. To operate over shared memory
// (and to not fallback on network mode), shared memory needs to be enabled in the configuration.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}
#endif

z_owned_session_t session;
z_open(&session, z_move(config));
z_view_keyexpr_t ping;
Expand Down
11 changes: 0 additions & 11 deletions examples/z_pub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ int main(int argc, char **argv) {
z_owned_config_t config;
z_config_default(&config);

// A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm` to operate
// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}

if (argc > 4) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[4]) < 0) {
printf(
Expand Down
11 changes: 0 additions & 11 deletions examples/z_pub_shm_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ int main(int argc, char **argv) {
z_owned_config_t config;
z_config_default(&config);

// A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm` to operate
// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}

if (argc > 2) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[2]) < 0) {
printf(
Expand Down
10 changes: 0 additions & 10 deletions examples/z_queryable_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ int main(int argc, char **argv) {
}
}

// A probing procedure for shared memory is performed upon session opening. To operate over shared memory
// (and to not fallback on network mode), shared memory needs to be enabled in the configuration.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}

printf("Opening session...\n");
z_owned_session_t s;
if (z_open(&s, z_move(config))) {
Expand Down
13 changes: 0 additions & 13 deletions examples/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ int main(int argc, char **argv) {
z_owned_config_t config;
z_config_default(&config);

#ifdef SHARED_MEMORY
// A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm` to operate
// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}
#endif

if (argc > 2) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, argv[2]) < 0) {
printf(
Expand Down
13 changes: 0 additions & 13 deletions examples/z_sub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,6 @@ int main(int argc, char **argv) {
z_owned_config_t config;
z_config_default(&config);

#ifdef SHARED_MEMORY
// A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm` to operate
// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}
#endif

if (argc > 2) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, argv[2]) < 0) {
printf(
Expand Down
12 changes: 0 additions & 12 deletions examples/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ int main(int argc, char **argv) {
z_owned_config_t config;
z_config_default(&config);

#ifdef SHARED_MEMORY
// A probing procedure for shared memory is performed upon session opening. To operate over shared memory
// (and to not fallback on network mode), shared memory needs to be enabled in the configuration.
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_SHARED_MEMORY_KEY, "true") < 0) {
printf(
"Couldn't insert value `true` in configuration at `%s`. This is likely because `%s` expects a "
"JSON-serialized value\n",
Z_CONFIG_SHARED_MEMORY_KEY, Z_CONFIG_SHARED_MEMORY_KEY);
exit(-1);
}
#endif

if (argc > 1) {
if (zc_config_insert_json(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[1]) < 0) {
printf(
Expand Down

0 comments on commit 3b506d3

Please sign in to comment.