Skip to content

Commit 393e76f

Browse files
author
Zoran Cvetkov
committed
cleanup
1 parent 3d9e05f commit 393e76f

File tree

6 files changed

+11
-24
lines changed

6 files changed

+11
-24
lines changed

core/src/subgraph/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ async fn update_proof_of_indexing(
15851585
data.push((entity_cache.schema.poi_block_time(), block_time));
15861586
}
15871587
let poi = entity_cache.make_entity(data)?;
1588-
// VOI is autogenerated for POI table and our input is ignored
1588+
// VID is autogenerated for POI table and our input is ignored
15891589
entity_cache.set(key, EntityV::new(poi, 0))
15901590
}
15911591

graph/src/data/store/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,12 @@ impl Entity {
913913
Id::try_from(self.get("id").unwrap().clone()).expect("the id is set to a valid value")
914914
}
915915

916-
// TODO: only for tests!
916+
// TODO: try to use it only for tests!
917+
// #[cfg(debug_assertions)]
917918
pub fn vid(&self) -> i64 {
918919
self.get("vid")
919920
.expect("the vid is set")
921+
// .unwrap_or(&Value::Int8(0))
920922
.as_int8()
921923
.expect("the vid is set to a valid value")
922924
}
@@ -1087,7 +1089,7 @@ impl std::fmt::Debug for Entity {
10871089
}
10881090
}
10891091

1090-
/// An entity is represented as a map of attribute names to values.
1092+
/// An entity wrapper that has VID too.
10911093
#[derive(Debug, Clone, CacheWeight, PartialEq, Eq, Serialize)]
10921094
pub struct EntityV {
10931095
pub e: Entity,

graph/src/schema/input/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) const POI_OBJECT: &str = "Poi$";
3535
const POI_DIGEST: &str = "digest";
3636
/// The name of the PoI attribute for storing the block time
3737
const POI_BLOCK_TIME: &str = "blockTime";
38-
const VID: &str = "vid";
38+
const VID_FIELD: &str = "vid";
3939

4040
pub mod kw {
4141
pub const ENTITY: &str = "entity";
@@ -1488,10 +1488,6 @@ impl InputSchema {
14881488
}
14891489

14901490
pub fn has_field_with_name(&self, entity_type: &EntityType, field: &str) -> bool {
1491-
// TODO: check if it is needed
1492-
// if field == VID {
1493-
// return true;
1494-
// }
14951491
let field = self.inner.pool.lookup(field);
14961492

14971493
match field {
@@ -1602,7 +1598,7 @@ fn atom_pool(document: &s::Document) -> AtomPool {
16021598
pool.intern(POI_DIGEST);
16031599
pool.intern(POI_BLOCK_TIME);
16041600

1605-
pool.intern(VID);
1601+
pool.intern(VID_FIELD);
16061602

16071603
for definition in &document.definitions {
16081604
match definition {

runtime/wasm/src/host_exports.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ impl HostExports {
315315
data.insert(store::ID.clone(), value);
316316
}
317317
}
318-
// data.insert(store::VID.clone(), Value::Int8(vid));
319318

320319
self.check_invalid_fields(
321320
self.data_source.api_version.clone(),

store/test-store/src/store.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,6 @@ lazy_static! {
106106
};
107107
}
108108

109-
pub fn filter_vid(arr: Vec<Entity>) -> Vec<Entity> {
110-
arr.into_iter()
111-
.map(|mut e| {
112-
e.remove("vid");
113-
e.remove_null_fields();
114-
e
115-
})
116-
.collect()
117-
}
118-
119109
/// Run the `test` after performing `setup`. The result of `setup` is passed
120110
/// into `test`. All tests using `run_test_sequentially` are run in sequence,
121111
/// never in parallel. The `test` is passed a `Store`, but it is permissible

store/test-store/tests/core/interfaces.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,11 +1114,11 @@ async fn enums() {
11141114
let entities = vec![
11151115
(
11161116
"Trajectory",
1117-
entity! { schema => id: "1", direction: "EAST", meters: 10, vid: 0i64},
1117+
entity! { schema => id: "1", direction: "EAST", meters: 10, vid: 0i64 },
11181118
),
11191119
(
11201120
"Trajectory",
1121-
entity! { schema => id: "2", direction: "NORTH", meters: 15, vid: 1i64},
1121+
entity! { schema => id: "2", direction: "NORTH", meters: 15, vid: 1i64 },
11221122
),
11231123
];
11241124
let query = "query { trajectories { id, direction, meters } }";
@@ -1365,11 +1365,11 @@ async fn derived_interface_bytes() {
13651365
("Pool", entity! { schema => id: b("0xf001"), vid: 0i64 }),
13661366
(
13671367
"Sell",
1368-
entity! { schema => id: b("0xc0"), pool: "0xf001", vid: 0i64},
1368+
entity! { schema => id: b("0xc0"), pool: "0xf001", vid: 0i64 },
13691369
),
13701370
(
13711371
"Buy",
1372-
entity! { schema => id: b("0xb0"), pool: "0xf001", vid: 0i64},
1372+
entity! { schema => id: b("0xb0"), pool: "0xf001", vid: 0i64 },
13731373
),
13741374
];
13751375

0 commit comments

Comments
 (0)