Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add separate bootstrap service for bootstrapping cluster configuratio…
…ns and integrate broadcast service into cluster service.
- Loading branch information
Showing
22 changed files
with
796 additions
and
183 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
cluster/src/main/java/io/atomix/cluster/BootstrapMetadataProvider.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
import io.atomix.messaging.Endpoint; | |||
|
|||
import java.util.Collection; | |||
import java.util.concurrent.CompletableFuture; | |||
|
|||
/** | |||
* Bootstrap metadata provider. | |||
*/ | |||
public interface BootstrapMetadataProvider { | |||
|
|||
/** | |||
* Returns a collection of endpoints from which to bootstrap the cluster. | |||
* | |||
* @return a collection of endpoints from which to bootstrap the cluster | |||
*/ | |||
CompletableFuture<Collection<Endpoint>> bootstrap(); | |||
|
|||
} |
22 changes: 22 additions & 0 deletions
22
cluster/src/main/java/io/atomix/cluster/BootstrapMetadataService.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
/** | |||
* Bootstrap metadata service. | |||
*/ | |||
public interface BootstrapMetadataService extends ClusterMetadataService { | |||
} |
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
22 changes: 22 additions & 0 deletions
22
cluster/src/main/java/io/atomix/cluster/CoreMetadataService.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
/** | |||
* Core metadata service. | |||
*/ | |||
public interface CoreMetadataService extends ClusterMetadataService { | |||
} |
22 changes: 22 additions & 0 deletions
22
cluster/src/main/java/io/atomix/cluster/ManagedBootstrapMetadataService.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
/** | |||
* Managed bootstrap metadata service. | |||
*/ | |||
public interface ManagedBootstrapMetadataService extends BootstrapMetadataService, ManagedClusterMetadataService { | |||
} |
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
37 changes: 37 additions & 0 deletions
37
cluster/src/main/java/io/atomix/cluster/ManagedCoreMetadataService.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
/** | |||
* Managed core metadata service. | |||
*/ | |||
public interface ManagedCoreMetadataService extends CoreMetadataService, ManagedClusterMetadataService { | |||
|
|||
/** | |||
* Adds the given node to the cluster metadata. | |||
* | |||
* @param node the node to add to the cluster metadata | |||
*/ | |||
void addNode(Node node); | |||
|
|||
/** | |||
* Removes the given node from the cluster metadata. | |||
* | |||
* @param node the node to remove from the cluster metadata | |||
*/ | |||
void removeNode(Node node); | |||
|
|||
} |
76 changes: 76 additions & 0 deletions
76
cluster/src/main/java/io/atomix/cluster/impl/DefaultBootstrapMetadataService.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,76 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed 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. | |||
*/ | |||
package io.atomix.cluster.impl; | |||
|
|||
import io.atomix.cluster.ClusterMetadata; | |||
import io.atomix.cluster.ClusterMetadataEventListener; | |||
import io.atomix.cluster.ClusterMetadataService; | |||
import io.atomix.cluster.ManagedBootstrapMetadataService; | |||
|
|||
import java.util.concurrent.CompletableFuture; | |||
import java.util.concurrent.atomic.AtomicBoolean; | |||
|
|||
import static com.google.common.base.MoreObjects.toStringHelper; | |||
|
|||
/** | |||
* Default bootstrap metadata service. | |||
*/ | |||
public class DefaultBootstrapMetadataService implements ManagedBootstrapMetadataService { | |||
private final ClusterMetadata metadata; | |||
private final AtomicBoolean started = new AtomicBoolean(); | |||
|
|||
public DefaultBootstrapMetadataService(ClusterMetadata metadata) { | |||
this.metadata = metadata; | |||
} | |||
|
|||
@Override | |||
public ClusterMetadata getMetadata() { | |||
return metadata; | |||
} | |||
|
|||
@Override | |||
public void addListener(ClusterMetadataEventListener listener) { | |||
|
|||
} | |||
|
|||
@Override | |||
public void removeListener(ClusterMetadataEventListener listener) { | |||
|
|||
} | |||
|
|||
@Override | |||
public CompletableFuture<ClusterMetadataService> start() { | |||
started.set(true); | |||
return CompletableFuture.completedFuture(this); | |||
} | |||
|
|||
@Override | |||
public boolean isRunning() { | |||
return started.get(); | |||
} | |||
|
|||
@Override | |||
public CompletableFuture<Void> stop() { | |||
return CompletableFuture.completedFuture(null); | |||
} | |||
|
|||
@Override | |||
public String toString() { | |||
return toStringHelper(this) | |||
.add("metadata", metadata) | |||
.toString(); | |||
} | |||
} |
Oops, something went wrong.