GithubHelp home page GithubHelp logo

Comments (2)

mariomastrodicasa avatar mariomastrodicasa commented on May 29, 2024

@marcocappolimases as stated in #21 (comment), you are proposing a method which can accept negative values. The same approach can be applied to the Seek method proposed in this issue. One drawback with the actual implementation of Seek with negative values is that backends (librdkafka, OpenDDS) uses negative values for their internal purposes and specific negative values have well-known behavior. Since real offsets are positive monotonic incremental values and negative values are only special, I propose to change the signature of the Seek to add an optional parameter which defines if the offset is Absolute or Relative, so it is possible to distinguish when a negative value refers to something in the past of the data stream or it is a special value. The same behavior can be applied to the Seek method that accepts a timestamp.
In the issue you proposed a DateTme type which is undoubtedly related to .NET (C#). Both C# and Java implementations are wrappers around the C++ implementation: in #21 (comment) there is a proposal about timestamp, but the low layer measures the timestamp as milliseconds from epoch (UTC) and the base type is something similar to the offset one. At C++ level the problem will be to distinguish between Seek method for offset and timestamp: my idea to solve this inchoerence is to add another optional parameter which defines which kind of input is receiving the Seek method. The final signature will be something like the following one:

typedef enum class DDM_SEEKCONTEXT
{
	OFFSET = 0x1,	   /**< Seek on offset */
	TIMESTAMP = 0x2,   /**< Seek on timestamp */
} DDM_SEEKCONTEXT;

typedef enum class DDM_SEEKKIND
{
	ABSOLUTE = 0x1,	   /**< Absolute seek */
	RELATIVE = 0x2,   /**< Relative seek */
} DDM_SEEKKIND;

virtual OPERATION_RESULT SeekChannel(CHANNEL_HANDLE_PARAMETER, int64_t position, DDM_SEEKCONTEXT context = DDM_SEEKCONTEXT::OFFSET, DDM_SEEKKIND kind = DDM_SEEKKIND::ABSOLUTE) = 0;

The previous implementation will be open for further extensions, adding more values to DDM_SEEKCONTEXT and DDM_SEEKKIND, without changing again the low level interface.

from datadistributionmanager.

marcocappolimases avatar marcocappolimases commented on May 29, 2024

@mariomastrodicasa the solution seems optimal for C++.
I think that the implementation I proposed in the Issue can be used to call transparently both an absolute or a relative seek.

from datadistributionmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.