Skip to content
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

Cassandra 2 support #120

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.net.InetAddress;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;

public class InternalMetadataFactory extends MetadataFactory {
private static Optional<CFMetaData> getCFMetaData(final String keyspaceName, final String tableName) {
Expand All @@ -20,10 +21,13 @@ private static Optional<CFMetaData> getCFMetaData(final String keyspaceName, fin
@Override
public Optional<IndexMetadata> indexMetadata(final String keyspaceName, final String tableName, final String indexName) {
return getCFMetaData(keyspaceName, tableName)
.flatMap(m -> m.getIndexes().get(indexName))
.map(m -> {
final IndexMetadata.IndexType indexType = IndexMetadata.IndexType.valueOf(m.kind.toString());
final Optional<String> className = Optional.ofNullable(m.options.get("class_name"));
.map(Stream::of)
.orElseGet(Stream::empty)
.flatMap(m -> m.allColumns().stream())
.filter(m -> indexName.equals(m.getIndexName()))
.<IndexMetadata>map(m -> {
final IndexMetadata.IndexType indexType = IndexMetadata.IndexType.valueOf(m.getIndexType().toString());
final Optional<String> className = Optional.ofNullable(m.getIndexOptions().get("class_name"));

return new IndexMetadata() {
@Override
Expand All @@ -36,7 +40,8 @@ public Optional<String> customClassName() {
return className;
}
};
});
})
.findAny();
}

@Override
Expand All @@ -45,12 +50,12 @@ public Optional<TableMetadata> tableOrViewMetadata(final String keyspaceName, fi
.map(m -> new TableMetadata() {
@Override
public String compactionStrategyClassName() {
return m.params.compaction.klass().getCanonicalName();
return m.compactionStrategyClass.getCanonicalName();
}

@Override
public boolean isView() {
return m.isView();
return false;
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/com/zegelin/jmx/NamedObject.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.zegelin.jmx;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;

import javax.management.ObjectName;
Expand Down Expand Up @@ -36,7 +36,7 @@ public <U> NamedObject<U> map(final BiFunction<ObjectName, ? super T, ? extends

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
return Objects.toStringHelper(this)
.add("name", name)
.add("object", object)
.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.zegelin.prometheus.domain;

import com.google.common.base.MoreObjects;

import java.util.Objects;
import java.util.function.Supplier;
import java.util.stream.Stream;
Expand Down Expand Up @@ -41,7 +39,7 @@ public int hashCode() {

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
return com.google.common.base.Objects.toStringHelper(this)
.add("name", name)
.add("help", help)
.toString();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</modules>

<properties>
<version.cassandra.all>3.11.2</version.cassandra.all>
<version.cassandra.all>2.2.18</version.cassandra.all>

<version.maven.release.plugin>2.5.3</version.maven.release.plugin>
<version.maven.dependency.plugin>3.1.1</version.maven.dependency.plugin>
Expand Down