Commit 4308a673 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch 'amiranda/74-server_id-should-not-be-optional-in-adhoc_storage' into 'main'

Resolve "server_id should not be optional in adhoc_storage"

This MR makes the `server_id` member in adhoc_storage explicit. The rationale
is that constructors (for the C++ API) or `.*_create()` functions (for the C API)
will most of the time be called from internal code, since client code will rely
mostly on `ADM_register_.*()` to obtain handlers.

In this scenario, there's no possibility for the `server_id` "to not having been 
assigned yet", which is why it was `optional` in the first place.

Also, this MR renames the `user_id` to `name`, and the `server_id` to `id`.

Closes #74 #75

See merge request !51
parents c204fc30 13c5f9cb
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -68,11 +68,11 @@ main(int argc, char* argv[]) {
            100, false);
    assert(ctx);

    const char* user_id = "adhoc_storage_42";
    const char* name = "adhoc_storage_42";

    ADM_storage_t adhoc_storage;
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage);
            ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stdout, "ADM_register_adhoc_storage() remote procedure not "
+2 −2
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@ main(int argc, char* argv[]) {
            100, false);
    assert(ctx);

    const char* user_id = "adhoc_storage_42";
    const char* name = "adhoc_storage_42";

    ADM_storage_t adhoc_storage;
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage);
            ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stdout,
+2 −2
Original line number Diff line number Diff line
@@ -69,11 +69,11 @@ main(int argc, char* argv[]) {
            100, false);
    assert(ctx);

    const char* user_id = "adhoc_storage_42";
    const char* name = "adhoc_storage_42";

    ADM_storage_t adhoc_storage;
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage);
            ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stdout,
+2 −2
Original line number Diff line number Diff line
@@ -60,11 +60,11 @@ main(int argc, char* argv[]) {
            100, false);
    assert(ctx);

    const char* user_id = "adhoc_storage_42";
    const char* name = "adhoc_storage_42";

    ADM_storage_t adhoc_storage;
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage);
            ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stdout,
+2 −2
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@ main(int argc, char* argv[]) {
            100, false);
    assert(ctx);

    const char* user_id = "adhoc_storage_42";
    const char* name = "adhoc_storage_42";

    ADM_storage_t adhoc_storage;
    ADM_return_t ret =
            ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage);
            ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage);

    if(ret != ADM_SUCCESS) {
        fprintf(stdout,
Loading