arkiv_storage_tx/
storage_tx.rs1use alloy_primitives::{Address, B256};
2use alloy_rlp::{Bytes, RlpDecodable, RlpEncodable};
3
4#[derive(Debug, Clone, RlpEncodable, RlpDecodable)]
5pub struct Attribute<T> {
6 pub key: Key,
7 pub value: T,
8}
9pub type StringAttribute = Attribute<String>;
10pub type NumericAttribute = Attribute<u64>;
11pub type Hash = B256;
12pub type Key = String;
13
14#[derive(Debug, Clone, Default, RlpEncodable, RlpDecodable)]
15#[rlp(trailing)]
16pub struct Create {
17 pub btl: u64,
18 pub content_type: String,
19 pub payload: Bytes,
20 pub string_attributes: Vec<StringAttribute>,
21 pub numeric_attributes: Vec<NumericAttribute>,
22}
23
24#[derive(Debug, Clone, Default, RlpEncodable, RlpDecodable)]
25#[rlp(trailing)]
26pub struct Update {
27 pub entity_key: Hash,
28 pub content_type: String,
29 pub btl: u64,
30 pub payload: Bytes,
31 pub string_attributes: Vec<StringAttribute>,
32 pub numeric_attributes: Vec<NumericAttribute>,
33}
34
35pub type Delete = Hash;
36
37#[derive(Debug, Clone, Default, RlpEncodable, RlpDecodable)]
38pub struct Extend {
39 pub entity_key: Hash,
40 pub number_of_blocks: u64,
41}
42
43#[derive(Debug, Clone, Default, RlpEncodable, RlpDecodable)]
44pub struct ChangeOwner {
45 pub entity_key: Hash,
46 pub new_owner: Address,
47}
48
49#[derive(Debug, Clone, Default, RlpEncodable, RlpDecodable)]
50pub struct StorageTransaction {
51 pub creates: Vec<Create>,
52 pub updates: Vec<Update>,
53 pub deletes: Vec<Delete>,
54 pub extensions: Vec<Extend>,
55 pub change_owners: Vec<ChangeOwner>,
56}