You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Steve Huston (JIRA)" <qp...@incubator.apache.org> on 2008/10/09 17:56:44 UTC

[jira] Created: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Allow multiple platforms differences in C++ broker, client code
---------------------------------------------------------------

                 Key: QPID-1338
                 URL: https://issues.apache.org/jira/browse/QPID-1338
             Project: Qpid
          Issue Type: Improvement
          Components: C++ Broker, C++ Client
            Reporter: Steve Huston
            Priority: Minor


This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:

1. Broker code (cpp/src/qpid/broker)
2. Client code (cpp/src/qpid/client)
3. Supporting code which may be common to both (cpp/src/qpid/sys)

The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.

The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:

1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.

2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.

Up to now the approach has been this:

- When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
- When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
- When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp

Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Posted by "Rafael H. Schloming (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rafael H. Schloming updated QPID-1338:
--------------------------------------

    Affects Version/s: M4

> Allow multiple platforms differences in C++ broker, client code
> ---------------------------------------------------------------
>
>                 Key: QPID-1338
>                 URL: https://issues.apache.org/jira/browse/QPID-1338
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>    Affects Versions: M4
>            Reporter: Steve Huston
>            Priority: Minor
>         Attachments: broker.diff
>
>
> This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:
> 1. Broker code (cpp/src/qpid/broker)
> 2. Client code (cpp/src/qpid/client)
> 3. Supporting code which may be common to both (cpp/src/qpid/sys)
> The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.
> The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:
> 1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.
> 2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.
> Up to now the approach has been this:
> - When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
> - When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
> - When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp
> Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Huston resolved QPID-1338.
--------------------------------

       Resolution: Fixed
    Fix Version/s: M4

The Windows-specific upper-level broker pieces are now in the svn repo; svn revision 709271

> Allow multiple platforms differences in C++ broker, client code
> ---------------------------------------------------------------
>
>                 Key: QPID-1338
>                 URL: https://issues.apache.org/jira/browse/QPID-1338
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>    Affects Versions: M4
>            Reporter: Steve Huston
>            Priority: Minor
>             Fix For: M4
>
>         Attachments: broker.diff
>
>
> This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:
> 1. Broker code (cpp/src/qpid/broker)
> 2. Client code (cpp/src/qpid/client)
> 3. Supporting code which may be common to both (cpp/src/qpid/sys)
> The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.
> The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:
> 1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.
> 2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.
> Up to now the approach has been this:
> - When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
> - When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
> - When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp
> Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Posted by "Alan Conway (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643305#action_12643305 ] 

Alan Conway commented on QPID-1338:
-----------------------------------

I think the broker.diff changes look reasonable for M4. I don't think it conforms fully to the Qpid C++ porting strategy, mainly because there isn't one :) So Id go ahead and commit and clean things up as we define our strategy. I'm not averse to using either platform subdirectories or file name suffixes like qpidd_posix but I'm not keen on doing both. Since we already have more use of dirs than suffixes maybe qpidd deserves  its own windows/posix directories for consistency.

Here's my general notion for platform code, it is based on a successful  model from a past life but I'm open to discussion:

I think there are 2 complementary approaches to  platform-specific code. 

1. The "qpid platform" a set of classes under sys that provide absractions for all the OS services, system calls etc. we need.. These are things like Mutex, Thread, Poller etc. 
2. Per-platform plug-ins: this is where the Qpid architecture defines an interface with many impls, some of those impls being unique to particular platforms.

To take the broker example, the main issues are 
a. creating a background daemon/service process
b. different types of logging on win/unix
c. different broker options due to a & b.

I think a. belongs in sys:  a general-purpose qpid::sys::BackgroundProcess class or something of that nature, on top of which qpidd can be built.

b.  looks more like it should be a plug-in:  a qpid::log::Output abstract base that has multiple implementations, all of which register in the same way with the Logger::instance. Some of these plugins would be portable (OstreamOutput) and some platform specific (SyslogOutput, WindowsEventOutput). 

c. Where the same or very similar functionality exists on all platforms, we should use the same options across the board. E.g. --daemon should be the same on all platforms (if people feel strongly that daemon is a unixism we can find a more neutral name like --background or --service, the point is the option is generic)  For things that only exist on specific platforms we should extend the plug-in framework so that the relevant options can be supplied when the plug in registers. E.g. syslog and windows eventlog plugins should register their own options.

All of the above implies some refactoring, but nothing drastic - a gentle evolution into a more portable world.


> Allow multiple platforms differences in C++ broker, client code
> ---------------------------------------------------------------
>
>                 Key: QPID-1338
>                 URL: https://issues.apache.org/jira/browse/QPID-1338
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>            Reporter: Steve Huston
>            Priority: Minor
>         Attachments: broker.diff
>
>
> This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:
> 1. Broker code (cpp/src/qpid/broker)
> 2. Client code (cpp/src/qpid/client)
> 3. Supporting code which may be common to both (cpp/src/qpid/sys)
> The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.
> The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:
> 1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.
> 2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.
> Up to now the approach has been this:
> - When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
> - When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
> - When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp
> Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Huston updated QPID-1338:
-------------------------------

    Attachment: broker.diff

