Skip to content

Commit

Permalink
bump 0.3.1: kv_out now encodes full protobuf as value
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Jan 10, 2023
1 parent bc5c347 commit 99f1441
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "substreams-eth-block-meta"
version = "0.3.0"
version = "0.3.1"
description = "Substream Ethereum Block Meta Substreams tracking block at day/month boundaries"
edition = "2021"
repository = "https://github.com/streamingfast/substreams-eth-block-meta"
Expand Down
46 changes: 3 additions & 43 deletions src/kv_out.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use substreams::proto;
use substreams::{
store::{self, DeltaProto},
Hex,
Expand All @@ -12,52 +13,11 @@ pub fn block_meta_to_kv_ops(ops: &mut KvOperations, deltas: store::Deltas<DeltaP
for delta in deltas.deltas {
match delta.operation {
Operation::Create | Operation::Update => {
ops.push_new(&delta.key, delta.new_value.hash.clone(), delta.ordinal);
ops.push_new(
Hex::encode(delta.new_value.hash),
delta.new_value.parent_hash.to_vec(),
delta.ordinal,
);
let val = proto::encode(&delta.new_value).unwrap();
ops.push_new(Hex::encode(delta.new_value.hash), val, delta.ordinal);
}
Operation::Delete => ops.push_delete(&delta.key, delta.ordinal),
x => panic!("unsupported opeation {:?}", x),
}
}
}
//
//fn push_create(
// changes: &mut DatabaseChanges,
// key: &str,
// timestamp: BlockTimestamp,
// ordinal: u64,
// value: BlockMeta,
//) {
// changes
// .push_change("block_meta", key, ordinal, Operation::Create)
// .change("at", (None, timestamp))
// .change("number", (None, value.number))
// .change("hash", (None, Hex(value.hash)))
// .change("parent_hash", (None, Hex(value.parent_hash)))
// .change("timestamp", (None, value.timestamp.unwrap()));
//}
//
//fn push_update(
// changes: &mut DatabaseChanges,
// key: &str,
// ordinal: u64,
// old_value: BlockMeta,
// new_value: BlockMeta,
//) {
// changes
// .push_change("block_meta", key, ordinal, Operation::Update)
// .change("number", (old_value.number, new_value.number))
// .change("hash", (Hex(old_value.hash), Hex(new_value.hash)))
// .change(
// "parent_hash",
// (Hex(old_value.parent_hash), Hex(new_value.parent_hash)),
// )
// .change(
// "timestamp",
// (&old_value.timestamp.unwrap(), &new_value.timestamp.unwrap()),
// );
//}
2 changes: 1 addition & 1 deletion substreams.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: "substreams_eth_block_meta"
version: v0.3.0
version: v0.3.1

imports:
database_change: https://github.com/streamingfast/substreams-database-change/releases/download/v0.1.0/substreams-database-change-v0.1.0.spkg
Expand Down

0 comments on commit 99f1441

Please sign in to comment.