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

Method allow_writes

src/compute-client/src/controller/instance.rs:1044–1065  ·  view source on GitHub ↗
(&mut self, collection_id: GlobalId)

Source from the content-addressed store, hash-verified

1042 /// Calling this method repeatedly has no effect.
1043 #[mz_ore::instrument(level = "debug")]
1044 pub fn allow_writes(&mut self, collection_id: GlobalId) -> Result<(), CollectionMissing> {
1045 let collection = self.collection_mut(collection_id)?;
1046
1047 // Do not send redundant allow-writes commands.
1048 if !collection.read_only {
1049 return Ok(());
1050 }
1051
1052 // Don't send allow-writes for collections that are not installed.
1053 let as_of = collection.read_frontier();
1054
1055 // If the collection has an empty `as_of`, it was either never installed on the replica or
1056 // has since been dropped. In either case the replica does not expect any commands for it.
1057 if as_of.is_empty() {
1058 return Ok(());
1059 }
1060
1061 collection.read_only = false;
1062 self.send(ComputeCommand::AllowWrites(collection_id));
1063
1064 Ok(())
1065 }
1066
1067 /// Shut down this instance.
1068 ///

Callers

nothing calls this directly

Calls 4

collection_mutMethod · 0.80
read_frontierMethod · 0.80
is_emptyMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected