#[derive(Clone, PartialEq, Default)]
pub struct GetRequest {
pub block_number: u64,
pub block_hash: ::buffa::alloc::vec::Vec<u8>,
pub keys: ::buffa::alloc::vec::Vec<super::super::model::v2::Key>,
}
impl ::core::fmt::Debug for GetRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("GetRequest")
.field("block_number", &self.block_number)
.field("block_hash", &self.block_hash)
.field("keys", &self.keys)
.finish()
}
}
impl GetRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.service.v2.GetRequest";
}
::buffa::impl_default_instance!(GetRequest);
impl ::buffa::MessageName for GetRequest {
const PACKAGE: &'static str = "sf.substreams.foundational_store.service.v2";
const NAME: &'static str = "GetRequest";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.service.v2.GetRequest";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.service.v2.GetRequest";
}
impl ::buffa::Message for GetRequest {
#[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;
if self.block_number != 0u64 {
size += 1u64 + ::buffa::types::uint64_encoded_len(self.block_number) as u64;
}
if !self.block_hash.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.block_hash) as u64;
}
for v in &self.keys {
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 _;
if self.block_number != 0u64 {
::buffa::types::put_uint64_field(1u32, self.block_number, buf);
}
if !self.block_hash.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.block_hash, buf);
}
for v in &self.keys {
::buffa::types::put_len_delimited_header(
3u32,
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::Varint,
)?;
self.block_number = ::buffa::types::decode_uint64(buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(&mut self.block_hash, buf)?;
}
3u32 => {
::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.keys.push(elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.block_number = 0u64;
self.block_hash.clear();
self.keys.clear();
}
}
#[derive(Clone, PartialEq, Default)]
pub struct GetResponse {
pub block_reached: bool,
pub entries: ::buffa::MessageField<
super::super::model::v2::QueriedEntries,
::buffa::Inline<super::super::model::v2::QueriedEntries>,
>,
}
impl ::core::fmt::Debug for GetResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("GetResponse")
.field("block_reached", &self.block_reached)
.field("entries", &self.entries)
.finish()
}
}
impl GetResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.service.v2.GetResponse";
}
::buffa::impl_default_instance!(GetResponse);
impl ::buffa::MessageName for GetResponse {
const PACKAGE: &'static str = "sf.substreams.foundational_store.service.v2";
const NAME: &'static str = "GetResponse";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.service.v2.GetResponse";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.service.v2.GetResponse";
}
impl ::buffa::Message for GetResponse {
#[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;
if self.block_reached {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if self.entries.is_set() {
let __slot = __cache.reserve();
let inner_size = self.entries.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 _;
if self.block_reached {
::buffa::types::put_bool_field(1u32, self.block_reached, buf);
}
if self.entries.is_set() {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
self.entries.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::Varint,
)?;
self.block_reached = ::buffa::types::decode_bool(buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.entries.get_or_insert_default(),
buf,
ctx,
)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.block_reached = false;
self.entries = ::buffa::MessageField::none();
}
}