Class WriteOptions

java.lang.Object
com.influxdb.v3.client.write.WriteOptions

@ThreadSafe public final class WriteOptions extends Object
Write options.

Supports to specify:

  • database - specifies the database to be used for InfluxDB operations
  • organization - specifies the organization to be used for InfluxDB operations
  • precision - specifies the precision to use for the timestamp of points
  • defaultTags - specifies tags to be added by default to all write operations using points.
  • Field Details

    • DEFAULT_WRITE_PRECISION

      public static final WritePrecision DEFAULT_WRITE_PRECISION
      Default WritePrecision.
    • DEFAULT_GZIP_THRESHOLD

      public static final Integer DEFAULT_GZIP_THRESHOLD
      Default GZIP threshold.
    • DEFAULTS

      public static final WriteOptions DEFAULTS
      Default WriteOptions.
  • Constructor Details

    • WriteOptions

      public WriteOptions(@Nonnull String database, @Nonnull WritePrecision precision, @Nonnull Integer gzipThreshold)
      Construct WriteAPI options.
      Parameters:
      database - The database to be used for InfluxDB operations.
      precision - The precision to use for the timestamp of points.
      gzipThreshold - The threshold for compressing request body.
    • WriteOptions

      public WriteOptions(@Nonnull String database, @Nonnull WritePrecision precision, @Nonnull Integer gzipThreshold, @Nonnull Map<String,String> defaultTags)
      Construct WriteAPI options.
      Parameters:
      database - The database to be used for InfluxDB operations.
      precision - The precision to use for the timestamp of points.
      gzipThreshold - The threshold for compressing request body.
      defaultTags - Default tags to be added when writing points.
  • Method Details

    • databaseSafe

      @Nullable public String databaseSafe(@Nonnull ClientConfig config)
      Parameters:
      config - with default value
      Returns:
      The destination database for writes.
    • precisionSafe

      @Nonnull public WritePrecision precisionSafe(@Nonnull ClientConfig config)
      Parameters:
      config - with default value
      Returns:
      Precision for unix timestamps in the line protocol of the request payload.
    • defaultTagsSafe

      @Nonnull public Map<String,String> defaultTagsSafe(@Nonnull ClientConfig config)
      Parameters:
      config - with/without defaultTags defined
      Returns:
      defaultTags - can be an empty map if none are defined.
    • gzipThresholdSafe

      @Nonnull public Integer gzipThresholdSafe(@Nonnull ClientConfig config)
      Parameters:
      config - with default value
      Returns:
      Payload size threshold for compressing it.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object