#[derive(Clone, PartialEq, Default)]
pub struct StoreDeltas {
pub store_deltas: ::buffa::alloc::vec::Vec<StoreDelta>,
}
impl ::core::fmt::Debug for StoreDeltas {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("StoreDeltas").field("store_deltas", &self.store_deltas).finish()
}
}
impl StoreDeltas {
pub const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.v1.StoreDeltas";
}
::buffa::impl_default_instance!(StoreDeltas);
impl ::buffa::MessageName for StoreDeltas {
const PACKAGE: &'static str = "sf.substreams.v1";
const NAME: &'static str = "StoreDeltas";
const FULL_NAME: &'static str = "sf.substreams.v1.StoreDeltas";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.v1.StoreDeltas";
}
impl ::buffa::Message for StoreDeltas {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
for v in &self.store_deltas {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.store_deltas {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.store_deltas.push(elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.store_deltas.clear();
}
}
#[derive(Clone, PartialEq, Default)]
pub struct StoreDelta {
pub operation: ::buffa::EnumValue<store_delta::Operation>,
pub ordinal: u64,
pub key: ::buffa::alloc::string::String,
pub old_value: ::buffa::alloc::vec::Vec<u8>,
pub new_value: ::buffa::alloc::vec::Vec<u8>,
}
impl ::core::fmt::Debug for StoreDelta {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("StoreDelta")
.field("operation", &self.operation)
.field("ordinal", &self.ordinal)
.field("key", &self.key)
.field("old_value", &self.old_value)
.field("new_value", &self.new_value)
.finish()
}
}
impl StoreDelta {
pub const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.v1.StoreDelta";
}
::buffa::impl_default_instance!(StoreDelta);
impl ::buffa::MessageName for StoreDelta {
const PACKAGE: &'static str = "sf.substreams.v1";
const NAME: &'static str = "StoreDelta";
const FULL_NAME: &'static str = "sf.substreams.v1.StoreDelta";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.v1.StoreDelta";
}
impl ::buffa::Message for StoreDelta {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
{
let val = self.operation.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
if self.ordinal != 0u64 {
size += 1u64 + ::buffa::types::uint64_encoded_len(self.ordinal) as u64;
}
if !self.key.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.key) as u64;
}
if !self.old_value.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.old_value) as u64;
}
if !self.new_value.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.new_value) as u64;
}
::buffa::saturate_size(size)
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.operation.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
if self.ordinal != 0u64 {
::buffa::types::put_uint64_field(2u32, self.ordinal, buf);
}
if !self.key.is_empty() {
::buffa::types::put_string_field(3u32, &self.key, buf);
}
if !self.old_value.is_empty() {
::buffa::types::put_shared_bytes_field(4u32, &self.old_value, buf);
}
if !self.new_value.is_empty() {
::buffa::types::put_shared_bytes_field(5u32, &self.new_value, buf);
}
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.operation = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.ordinal = ::buffa::types::decode_uint64(buf)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.key, buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(&mut self.old_value, buf)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(&mut self.new_value, buf)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.operation = ::buffa::EnumValue::from(0);
self.ordinal = 0u64;
self.key.clear();
self.old_value.clear();
self.new_value.clear();
}
}
pub mod store_delta {
#[allow(unused_imports)]
use super::*;
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum Operation {
UNSET = 0i32,
CREATE = 1i32,
UPDATE = 2i32,
DELETE = 3i32,
}
impl Operation {
#[allow(non_upper_case_globals)]
pub const Unset: Self = Self::UNSET;
#[allow(non_upper_case_globals)]
pub const Create: Self = Self::CREATE;
#[allow(non_upper_case_globals)]
pub const Update: Self = Self::UPDATE;
#[allow(non_upper_case_globals)]
pub const Delete: Self = Self::DELETE;
}
impl ::core::default::Default for Operation {
fn default() -> Self {
Self::UNSET
}
}
impl ::buffa::Enumeration for Operation {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::UNSET),
1i32 => ::core::option::Option::Some(Self::CREATE),
2i32 => ::core::option::Option::Some(Self::UPDATE),
3i32 => ::core::option::Option::Some(Self::DELETE),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::UNSET => "UNSET",
Self::CREATE => "CREATE",
Self::UPDATE => "UPDATE",
Self::DELETE => "DELETE",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"UNSET" => ::core::option::Option::Some(Self::UNSET),
"CREATE" => ::core::option::Option::Some(Self::CREATE),
"UPDATE" => ::core::option::Option::Some(Self::UPDATE),
"DELETE" => ::core::option::Option::Some(Self::DELETE),
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[Self::UNSET, Self::CREATE, Self::UPDATE, Self::DELETE]
}
}
}