Skip to content

Commit

Permalink
Merge pull request #657 from nats-io/lev-microservice-proto-noschema
Browse files Browse the repository at this point in the history
Removed the never-implemented schema
  • Loading branch information
levb authored May 22, 2023
2 parents 44a4652 + 843fd8a commit d6f3747
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 74 deletions.
1 change: 0 additions & 1 deletion examples/micro-sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ int main(int argc, char **argv)
.Subject = "sequence",
.Name = "sequence-service",
.Handler = handle_sequence,
.Schema = NULL,
};
microServiceConfig cfg = {
.Description = "Sequence adder - NATS microservice example in C",
Expand Down
40 changes: 0 additions & 40 deletions src/micro_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,44 +305,6 @@ bool micro_is_valid_subject(const char *subject)
return true;
}

static inline void
destroy_schema(microSchema *schema)
{
if (schema == NULL)
return;

NATS_FREE((char *)schema->Request);
NATS_FREE((char *)schema->Response);
NATS_FREE(schema);
}

static microError *
clone_schema(microSchema **to, const microSchema *from)
{
microError *err = NULL;
if (from == NULL)
{
*to = NULL;
return NULL;
}

*to = NATS_CALLOC(1, sizeof(microSchema));
if (*to == NULL)
return micro_ErrorOutOfMemory;

MICRO_CALL(err, micro_strdup((char **)&((*to)->Request), from->Request));
MICRO_CALL(err, micro_strdup((char **)&((*to)->Response), from->Response));

if (err != NULL)
{
destroy_schema(*to);
*to = NULL;
return err;
}

return NULL;
}

static inline microError *
new_endpoint_config(microEndpointConfig **ptr)
{
Expand Down Expand Up @@ -373,7 +335,6 @@ micro_clone_endpoint_config(microEndpointConfig **out, microEndpointConfig *cfg)

MICRO_CALL(err, micro_strdup((char **)&new_cfg->Name, cfg->Name));
MICRO_CALL(err, micro_strdup((char **)&new_cfg->Subject, cfg->Subject));
MICRO_CALL(err, clone_schema(&new_cfg->Schema, cfg->Schema));

if (err != NULL)
{
Expand All @@ -395,7 +356,6 @@ void micro_free_cloned_endpoint_config(microEndpointConfig *cfg)
NATS_FREE((char *)cfg->Name);
NATS_FREE((char *)cfg->Subject);

destroy_schema(cfg->Schema);
NATS_FREE(cfg);
}

Expand Down
4 changes: 0 additions & 4 deletions src/microp.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@

#define MICRO_DEFAULT_ENDPOINT_NAME "default"

// 4 verbs: INFO, STATS, PING, SCHEMA;
// 3 subjects for each verb.
#define MICRO_MONITORING_SUBS_CAP (4 * 3)

struct micro_error_s
{
bool is_internal;
Expand Down
29 changes: 0 additions & 29 deletions src/nats.h
Original file line number Diff line number Diff line change
Expand Up @@ -7220,11 +7220,6 @@ typedef struct micro_group_s microGroup;
*/
typedef struct micro_request_s microRequest;

/**
* The Microservice endpoint schema object.
*/
typedef struct micro_schema_s microSchema;

/**
* @brief the main object for a configured microservice.
*
Expand Down Expand Up @@ -7346,11 +7341,6 @@ struct micro_endpoint_config_s
*/
const char *Subject;

/**
* @brief The endpoint schema.
*/
microSchema *Schema;

/**
* @brief The request handler for the endpoint.
*/
Expand Down Expand Up @@ -7403,15 +7393,6 @@ struct micro_endpoint_stats_s
char LastErrorString[2048];
};

/**
* @brief The Microservice endpoint schema object.
*/
struct micro_schema_s
{
const char *Request;
const char *Response;
};

/**
* @brief The Microservice top-level configuration object.
*
Expand Down Expand Up @@ -7593,16 +7574,6 @@ struct micro_service_stats_s
*/
#define MICRO_PING_VERB "PING"

/**
* @brief The `type` set in the `$SRV.SCHEMA` response.
*/
#define MICRO_STATS_SCHEMA_TYPE "io.nats.micro.v1.schema_response"

/**
* @brief For `$SRV.SCHEMA` subjects.
*/
#define MICRO_SCHEMA_VERB "SCHEMA"

/**
* @brief The `type` set in the `STATS` response.
*/
Expand Down

0 comments on commit d6f3747

Please sign in to comment.