-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
use rocketmq_common::common::broker::broker_config::BrokerConfig; | ||
|
||
pub struct BrokerController { | ||
pub(crate) broker_config: BrokerConfig, | ||
} | ||
|
||
impl BrokerController { | ||
pub fn new(broker_config: BrokerConfig) -> Self { | ||
Self { broker_config } | ||
} | ||
} | ||
|
||
impl BrokerController { | ||
pub fn start(&mut self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,6 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
#![allow(dead_code)] | ||
pub mod broker_controller; | ||
pub mod command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod broker_config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
use crate::common::mix_all; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct BrokerIdentity { | ||
broker_name: String, | ||
broker_cluster_name: String, | ||
broker_id: u64, | ||
is_broker_container: bool, | ||
is_in_broker_container: bool, | ||
} | ||
|
||
impl BrokerIdentity { | ||
fn new() -> Self { | ||
let broker_name = default_broker_name(); | ||
let broker_cluster_name = String::from("DefaultCluster"); | ||
let broker_id = mix_all::MASTER_ID; | ||
let is_broker_container = false; | ||
|
||
BrokerIdentity { | ||
broker_name, | ||
broker_cluster_name, | ||
broker_id, | ||
is_broker_container, | ||
is_in_broker_container: false, | ||
} | ||
} | ||
|
||
fn new_with_container(is_broker_container: bool) -> Self { | ||
let mut identity = BrokerIdentity::new(); | ||
identity.is_broker_container = is_broker_container; | ||
identity | ||
} | ||
|
||
fn new_with_params(broker_cluster_name: String, broker_name: String, broker_id: u64) -> Self { | ||
BrokerIdentity { | ||
broker_name, | ||
broker_cluster_name, | ||
broker_id, | ||
is_broker_container: false, | ||
is_in_broker_container: false, | ||
} | ||
} | ||
|
||
fn new_with_container_params( | ||
broker_cluster_name: String, | ||
broker_name: String, | ||
broker_id: u64, | ||
is_in_broker_container: bool, | ||
) -> Self { | ||
BrokerIdentity { | ||
broker_name, | ||
broker_cluster_name, | ||
broker_id, | ||
is_broker_container: true, | ||
is_in_broker_container, | ||
} | ||
} | ||
} | ||
|
||
fn default_broker_name() -> String { | ||
// Implement logic to obtain default broker name | ||
// For example, use local hostname | ||
// ... | ||
|
||
// Placeholder value for demonstration | ||
String::from("DefaultBrokerName") | ||
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct BrokerConfig { | ||
pub broker_identity: BrokerIdentity, | ||
} |