MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / SPACETIMEDB_REDUCER

Function SPACETIMEDB_REDUCER

modules/benchmarks-cpp/src/ia_loop.cpp:134–147  ·  view source on GitHub ↗

Bulk insert position entries

Source from the content-addressed store, hash-verified

132
133// Bulk insert position entries
134SPACETIMEDB_REDUCER(insert_bulk_position, ReducerContext& ctx, uint32_t count) {
135 for (uint32_t id = 0; id < count; ++id) {
136 float x = static_cast<float>(id);
137 float y = static_cast<float>(id + 5);
138 float z = static_cast<float>(id * 5);
139 Position new_position = {
140 id, x, y, z,
141 x + 10.0f, y + 20.0f, z + 30.0f // vx, vy, vz
142 };
143 ctx.db[position].insert(new_position);
144 }
145 LOG_INFO("INSERT POSITION: " + std::to_string(count));
146 return Ok();
147}
148
149// Bulk insert velocity entries
150SPACETIMEDB_REDUCER(insert_bulk_velocity, ReducerContext& ctx, uint32_t count) {

Callers

nothing calls this directly

Calls 15

insert_bulk_positionFunction · 0.85
insert_bulk_velocityFunction · 0.85
update_position_allFunction · 0.85
insert_worldFunction · 0.85
game_loop_enemy_iaFunction · 0.85
moment_millisecondsFunction · 0.70
agent_loopFunction · 0.70
insertMethod · 0.65
to_stringFunction · 0.50
OkFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…