diff options
author | Luck <git@lucko.me> | 2021-05-06 16:08:23 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2021-05-06 16:34:16 +0100 |
commit | f17661af47cd36d4df5339edf0dd5349123bfe53 (patch) | |
tree | d47a066aeebadb44ca6864e3f48d25d322e0a5f9 /spark-common | |
parent | 0c71e09e79ed50f10b38f267d3280f0be4cab000 (diff) | |
download | spark-f17661af47cd36d4df5339edf0dd5349123bfe53.tar.gz spark-f17661af47cd36d4df5339edf0dd5349123bfe53.tar.bz2 spark-f17661af47cd36d4df5339edf0dd5349123bfe53.zip |
Improve some proto message/field names
Diffstat (limited to 'spark-common')
6 files changed, 34 insertions, 34 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()) diff --git a/spark-common/src/main/proto/spark/spark.proto b/spark-common/src/main/proto/spark/spark.proto index f06c097..83d017a 100644 --- a/spark-common/src/main/proto/spark/spark.proto +++ b/spark-common/src/main/proto/spark/spark.proto @@ -5,7 +5,7 @@ package spark; option java_package = "me.lucko.spark.proto"; option java_outer_classname = "SparkProtos"; -message CommandSenderData { +message CommandSenderMetadata { Type type = 1; string name = 2; string unique_id = 3; @@ -16,20 +16,20 @@ message CommandSenderData { } } -message MemoryData { +message MemoryUsage { int64 used = 1; int64 committed = 2; int64 max = 3; } -message PlatformData { +message PlatformMetadata { Type type = 1; string name = 2; string version = 3; string minecraft_version = 4; // optional int32 n_cpus = 5; - MemoryData heapUsage = 6; + MemoryUsage heapUsage = 6; enum Type { SERVER = 0; @@ -44,8 +44,8 @@ message HeapData { } message HeapMetadata { - CommandSenderData user = 1; - PlatformData platform = 2; + CommandSenderMetadata creator = 1; + PlatformMetadata platformMetadata = 2; } message HeapEntry { @@ -61,13 +61,13 @@ message SamplerData { } message SamplerMetadata { - CommandSenderData user = 1; + CommandSenderMetadata creator = 1; int64 start_time = 2; int32 interval = 3; ThreadDumper thread_dumper = 4; DataAggregator data_aggregator = 5; string comment = 6; - PlatformData platform = 7; + PlatformMetadata platformMetadata = 7; message ThreadDumper { Type type = 1; |