MCPcopy Create free account
hub / github.com/hashintel/hash / seed_db

Function seed_db

tests/graph/benches/representative_read/seed.rs:125–285  ·  view source on GitHub ↗
(account_id: ActorEntityUuid, store_wrapper: &mut StoreWrapper)

Source from the content-addressed store, hash-verified

123/// representative environment.
124#[expect(clippy::too_many_lines)]
125pub(crate) async fn seed_db(account_id: ActorEntityUuid, store_wrapper: &mut StoreWrapper) {
126 let mut transaction = store_wrapper
127 .store
128 .transaction()
129 .await
130 .expect("failed to start transaction");
131
132 let now = std::time::SystemTime::now();
133 eprintln!("Seeding database: {}", store_wrapper.bench_db_name);
134
135 if !transaction
136 .is_web(account_id)
137 .await
138 .expect("Should be able to check actor")
139 {
140 transaction
141 .seed_system_policies()
142 .await
143 .expect("Should be able to seed system policies");
144
145 let system_account_id = transaction
146 .get_or_create_system_machine("h")
147 .await
148 .expect("could not read system account");
149
150 let user_id = transaction
151 .create_user(Some(account_id.into()))
152 .await
153 .expect("could not create user");
154
155 transaction
156 .create_web(
157 ActorId::from(system_account_id),
158 CreateWebParameter {
159 id: Some(user_id.into()),
160 administrator: Some(user_id.into()),
161 shortname: Some("alice".to_owned()),
162 is_actor_web: true,
163 },
164 )
165 .await
166 .expect("could not create web");
167 }
168
169 seed(
170 &mut transaction,
171 account_id,
172 SEED_DATA_TYPES,
173 SEED_PROPERTY_TYPES,
174 SEED_ENTITY_TYPES,
175 )
176 .await;
177
178 let mut total_entities = 0;
179 let mut total_link_entities = 0;
180 let mut entity_uuids = Vec::new();
181 for (entity_type_str, entity_str, quantity) in SEED_ENTITIES {
182 let properties: PropertyObject =

Callers 1

Calls 15

is_webMethod · 0.80
collectMethod · 0.80
zipMethod · 0.80
pushMethod · 0.65
getMethod · 0.65
fromFunction · 0.50
seedFunction · 0.50
emptyFunction · 0.50
defaultFunction · 0.50
expectMethod · 0.45
transactionMethod · 0.45
seed_system_policiesMethod · 0.45

Tested by

no test coverage detected