You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Benjamin Bannier (JIRA)" <ji...@apache.org> on 2016/08/16 14:10:20 UTC

[jira] [Comment Edited] (MESOS-5797) Use shared_ptr instead of raw pointer for mesos::Authorizer in slave and master initialization.

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

Benjamin Bannier edited comment on MESOS-5797 at 8/16/16 2:10 PM:
------------------------------------------------------------------

It doesn't look as if {{Slave}} manages the the lifetime of the passed {{Authorizer}} at all, so I am not sure we would need a {{shared_ptr}} here (also, stout has just a {{shared_ptr}} to {{const}} for a reason, namely anything else is mutable, effectively global state which is not easy to reason about).

To me it looks like we use an {{Option<T*>}} just so we can store polymorphic {{T}} (storing just a {{T}} would slice). It seems we should use a coherent pattern for {{Options}} of references (not managing lifetimes), and there are some ongoing discussions here.

cc [~mcypark] [~bmahler]


was (Author: bbannier):
It doesn't look as if {{Slave}} manages the the lifetime of the passed {{Authorizer}} at all, so I am not sure we would need a {{shared_ptr}} here (also, stout has just a {{shared_ptr}} to {{const}} for a reason, namely anything is mutable, effectively global state which is not easy to reason about).

To me it looks like we use an {{Option<T*>}} just so we can store polymorphic {{T}} (storing just a {{T}} would slice). It seems like we should use a coherent pattern for {{Option}}s of references (not managing lifetimes), and there are some ongoing discussions here.

cc [~mcypark] [~bmahler]

> Use shared_ptr instead of raw pointer for mesos::Authorizer in slave and master initialization.
> -----------------------------------------------------------------------------------------------
>
>                 Key: MESOS-5797
>                 URL: https://issues.apache.org/jira/browse/MESOS-5797
>             Project: Mesos
>          Issue Type: Bug
>          Components: general
>            Reporter: Abhishek Dasgupta
>            Assignee: Abhishek Dasgupta
>
> Like in slave.hpp, to initialize Slave instance, we are using "const Option<Authorizer*>& authorizer" raw pointer. Instead of a raw pointer, we may use shared_ptr here as this pointer might be shared among other objects also to support authorization in those. 
> Similarly, it can be done for master initialization also.



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