New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-14680: Provide simple interfaces to our cloud classes (only API) #1694
Changes from 10 commits
8afacf2
80b3ce4
a6a30eb
a6d05f8
46a371e
001f48b
f4fd18a
ba29f2e
1eda201
342ae67
87c43bd
ccb0ae9
baac533
8dcd447
6201980
0d39cee
93c5311
fe6aa01
b91b461
0a29e4d
018c18f
870ba5f
30a4ec2
931eaa3
e21e9ea
d2e8e12
8c3bc25
0c2da56
adebaf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.solr.common.cloud.sdk; | ||
|
||
import org.apache.solr.common.cloud.DocRouter; | ||
import org.apache.solr.common.util.SimpleMap; | ||
|
||
/**A shard of a collection */ | ||
public interface Shard { | ||
|
||
/**name of the shard */ | ||
String name(); | ||
|
||
/**collection this shard belongs to */ | ||
String collection(); | ||
|
||
/**hash range of this shard. null if this is not using hash based router | ||
*/ | ||
DocRouter.Range range(); | ||
|
||
/** replicas of the shard | ||
*/ | ||
SimpleMap<ShardReplica> replicas(); | ||
|
||
/** | ||
* Name of the replica that is acting as the leader at the moment | ||
*/ | ||
String leader(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.solr.common.cloud.sdk; | ||
|
||
import org.apache.solr.common.cloud.Replica; | ||
|
||
/** replica of a shard */ | ||
public interface ShardReplica { | ||
/** Name of this replica */ | ||
String name(); | ||
|
||
/** | ||
* The shard which it belongs to | ||
*/ | ||
String shard(); | ||
|
||
/** collection which it belongs to */ | ||
String collection(); | ||
|
||
/** Name of the node where this replica is present */ | ||
String node(); | ||
|
||
/** Name of the core where this is hosted */ | ||
String core(); | ||
|
||
/** type of the replica */ | ||
Replica.Type type(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.solr.common.cloud.sdk; | ||
|
||
import org.apache.solr.common.util.SimpleMap; | ||
|
||
/** | ||
* Represents a Solr cluster | ||
*/ | ||
public interface SolrCluster { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we have our own package namespace, prepending solr isn't really needed unless we think we might also model non-solr clusters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know. Imagine this will also be used outside of Solr as a part of SolrJ. So if you read some client code,
is less readable compared to
Eventually, I would wish to replace a lot of SolrJ code/API with a standard set of interfaces. |
||
/** collections in the cluster */ | ||
SimpleMap<SolrCollection> collections(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also aliases... and the Alias class returned should list the collections provided and routing info if routed. (also law of Demeter etc...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I wanted to include aliases. Where do you propose it to be there? I would say , There should be no It should be as simple as and
|
||
|
||
/** nodes in the cluster */ | ||
SimpleMap<SolrNode> nodes(); | ||
|
||
/** Get a {@link SolrNode} by name. returns null if no such node exists */ | ||
SolrNode getNode(String node); | ||
|
||
/** | ||
* Name of the node in which the overseer is running | ||
*/ | ||
String overseerNode(); | ||
|
||
/** | ||
* The name of the node in which this method is invoked from. returns null, if this is not invoked from a | ||
* Solr node | ||
*/ | ||
String thisNode(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've wondered sometimes if clusters should have name or id of some sort but that's probably another topic. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little worried that this design allows for casting of the SolrCluster reference...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have multiple implementations of
SolrCluster
.The idea of existing classes implementing these interfaces is to have readily available implementationsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename Solr luster to Cluster.