The attached broker.diff gets the remaining piece of platform-specific broker code split out. This is done a bit differently in that platform-specific code from cpp/src/qpidd.cpp is split into cpp/src/qpidd_posix.cpp rather than make another directory. This is for two reasons:

1. There's only one file. Seems a bit overkill to make a new directory for one file.
2. The CONF_FILE and MODULE_DIR macros are currently set on the compiler's command-line options with different values for qpidd and libqpidclient. Simply adding one more file to qpidd's sources keeps this arrangement.

Any feedback is welcome. I would like this to go in M4 if at all possible.

> Allow multiple platforms differences in C++ broker, client code
> ---------------------------------------------------------------
>
>                 Key: QPID-1338
>                 URL: https://issues.apache.org/jira/browse/QPID-1338
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>            Reporter: Steve Huston
>            Priority: Minor
>         Attachments: broker.diff
>
>
> This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:
> 1. Broker code (cpp/src/qpid/broker)
> 2. Client code (cpp/src/qpid/client)
> 3. Supporting code which may be common to both (cpp/src/qpid/sys)
> The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.
> The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:
> 1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.
> 2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.
> Up to now the approach has been this:
> - When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
> - When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
> - When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp
> Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-1338) Allow multiple platforms differences in C++ broker, client code

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643627#action_12643627 ] 

Steve Huston commented on QPID-1338:
------------------------------------

Thanks for the feedback, Alan.

I created qpid/cpp/src/posix and windows directories to make things consistent with the other places platform-specific code is placed.
This is committed in svn revision 708991.

Re some of your specific comments:

- The general background process abstraction does exist in sys::Daemon - the posix broker code is derived from it to add the specific parent/child processing. On Windows there is no fork(), so this type of child/parent doesn't exist.

- The logging differences are factored out... I could be unclear on what a "plugin" means... I think of it as a separate dll/lib that gets loaded at runtime. The logging isn't structured like that for posix/windows, but there are different specific sets of options that are brought in at compile time.

- I agree that same/similar functionality exists it should be common (even if implemented differently). The example of a Windows service, though, is probably not in this category, but I agree with the premise. 

So I think we're in good shape here for M4, but if you think more needs to be addressed for M4, please let me know.
Thanks,
-Steve

> Allow multiple platforms differences in C++ broker, client code
> ---------------------------------------------------------------
>
>                 Key: QPID-1338
>                 URL: https://issues.apache.org/jira/browse/QPID-1338
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>    Affects Versions: M4
>            Reporter: Steve Huston
>            Priority: Minor
>         Attachments: broker.diff
>
>
> This is in the context of adding Windows support to the C++ broker and client. There are currently 3 places where platform differences may arise:
> 1. Broker code (cpp/src/qpid/broker)
> 2. Client code (cpp/src/qpid/client)
> 3. Supporting code which may be common to both (cpp/src/qpid/sys)
> The current general approach as I've been advised and encouraged by Andrew Stitcher, primarily while working on the supporting (cpp/src/qpid/sys) level code such as the I/O system is to define a common interface in a header file (such as in cpp/src/qpid/sys) and then implement the class(es) differently in platform-specific sources which reside in cpp/src/qpid/sys/posix, cpp/src/qpid/sys/windows. This has been working well.
> The other two places, however, cpp/src/qpid/broker and cpp/src/qpid/client, don't current have platform-specific subdirectories since to this point, all the platform differences have successfully been pushed down to cpp/src/qpid/sys. However, adding a platform quite different from Linux has forced this issue up a level and we now need to come up with a way to handle platform differences at the broker and client level. This is arising in 2 different types of situations:
> 1. Areas such as logging classes, where the options and capabilities are not the same across platforms. For example, syslog doesn't make sense on Windows, where logging to the event log would. Simply equating the two doesn't work since there are different related options. Many options are common. Broker authentication is another area - Windows doesn't provide Cyrus sasl - it uses other functions.
> 2. Situations where the features are the same, but in order to bring in platform different code at the I/O layer, a source file is copied and edited slightly to bring in a different lower layer. This is the situation in the client where the Connector.cpp is copied to WinConnector.cpp to bring in the Windows asynch I/O code.
> Up to now the approach has been this:
> - When doing something platform-dependent in cpp/src/qpid/sys, add platform diffs in cpp/src/qpid/sys/<platform>
> - When doing something platform-dependent in cpp/src/qpid/log, add platform diffs in cpp/src/qpid/log/<platform>
> - When doing something platform-dependent in cpp/src/qpid/broker, or cpp/src/qpid/client, use a file name of the form <platform>File.cpp
> Would it be more appropriate to create platform-specific directories under cpp/src/qpid/broker and .../client? Or stick with the current method? I favor the new directories, but am open to ideas.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.