Skip to content

Better way to construct time/duration values? #90

Open
@fredy-scs

Description

@fredy-scs

I am trying to create a point-in-time (code is in Kotlin)

client.openPointInTime { builder ->
      builder.index(index)
          .keepAlive { timeBuilder -> timeBuilder.time("5m") }
  }

As can be seen, I have to specify the time and the unit as part of a string. This is neither very elegant nor type safe. Is this currently the only way to set these time values or am I missing something?

The old high-level client accepted a TimeValue, which was both a long and an associated TimeUnit. However, while the new client seems to also have TimeUnit class, it seems to be entirely disconnected from the Time class.
The only usage of TimeUnit I can find is in the DiskUsageRequest, but it seems to be used incorrectly there (TimeUnit does not contain a duration, but it tries to parse the timeout duration as a TimeUnit).

I also found a TimeBuilders class in the same package, but it is empty.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions