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

commonMain.com.atproto.sync.subscribeReposCommit.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION")

package com.atproto.sync

import kotlin.Boolean
import kotlin.ByteArray
import kotlin.Deprecated
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlinx.serialization.Serializable
import kotlinx.serialization.cbor.ByteString
import sh.christian.ozone.api.Did
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.model.Timestamp

/**
 * Represents an update of repository state. Note that empty commits are allowed, which include no
 * repo data changes, but an update to rev and signature.
 *
 * @param seq The stream sequence number of this message.
 * @param tooBig Indicates that this commit contained too many ops, or data size was too large.
 * Consumers will need to make a separate request to get missing data.
 * @param repo The repo this event comes from.
 * @param commit Repo commit object CID.
 * @param rev The rev of the emitted commit. Note that this information is also in the commit object
 * included in blocks, unless this is a tooBig event.
 * @param since The rev of the last emitted commit from this repo (if any).
 * @param blocks CAR file containing relevant blocks, as a diff since the previous repo state.
 * @param time Timestamp of when this message was originally broadcast.
 */
@Serializable
public data class SubscribeReposCommit(
  /**
   * The stream sequence number of this message.
   */
  public val seq: Long,
  @Deprecated("DEPRECATED -- unused")
  public val rebase: Boolean,
  /**
   * Indicates that this commit contained too many ops, or data size was too large. Consumers will
   * need to make a separate request to get missing data.
   */
  public val tooBig: Boolean,
  /**
   * The repo this event comes from.
   */
  public val repo: Did,
  /**
   * Repo commit object CID.
   */
  @ByteString
  public val commit: ByteArray,
  @Deprecated("DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability.")
  @ByteString
  public val prev: ByteArray? = null,
  /**
   * The rev of the emitted commit. Note that this information is also in the commit object included
   * in blocks, unless this is a tooBig event.
   */
  public val rev: String,
  /**
   * The rev of the last emitted commit from this repo (if any).
   */
  public val since: String? = null,
  /**
   * CAR file containing relevant blocks, as a diff since the previous repo state.
   */
  @ByteString
  public val blocks: ByteArray,
  public val ops: ReadOnlyList,
  @ByteString
  public val blobs: ReadOnlyList,
  /**
   * Timestamp of when this message was originally broadcast.
   */
  public val time: Timestamp,
) {
  init {
    require(blocks.count() <= 1_000_000) {
      "blocks.count() must be <= 1_000_000, but was ${blocks.count()}"
    }
    require(ops.count() <= 200) {
      "ops.count() must be <= 200, but was ${ops.count()}"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy