Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign of InputSpan and OutputSpan #439

Open
drslebedev opened this issue Oct 8, 2024 · 0 comments
Open

Redesign of InputSpan and OutputSpan #439

drslebedev opened this issue Oct 8, 2024 · 0 comments

Comments

@drslebedev
Copy link
Contributor

drslebedev commented Oct 8, 2024

Description:

InputSpan and OutputSpan classes maintain internal states (e.g., tagsPublished) that are unique to each instance and not shared among different instances. Copying these objects without proper state management can lead to incorrect behavior when methods like publishTag() are called.

For example, in the processBulk function, when InputSpan or OutputSpan objects are passed by value, their internal states are copied. This can result in inconsistent or unintended behavior due to the duplication of state information. While processBulk illustrates the problem, the underlying issue is broader: we need to avoid scenarios where internal states are copied for each instance.

Questions:

  • Should we move all internal state members to CircularBuffer::Reader and CircularBuffer::Writer?

    • Centralizing the internal states within the Reader and Writer makes all states shareable between instances.
  • Should we prevent copying of InputSpan and OutputSpan to enforce proper state management? AND Should we disallow obtaining spans several times without ensuring that consume() or publish() methods are called?

    • By deleting or disabling copy constructors and copy assignment operators, we can ensure that instances cannot be copied. + there are no 2 instances which point to the same span of data, could ensure that state changes occur in a controlled manner.

Note: This issue highlights the need for careful handling of internal states within InputSpan and OutputSpan to prevent incorrect behavior due to improper copying or state sharing. Feedback and suggestions on the proposed questions and action items are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant