//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
// @generated from file protos/perfetto/common/commit_data_request.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/common/commit_data_request.proto.
 */
export const file_protos_perfetto_common_commit_data_request: GenFile = /*@__PURE__*/
  fileDesc("CjBwcm90b3MvcGVyZmV0dG8vY29tbW9uL2NvbW1pdF9kYXRhX3JlcXVlc3QucHJvdG8SD3BlcmZldHRvLnByb3RvcyLoAwoRQ29tbWl0RGF0YVJlcXVlc3QSRwoOY2h1bmtzX3RvX21vdmUYASADKAsyLy5wZXJmZXR0by5wcm90b3MuQ29tbWl0RGF0YVJlcXVlc3QuQ2h1bmtzVG9Nb3ZlEkgKD2NodW5rc190b19wYXRjaBgCIAMoCzIvLnBlcmZldHRvLnByb3Rvcy5Db21taXREYXRhUmVxdWVzdC5DaHVua1RvUGF0Y2gSGAoQZmx1c2hfcmVxdWVzdF9pZBgDIAEoBBpQCgxDaHVua3NUb01vdmUSDAoEcGFnZRgBIAEoDRINCgVjaHVuaxgCIAEoDRIVCg10YXJnZXRfYnVmZmVyGAMgASgNEgwKBGRhdGEYBCABKAwa0wEKDENodW5rVG9QYXRjaBIVCg10YXJnZXRfYnVmZmVyGAEgASgNEhEKCXdyaXRlcl9pZBgCIAEoDRIQCghjaHVua19pZBgDIAEoDRJGCgdwYXRjaGVzGAQgAygLMjUucGVyZmV0dG8ucHJvdG9zLkNvbW1pdERhdGFSZXF1ZXN0LkNodW5rVG9QYXRjaC5QYXRjaBIYChBoYXNfbW9yZV9wYXRjaGVzGAUgASgIGiUKBVBhdGNoEg4KBm9mZnNldBgBIAEoDRIMCgRkYXRhGAIgASgM");

/**
 * @generated from message perfetto.protos.CommitDataRequest
 */
export type CommitDataRequest = Message<"perfetto.protos.CommitDataRequest"> & {
  /**
   * @generated from field: repeated perfetto.protos.CommitDataRequest.ChunksToMove chunks_to_move = 1;
   */
  chunksToMove: CommitDataRequest_ChunksToMove[];

  /**
   * @generated from field: repeated perfetto.protos.CommitDataRequest.ChunkToPatch chunks_to_patch = 2;
   */
  chunksToPatch: CommitDataRequest_ChunkToPatch[];

  /**
   * Optional. If this commit is made in response to a Flush(id) request coming
   * from the service, copy back the id of the request so the service can tell
   * when the flush happened.
   *
   * @generated from field: optional uint64 flush_request_id = 3;
   */
  flushRequestId: bigint;
};

/**
 * Describes the message perfetto.protos.CommitDataRequest.
 * Use `create(CommitDataRequestSchema)` to create a new message.
 */
export const CommitDataRequestSchema: GenMessage<CommitDataRequest> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_commit_data_request, 0);

/**
 * When |chunks_to_move| is present, the producer is requesting the service to
 * move the given chunks form the share memory buffer into the central
 * trace buffer(s).
 *
 * @generated from message perfetto.protos.CommitDataRequest.ChunksToMove
 */
export type CommitDataRequest_ChunksToMove = Message<"perfetto.protos.CommitDataRequest.ChunksToMove"> & {
  /**
   * The 0-based index of the page in the Shared Memory Buffer.
   *
   * @generated from field: optional uint32 page = 1;
   */
  page: number;

  /**
   * The 0-based chunk index [0..13] within the page.
   *
   * @generated from field: optional uint32 chunk = 2;
   */
  chunk: number;

  /**
   * The target buffer it should be moved onto. The service will check that
   * the producer is allowed to write into that buffer before the move.
   *
   * @generated from field: optional uint32 target_buffer = 3;
   */
  targetBuffer: number;

  /**
   * Sending the chunk data over the wire. Used for transports that don't
   * support shared memory (e.g. vsock or TCP sockets). In the default case
   * (tracing protocol over a Unix socket), this field is not used and tracing
   * data is stored in the shmem buffer and referenced by the fields above.
   * See |use_shemem_emulation| in the codebase for reference.
   *
   * @generated from field: optional bytes data = 4;
   */
  data: Uint8Array;
};

/**
 * Describes the message perfetto.protos.CommitDataRequest.ChunksToMove.
 * Use `create(CommitDataRequest_ChunksToMoveSchema)` to create a new message.
 */
export const CommitDataRequest_ChunksToMoveSchema: GenMessage<CommitDataRequest_ChunksToMove> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_commit_data_request, 0, 0);

/**
 * Used to patch chunks that have already been sent to the service. The chunk
 * might not be in the shared memory buffer anymore as it could have been
 * moved by the service in response to a prior CommitDataRequest.
 * It is perfectly valid to patch a chunk that is being notified in the same
 * message (a chunk can show up both in the |changed_pages| and |patches|
 * field within the same CommitDataRequest message).
 * In other words, |chunks_to_patch| is always processed after
 * |chunks_to_move|.
 *
 * @generated from message perfetto.protos.CommitDataRequest.ChunkToPatch
 */
export type CommitDataRequest_ChunkToPatch = Message<"perfetto.protos.CommitDataRequest.ChunkToPatch"> & {
  /**
   * @generated from field: optional uint32 target_buffer = 1;
   */
  targetBuffer: number;

  /**
   * {WriterID, ChunkID} uniquely identify a chunk for the current producer.
   *
   * @generated from field: optional uint32 writer_id = 2;
   */
  writerId: number;

  /**
   * @generated from field: optional uint32 chunk_id = 3;
   */
  chunkId: number;

  /**
   * List of patches to apply to the given chunk.
   *
   * @generated from field: repeated perfetto.protos.CommitDataRequest.ChunkToPatch.Patch patches = 4;
   */
  patches: CommitDataRequest_ChunkToPatch_Patch[];

  /**
   * When true more patches will follow in future requests and the chunk
   * should be still considered as patch-pending. When false the chunk becomes
   * eligible for reading.
   *
   * @generated from field: optional bool has_more_patches = 5;
   */
  hasMorePatches: boolean;
};

/**
 * Describes the message perfetto.protos.CommitDataRequest.ChunkToPatch.
 * Use `create(CommitDataRequest_ChunkToPatchSchema)` to create a new message.
 */
export const CommitDataRequest_ChunkToPatchSchema: GenMessage<CommitDataRequest_ChunkToPatch> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_commit_data_request, 0, 1);

/**
 * @generated from message perfetto.protos.CommitDataRequest.ChunkToPatch.Patch
 */
export type CommitDataRequest_ChunkToPatch_Patch = Message<"perfetto.protos.CommitDataRequest.ChunkToPatch.Patch"> & {
  /**
   * Offset in bytes from the start of the chunk payload. e.g., offset == 0
   * corresponds to the first byte of the first packet (or fragment) in the
   * chunk.
   *
   * @generated from field: optional uint32 offset = 1;
   */
  offset: number;

  /**
   * Bytes to patch at the given offset.
   *
   * @generated from field: optional bytes data = 2;
   */
  data: Uint8Array;
};

/**
 * Describes the message perfetto.protos.CommitDataRequest.ChunkToPatch.Patch.
 * Use `create(CommitDataRequest_ChunkToPatch_PatchSchema)` to create a new message.
 */
export const CommitDataRequest_ChunkToPatch_PatchSchema: GenMessage<CommitDataRequest_ChunkToPatch_Patch> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_common_commit_data_request, 0, 1, 0);

