aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2021-05-06 16:08:23 +0100
committerLuck <git@lucko.me>2021-05-06 16:34:16 +0100
commitf17661af47cd36d4df5339edf0dd5349123bfe53 (patch)
treed47a066aeebadb44ca6864e3f48d25d322e0a5f9 /spark-common/src/main/java/me/lucko
parent0c71e09e79ed50f10b38f267d3280f0be4cab000 (diff)
downloadspark-f17661af47cd36d4df5339edf0dd5349123bfe53.tar.gz
spark-f17661af47cd36d4df5339edf0dd5349123bfe53.tar.bz2
spark-f17661af47cd36d4df5339edf0dd5349123bfe53.zip
Improve some proto message/field names
Diffstat (limited to 'spark-common/src/main/java/me/lucko')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/command/sender/CommandSender.java8
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java4
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java32
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java4
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/java/JavaSampler.java4
5 files changed, 26 insertions, 26 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/sender/CommandSender.java b/spark-common/src/main/java/me/lucko/spark/common/command/sender/CommandSender.java
index 9feeac2..bae5ddf 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/command/sender/CommandSender.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/command/sender/CommandSender.java
@@ -24,7 +24,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
-import me.lucko.spark.proto.SparkProtos.CommandSenderData;
+import me.lucko.spark.proto.SparkProtos.CommandSenderMetadata;
import net.kyori.adventure.text.Component;
@@ -75,9 +75,9 @@ public interface CommandSender {
return user;
}
- public CommandSenderData toProto() {
- CommandSenderData.Builder proto = CommandSenderData.newBuilder()
- .setType(isPlayer() ? CommandSenderData.Type.PLAYER : CommandSenderData.Type.OTHER)
+ public CommandSenderMetadata toProto() {
+ CommandSenderMetadata.Builder proto = CommandSenderMetadata.newBuilder()
+ .setType(isPlayer() ? CommandSenderMetadata.Type.PLAYER : CommandSenderMetadata.Type.OTHER)
.setName(this.name);
if (this.uniqueId != null) {
diff --git a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java
index a1ad819..de0c5df 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java
@@ -132,8 +132,8 @@ public final class HeapDumpSummary {
private HeapData toProto(PlatformInfo platformInfo, CommandSender creator) {
HeapData.Builder proto = HeapData.newBuilder();
proto.setMetadata(SparkProtos.HeapMetadata.newBuilder()
- .setPlatform(platformInfo.toData().toProto())
- .setUser(creator.toData().toProto())
+ .setPlatformMetadata(platformInfo.toData().toProto())
+ .setCreator(creator.toData().toProto())
.build()
);
diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java
index 20015dd..c631187 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java
@@ -20,8 +20,8 @@
package me.lucko.spark.common.platform;
-import me.lucko.spark.proto.SparkProtos.MemoryData;
-import me.lucko.spark.proto.SparkProtos.PlatformData;
+import me.lucko.spark.proto.SparkProtos;
+import me.lucko.spark.proto.SparkProtos.PlatformMetadata;
import java.lang.management.MemoryUsage;
@@ -44,17 +44,17 @@ public interface PlatformInfo {
}
enum Type {
- SERVER(PlatformData.Type.SERVER),
- CLIENT(PlatformData.Type.CLIENT),
- PROXY(PlatformData.Type.PROXY);
+ SERVER(PlatformMetadata.Type.SERVER),
+ CLIENT(PlatformMetadata.Type.CLIENT),
+ PROXY(PlatformMetadata.Type.PROXY);
- private final PlatformData.Type type;
+ private final PlatformMetadata.Type type;
- Type(PlatformData.Type type) {
+ Type(PlatformMetadata.Type type) {
this.type = type;
}
- public PlatformData.Type toProto() {
+ public PlatformMetadata.Type toProto() {
return this.type;
}
}
@@ -100,21 +100,21 @@ public interface PlatformInfo {
return this.heapUsage;
}
- private static MemoryData toProto(MemoryUsage usage) {
- return MemoryData.newBuilder()
- .setUsed(usage.getUsed())
- .setCommitted(usage.getCommitted())
- .setMax(usage.getMax())
+ public SparkProtos.MemoryUsage getHeapUsageProto() {
+ return SparkProtos.MemoryUsage.newBuilder()
+ .setUsed(this.heapUsage.getUsed())
+ .setCommitted(this.heapUsage.getCommitted())
+ .setMax(this.heapUsage.getMax())
.build();
}
- public PlatformData toProto() {
- PlatformData.Builder proto = PlatformData.newBuilder()
+ public PlatformMetadata toProto() {
+ PlatformMetadata.Builder proto = PlatformMetadata.newBuilder()
.setType(this.type.toProto())
.setName(this.name)
.setVersion(this.version)
.setNCpus(this.nCpus)
- .setHeapUsage(toProto(this.heapUsage));
+ .setHeapUsage(getHeapUsageProto());
if (this.minecraftVersion != null) {
proto.setMinecraftVersion(this.minecraftVersion);
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java
index 1e23124..c76274b 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java
@@ -146,8 +146,8 @@ public class AsyncSampler implements Sampler {
@Override
public SparkProtos.SamplerData toProto(PlatformInfo platformInfo, CommandSender creator, Comparator<? super Map.Entry<String, ThreadNode>> outputOrder, String comment, MergeMode mergeMode) {
final SparkProtos.SamplerMetadata.Builder metadata = SparkProtos.SamplerMetadata.newBuilder()
- .setPlatform(platformInfo.toData().toProto())
- .setUser(creator.toData().toProto())
+ .setPlatformMetadata(platformInfo.toData().toProto())
+ .setCreator(creator.toData().toProto())
.setStartTime(this.startTime)
.setInterval(this.interval)
.setThreadDumper(this.threadDumper.getMetadata())
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/java/JavaSampler.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/java/JavaSampler.java
index 0ee5f86..5fe5add 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/java/JavaSampler.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/java/JavaSampler.java
@@ -163,8 +163,8 @@ public class JavaSampler implements Sampler, Runnable {
@Override
public SamplerData toProto(PlatformInfo platformInfo, CommandSender creator, Comparator<? super Map.Entry<String, ThreadNode>> outputOrder, String comment, MergeMode mergeMode) {
final SamplerMetadata.Builder metadata = SamplerMetadata.newBuilder()
- .setPlatform(platformInfo.toData().toProto())
- .setUser(creator.toData().toProto())
+ .setPlatformMetadata(platformInfo.toData().toProto())
+ .setCreator(creator.toData().toProto())
.setStartTime(this.startTime)
.setInterval(this.interval)
.setThreadDumper(this.threadDumper.getMetadata())