MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / send

Method send

src/storage-controller/src/instance.rs:326–373  ·  view source on GitHub ↗

Sends a command to this storage instance.

(&mut self, command: StorageCommand)

Source from the content-addressed store, hash-verified

324
325 /// Sends a command to this storage instance.
326 pub fn send(&mut self, command: StorageCommand) {
327 // Record the command so that new replicas can be brought up to speed.
328 self.history.push(command.clone());
329
330 match command.clone() {
331 StorageCommand::RunIngestion(ingestion) => {
332 // First absorb into our state, because this might change
333 // scheduling decisions, which need to be respected just below
334 // when sending commands.
335 self.absorb_ingestion(*ingestion.clone());
336
337 for replica in self.active_replicas(&ingestion.id) {
338 replica.send(StorageCommand::RunIngestion(ingestion.clone()));
339 }
340 }
341 StorageCommand::RunSink(sink) => {
342 // First absorb into our state, because this might change
343 // scheduling decisions, which need to be respected just below
344 // when sending commands.
345 self.absorb_export(*sink.clone());
346
347 for replica in self.active_replicas(&sink.id) {
348 replica.send(StorageCommand::RunSink(sink.clone()));
349 }
350 }
351 StorageCommand::AllowCompaction(id, frontier) => {
352 // First send out commands and then absorb into our state since
353 // absorbing them might remove entries from active_ingestions.
354 for replica in self.active_replicas(&id) {
355 replica.send(StorageCommand::AllowCompaction(
356 id.clone(),
357 frontier.clone(),
358 ));
359 }
360
361 self.absorb_compaction(id, frontier);
362 }
363 command => {
364 for replica in self.replicas.values_mut() {
365 replica.send(command.clone());
366 }
367 }
368 }
369
370 if command.installs_objects() && self.replicas.is_empty() {
371 self.update_paused_statuses();
372 }
373 }
374
375 /// Updates internal state based on incoming ingestion commands.
376 ///

Callers 15

backpressureFunction · 0.45
backpressure_runnerFunction · 0.45
test_multiple_filesFunction · 0.45
listMethod · 0.45
getMethod · 0.45
listMethod · 0.45
getMethod · 0.45
with_channelMethod · 0.45
validateMethod · 0.45

Calls 10

absorb_ingestionMethod · 0.80
active_replicasMethod · 0.80
absorb_exportMethod · 0.80
absorb_compactionMethod · 0.80
values_mutMethod · 0.80
installs_objectsMethod · 0.80
pushMethod · 0.45
cloneMethod · 0.45
is_emptyMethod · 0.45

Tested by 1

test_multiple_filesFunction · 0.36