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

Method parse_cluster_option_name

src/sql-parser/src/parser.rs:4547–4585  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

4545 }
4546
4547 fn parse_cluster_option_name(&mut self) -> Result<ClusterOptionName, ParserError> {
4548 let option = self.expect_one_of_keywords(&[
4549 AVAILABILITY,
4550 DISK,
4551 INTROSPECTION,
4552 MANAGED,
4553 REPLICAS,
4554 REPLICATION,
4555 SIZE,
4556 SCHEDULE,
4557 WORKLOAD,
4558 ])?;
4559 let name = match option {
4560 AVAILABILITY => {
4561 self.expect_keyword(ZONES)?;
4562 ClusterOptionName::AvailabilityZones
4563 }
4564 DISK => ClusterOptionName::Disk,
4565 INTROSPECTION => match self.expect_one_of_keywords(&[DEBUGGING, INTERVAL])? {
4566 DEBUGGING => ClusterOptionName::IntrospectionDebugging,
4567 INTERVAL => ClusterOptionName::IntrospectionInterval,
4568 _ => unreachable!(),
4569 },
4570 MANAGED => ClusterOptionName::Managed,
4571 REPLICAS => ClusterOptionName::Replicas,
4572 REPLICATION => {
4573 self.expect_keyword(FACTOR)?;
4574 ClusterOptionName::ReplicationFactor
4575 }
4576 SIZE => ClusterOptionName::Size,
4577 SCHEDULE => ClusterOptionName::Schedule,
4578 WORKLOAD => {
4579 self.expect_keyword(CLASS)?;
4580 ClusterOptionName::WorkloadClass
4581 }
4582 _ => unreachable!(),
4583 };
4584 Ok(name)
4585 }
4586
4587 fn parse_cluster_option(&mut self) -> Result<ClusterOption<Raw>, ParserError> {
4588 let name = self.parse_cluster_option_name()?;

Callers 1

parse_cluster_optionMethod · 0.80

Calls 2

expect_keywordMethod · 0.80

Tested by

no test coverage detected