All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.app.cash.backfila.protos.clientservice.RunBatchRequest Maven / Gradle / Ivy

Go to download

Backfila is a service that manages backfill state, calling into other services to do batched work.

There is a newer version: 2024.10.28.205607-fab304f
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: app.cash.backfila.protos.clientservice.RunBatchRequest in app/cash/backfila/client_service.proto
package app.cash.backfila.protos.clientservice;

import com.squareup.wire.FieldEncoding;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import com.squareup.wire.ReverseProtoWriter;
import com.squareup.wire.Syntax;
import com.squareup.wire.WireField;
import com.squareup.wire.internal.Internal;
import java.io.IOException;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.Map;
import okio.ByteString;

public final class RunBatchRequest extends Message {
  public static final ProtoAdapter ADAPTER = new ProtoAdapter_RunBatchRequest();

  private static final long serialVersionUID = 0L;

  public static final String DEFAULT_BACKFILL_ID = "";

  public static final String DEFAULT_BACKFILL_NAME = "";

  public static final String DEFAULT_PARTITION_NAME = "";

  public static final Boolean DEFAULT_DRY_RUN = false;

  public static final Long DEFAULT_BATCH_SIZE = 0L;

  /**
   * A unique identifier for this backfill run.
   * Can be used as a caching key since backfill metadata is immutable after creation.
   */
  @WireField(
      tag = 1,
      adapter = "com.squareup.wire.ProtoAdapter#STRING"
  )
  public final String backfill_id;

  @WireField(
      tag = 2,
      adapter = "com.squareup.wire.ProtoAdapter#STRING"
  )
  public final String backfill_name;

  @WireField(
      tag = 3,
      adapter = "com.squareup.wire.ProtoAdapter#STRING"
  )
  public final String partition_name;

  @WireField(
      tag = 4,
      adapter = "app.cash.backfila.protos.clientservice.KeyRange#ADAPTER"
  )
  public final KeyRange batch_range;

  /**
   * User provided parameters at creation.
   */
  @WireField(
      tag = 5,
      keyAdapter = "com.squareup.wire.ProtoAdapter#STRING",
      adapter = "com.squareup.wire.ProtoAdapter#BYTES"
  )
  public final Map parameters;

  @WireField(
      tag = 6,
      adapter = "com.squareup.wire.ProtoAdapter#BOOL"
  )
  public final Boolean dry_run;

  /**
   * Provided data from the source backfill if this is the target backfill in a pipelined backfill.
   */
  @WireField(
      tag = 7,
      adapter = "app.cash.backfila.protos.clientservice.PipelinedData#ADAPTER"
  )
  public final PipelinedData pipelined_data;

  /**
   * Current batch size set for this backfill run. A backfila client may use choose to use this but
   * others may run the entire range. Consult your client implementations for exact behaviour.
   */
  @WireField(
      tag = 8,
      adapter = "com.squareup.wire.ProtoAdapter#UINT64"
  )
  public final Long batch_size;

  public RunBatchRequest(String backfill_id, String backfill_name, String partition_name,
      KeyRange batch_range, Map parameters, Boolean dry_run,
      PipelinedData pipelined_data, Long batch_size) {
    this(backfill_id, backfill_name, partition_name, batch_range, parameters, dry_run, pipelined_data, batch_size, ByteString.EMPTY);
  }

  public RunBatchRequest(String backfill_id, String backfill_name, String partition_name,
      KeyRange batch_range, Map parameters, Boolean dry_run,
      PipelinedData pipelined_data, Long batch_size, ByteString unknownFields) {
    super(ADAPTER, unknownFields);
    this.backfill_id = backfill_id;
    this.backfill_name = backfill_name;
    this.partition_name = partition_name;
    this.batch_range = batch_range;
    this.parameters = Internal.immutableCopyOf("parameters", parameters);
    this.dry_run = dry_run;
    this.pipelined_data = pipelined_data;
    this.batch_size = batch_size;
  }

  @Override
  public Builder newBuilder() {
    Builder builder = new Builder();
    builder.backfill_id = backfill_id;
    builder.backfill_name = backfill_name;
    builder.partition_name = partition_name;
    builder.batch_range = batch_range;
    builder.parameters = Internal.copyOf(parameters);
    builder.dry_run = dry_run;
    builder.pipelined_data = pipelined_data;
    builder.batch_size = batch_size;
    builder.addUnknownFields(unknownFields());
    return builder;
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof RunBatchRequest)) return false;
    RunBatchRequest o = (RunBatchRequest) other;
    return unknownFields().equals(o.unknownFields())
        && Internal.equals(backfill_id, o.backfill_id)
        && Internal.equals(backfill_name, o.backfill_name)
        && Internal.equals(partition_name, o.partition_name)
        && Internal.equals(batch_range, o.batch_range)
        && parameters.equals(o.parameters)
        && Internal.equals(dry_run, o.dry_run)
        && Internal.equals(pipelined_data, o.pipelined_data)
        && Internal.equals(batch_size, o.batch_size);
  }

  @Override
  public int hashCode() {
    int result = super.hashCode;
    if (result == 0) {
      result = unknownFields().hashCode();
      result = result * 37 + (backfill_id != null ? backfill_id.hashCode() : 0);
      result = result * 37 + (backfill_name != null ? backfill_name.hashCode() : 0);
      result = result * 37 + (partition_name != null ? partition_name.hashCode() : 0);
      result = result * 37 + (batch_range != null ? batch_range.hashCode() : 0);
      result = result * 37 + parameters.hashCode();
      result = result * 37 + (dry_run != null ? dry_run.hashCode() : 0);
      result = result * 37 + (pipelined_data != null ? pipelined_data.hashCode() : 0);
      result = result * 37 + (batch_size != null ? batch_size.hashCode() : 0);
      super.hashCode = result;
    }
    return result;
  }

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    if (backfill_id != null) builder.append(", backfill_id=").append(Internal.sanitize(backfill_id));
    if (backfill_name != null) builder.append(", backfill_name=").append(Internal.sanitize(backfill_name));
    if (partition_name != null) builder.append(", partition_name=").append(Internal.sanitize(partition_name));
    if (batch_range != null) builder.append(", batch_range=").append(batch_range);
    if (!parameters.isEmpty()) builder.append(", parameters=").append(parameters);
    if (dry_run != null) builder.append(", dry_run=").append(dry_run);
    if (pipelined_data != null) builder.append(", pipelined_data=").append(pipelined_data);
    if (batch_size != null) builder.append(", batch_size=").append(batch_size);
    return builder.replace(0, 2, "RunBatchRequest{").append('}').toString();
  }

  public static final class Builder extends Message.Builder {
    public String backfill_id;

    public String backfill_name;

    public String partition_name;

    public KeyRange batch_range;

    public Map parameters;

    public Boolean dry_run;

    public PipelinedData pipelined_data;

    public Long batch_size;

    public Builder() {
      parameters = Internal.newMutableMap();
    }

    /**
     * A unique identifier for this backfill run.
     * Can be used as a caching key since backfill metadata is immutable after creation.
     */
    public Builder backfill_id(String backfill_id) {
      this.backfill_id = backfill_id;
      return this;
    }

    public Builder backfill_name(String backfill_name) {
      this.backfill_name = backfill_name;
      return this;
    }

    public Builder partition_name(String partition_name) {
      this.partition_name = partition_name;
      return this;
    }

    public Builder batch_range(KeyRange batch_range) {
      this.batch_range = batch_range;
      return this;
    }

    /**
     * User provided parameters at creation.
     */
    public Builder parameters(Map parameters) {
      Internal.checkElementsNotNull(parameters);
      this.parameters = parameters;
      return this;
    }

    public Builder dry_run(Boolean dry_run) {
      this.dry_run = dry_run;
      return this;
    }

    /**
     * Provided data from the source backfill if this is the target backfill in a pipelined backfill.
     */
    public Builder pipelined_data(PipelinedData pipelined_data) {
      this.pipelined_data = pipelined_data;
      return this;
    }

    /**
     * Current batch size set for this backfill run. A backfila client may use choose to use this but
     * others may run the entire range. Consult your client implementations for exact behaviour.
     */
    public Builder batch_size(Long batch_size) {
      this.batch_size = batch_size;
      return this;
    }

    @Override
    public RunBatchRequest build() {
      return new RunBatchRequest(backfill_id, backfill_name, partition_name, batch_range, parameters, dry_run, pipelined_data, batch_size, super.buildUnknownFields());
    }
  }

  private static final class ProtoAdapter_RunBatchRequest extends ProtoAdapter {
    private ProtoAdapter> parameters;

    public ProtoAdapter_RunBatchRequest() {
      super(FieldEncoding.LENGTH_DELIMITED, RunBatchRequest.class, "type.googleapis.com/app.cash.backfila.protos.clientservice.RunBatchRequest", Syntax.PROTO_2, null, "app/cash/backfila/client_service.proto");
    }

    @Override
    public int encodedSize(RunBatchRequest value) {
      int result = 0;
      result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.backfill_id);
      result += ProtoAdapter.STRING.encodedSizeWithTag(2, value.backfill_name);
      result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.partition_name);
      result += KeyRange.ADAPTER.encodedSizeWithTag(4, value.batch_range);
      result += parametersAdapter().encodedSizeWithTag(5, value.parameters);
      result += ProtoAdapter.BOOL.encodedSizeWithTag(6, value.dry_run);
      result += PipelinedData.ADAPTER.encodedSizeWithTag(7, value.pipelined_data);
      result += ProtoAdapter.UINT64.encodedSizeWithTag(8, value.batch_size);
      result += value.unknownFields().size();
      return result;
    }

    @Override
    public void encode(ProtoWriter writer, RunBatchRequest value) throws IOException {
      ProtoAdapter.STRING.encodeWithTag(writer, 1, value.backfill_id);
      ProtoAdapter.STRING.encodeWithTag(writer, 2, value.backfill_name);
      ProtoAdapter.STRING.encodeWithTag(writer, 3, value.partition_name);
      KeyRange.ADAPTER.encodeWithTag(writer, 4, value.batch_range);
      parametersAdapter().encodeWithTag(writer, 5, value.parameters);
      ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.dry_run);
      PipelinedData.ADAPTER.encodeWithTag(writer, 7, value.pipelined_data);
      ProtoAdapter.UINT64.encodeWithTag(writer, 8, value.batch_size);
      writer.writeBytes(value.unknownFields());
    }

    @Override
    public void encode(ReverseProtoWriter writer, RunBatchRequest value) throws IOException {
      writer.writeBytes(value.unknownFields());
      ProtoAdapter.UINT64.encodeWithTag(writer, 8, value.batch_size);
      PipelinedData.ADAPTER.encodeWithTag(writer, 7, value.pipelined_data);
      ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.dry_run);
      parametersAdapter().encodeWithTag(writer, 5, value.parameters);
      KeyRange.ADAPTER.encodeWithTag(writer, 4, value.batch_range);
      ProtoAdapter.STRING.encodeWithTag(writer, 3, value.partition_name);
      ProtoAdapter.STRING.encodeWithTag(writer, 2, value.backfill_name);
      ProtoAdapter.STRING.encodeWithTag(writer, 1, value.backfill_id);
    }

    @Override
    public RunBatchRequest decode(ProtoReader reader) throws IOException {
      Builder builder = new Builder();
      long token = reader.beginMessage();
      for (int tag; (tag = reader.nextTag()) != -1;) {
        switch (tag) {
          case 1: builder.backfill_id(ProtoAdapter.STRING.decode(reader)); break;
          case 2: builder.backfill_name(ProtoAdapter.STRING.decode(reader)); break;
          case 3: builder.partition_name(ProtoAdapter.STRING.decode(reader)); break;
          case 4: builder.batch_range(KeyRange.ADAPTER.decode(reader)); break;
          case 5: builder.parameters.putAll(parametersAdapter().decode(reader)); break;
          case 6: builder.dry_run(ProtoAdapter.BOOL.decode(reader)); break;
          case 7: builder.pipelined_data(PipelinedData.ADAPTER.decode(reader)); break;
          case 8: builder.batch_size(ProtoAdapter.UINT64.decode(reader)); break;
          default: {
            reader.readUnknownField(tag);
          }
        }
      }
      builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
      return builder.build();
    }

    @Override
    public RunBatchRequest redact(RunBatchRequest value) {
      Builder builder = value.newBuilder();
      if (builder.batch_range != null) builder.batch_range = KeyRange.ADAPTER.redact(builder.batch_range);
      if (builder.pipelined_data != null) builder.pipelined_data = PipelinedData.ADAPTER.redact(builder.pipelined_data);
      builder.clearUnknownFields();
      return builder.build();
    }

    private ProtoAdapter> parametersAdapter() {
      ProtoAdapter> result = parameters;
      if (result == null) {
        result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.BYTES);
        parameters = result;
      }
      return result;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy