[ 
https://issues.apache.org/jira/browse/TS-4518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15348676#comment-15348676
 ] 

ASF GitHub Bot commented on TS-4518:
------------------------------------

Github user zwoop commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/736#discussion_r68465162
  
    --- Diff: proxy/InkAPI.cc ---
    @@ -8941,3 +8942,110 @@ TSVConnReenable(TSVConn vconn)
         }
       }
     }
    +
    +// APIs for managing and using UUIDs.
    +TSUuid
    +TSUuidCreate(void)
    +{
    +  ATSUuid *uuid = new ATSUuid();
    +  return (TSUuid)uuid;
    +}
    +
    +TSReturnCode
    +TSUuidDestroy(TSUuid uuid)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive()) {
    +    delete u;
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSReturnCode
    +TSUuidCopy(TSUuid dest, const TSUuid src)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)dest) == TS_SUCCESS);
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)src) == TS_SUCCESS);
    +
    +  ATSUuid *d = (ATSUuid *)dest;
    +  ATSUuid *s = (ATSUuid *)src;
    +
    +  if (d->alive() && s->alive() && s->valid()) {
    +    *d = *s;
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSReturnCode
    +TSUuidInitialize(TSUuid uuid, TSUuidVersion v)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive()) {
    +    u->initialize(v);
    +    return u->valid() ? TS_SUCCESS : TS_ERROR;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +const TSUuid
    +TSProcessUuidGet(void)
    +{
    +  Machine *machine = Machine::instance();
    +  return (TSUuid)(&machine->uuid);
    +}
    +
    +const char *
    +TSUuidStringGet(const TSUuid uuid)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)(uuid);
    +
    +  if (u->alive() && u->valid()) {
    +    return u->getString();
    +  }
    +
    +  return NULL;
    +}
    +
    +TSReturnCode
    +TSUuidStringParse(TSUuid uuid, const char *str)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)str) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive() && u->parseString(str)) {
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSUuidVersion
    +TSUuidVersionGet(TSUuid uuid)
    +{
    --- End diff --
    
    Sanity check?


> UUID and HttpSM ID APIs and Machine support for a process UUID
> --------------------------------------------------------------
>
>                 Key: TS-4518
>                 URL: https://issues.apache.org/jira/browse/TS-4518
>             Project: Traffic Server
>          Issue Type: New Feature
>          Components: Core, TS API
>            Reporter: Leif Hedstrom
>            Assignee: Leif Hedstrom
>             Fix For: 7.0.0
>
>
> As was discussed on https://github.com/apache/trafficserver/pull/199, I've 
> started the work to generalize this, and breaking it up in various parts.
> This first Jira is about adding four things:
> 1) An internal process UUID, which goes into Machine. It's accessible from 
> the core.
> 2) An API to get this Machine UUID.
> 3) A set of generic UUID APIs, to do things like stringification, Copy() etc.
> 4) A very simple API that exposes the HttpSM's sequences number (sm_id).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to