Skip to content

Commit a349735

Browse files
feat: Initial CLI for SSB integration and Workload 1 (#2166)
* feat: Initial CLI for SSB integration * Switch to using maven-shade-plugin * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 4aa44c3 commit a349735

File tree

6 files changed

+681
-0
lines changed

6 files changed

+681
-0
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<module>proto-google-cloud-storage-v2</module>
200200
<module>gapic-google-cloud-storage-v2</module>
201201
<module>google-cloud-storage-bom</module>
202+
<module>storage-shared-benchmarking</module>
202203
</modules>
203204

204205
<profiles>

storage-shared-benchmarking/pom.xml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.google.cloud</groupId>
7+
<packaging>jar</packaging>
8+
<artifactId>storage-shared-benchmarking</artifactId>
9+
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->
10+
<parent>
11+
<groupId>com.google.cloud</groupId>
12+
<artifactId>google-cloud-storage-parent</artifactId>
13+
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
14+
</parent>
15+
16+
<properties>
17+
<maven.compiler.target>1.8</maven.compiler.target>
18+
<maven.compiler.source>1.8</maven.compiler.source>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
</properties>
21+
<dependencies>
22+
<dependency>
23+
<groupId>info.picocli</groupId>
24+
<artifactId>picocli</artifactId>
25+
<version>4.7.0</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>com.google.cloud</groupId>
29+
<artifactId>google-cloud-storage</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>com.google.cloud</groupId>
33+
<artifactId>google-cloud-storage</artifactId>
34+
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
35+
<classifier>tests</classifier>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.google.api</groupId>
39+
<artifactId>gax</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>com.google.api</groupId>
43+
<artifactId>api-common</artifactId>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.google.guava</groupId>
47+
<artifactId>guava</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.google.cloud</groupId>
51+
<artifactId>google-cloud-core</artifactId>
52+
</dependency>
53+
</dependencies>
54+
55+
<build>
56+
<!-- This plugin enables building the application to a JAR *not* using Native Image -->
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-shade-plugin</artifactId>
61+
<executions>
62+
<execution>
63+
<phase>package</phase>
64+
<goals>
65+
<goal>shade</goal>
66+
</goals>
67+
<configuration>
68+
<finalName>${uberjar.name}</finalName>
69+
<transformers>
70+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
71+
<mainClass>com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli</mainClass>
72+
</transformer>
73+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
74+
</transformers>
75+
<filters>
76+
<filter>
77+
<!--
78+
Shading signed JARs will fail without this.
79+
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
80+
-->
81+
<artifact>*:*</artifact>
82+
<excludes>
83+
<exclude>META-INF/*.SF</exclude>
84+
<exclude>META-INF/*.DSA</exclude>
85+
<exclude>META-INF/*.RSA</exclude>
86+
</excludes>
87+
</filter>
88+
</filters>
89+
</configuration>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
<plugin>
94+
<groupId>org.apache.maven.plugins</groupId>
95+
<artifactId>maven-dependency-plugin</artifactId>
96+
</plugin>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-deploy-plugin</artifactId>
100+
<configuration>
101+
<skip>true</skip>
102+
</configuration>
103+
</plugin>
104+
<plugin>
105+
<groupId>org.sonatype.plugins</groupId>
106+
<artifactId>nexus-staging-maven-plugin</artifactId>
107+
<configuration>
108+
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
109+
</configuration>
110+
</plugin>
111+
</plugins>
112+
</build>
113+
114+
</project>
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.storage.benchmarking;
18+
19+
import com.google.common.base.MoreObjects;
20+
import java.util.Objects;
21+
22+
final class CloudMonitoringResult {
23+
private final String library;
24+
private final String api;
25+
private final String op;
26+
27+
private final int workers;
28+
private final int object_size;
29+
private final int app_buffer_size;
30+
private final int chunksize;
31+
private final boolean crc32c_enabled;
32+
private final boolean md5_enabled;
33+
private final int cpu_time_us;
34+
private final String bucket_name;
35+
private final String status;
36+
private final String transfer_size;
37+
private final String transfer_offset;
38+
private final String failure_msg;
39+
private final double throughput;
40+
41+
CloudMonitoringResult(
42+
String library,
43+
String api,
44+
String op,
45+
int workers,
46+
int objectSize,
47+
int appBufferSize,
48+
int chunksize,
49+
boolean crc32cEnabled,
50+
boolean md5Enabled,
51+
int cpuTimeUs,
52+
String bucketName,
53+
String status,
54+
String transferSize,
55+
String transferOffset,
56+
String failureMsg,
57+
double throughput) {
58+
this.library = library;
59+
this.api = api;
60+
this.op = op;
61+
this.workers = workers;
62+
this.object_size = objectSize;
63+
this.app_buffer_size = appBufferSize;
64+
this.chunksize = chunksize;
65+
this.crc32c_enabled = crc32cEnabled;
66+
this.md5_enabled = md5Enabled;
67+
this.cpu_time_us = cpuTimeUs;
68+
this.bucket_name = bucketName;
69+
this.status = status;
70+
this.transfer_size = transferSize;
71+
this.transfer_offset = transferOffset;
72+
this.failure_msg = failureMsg;
73+
this.throughput = throughput;
74+
}
75+
76+
public static Builder newBuilder() {
77+
return new Builder();
78+
}
79+
80+
@Override
81+
public String toString() {
82+
return MoreObjects.toStringHelper(this)
83+
.add("library", library)
84+
.add("api", api)
85+
.add("op", op)
86+
.add("workers", workers)
87+
.add("object_size", object_size)
88+
.add("app_buffer_size", app_buffer_size)
89+
.add("chunksize", chunksize)
90+
.add("crc32c_enabled", crc32c_enabled)
91+
.add("md5_enabled", md5_enabled)
92+
.add("cpu_time_us", cpu_time_us)
93+
.add("bucket_name", bucket_name)
94+
.add("status", status)
95+
.add("transfer_size", transfer_size)
96+
.add("transfer_offset", transfer_offset)
97+
.add("failure_msg", failure_msg)
98+
.add("throughput", throughput)
99+
.toString();
100+
}
101+
102+
@Override
103+
public boolean equals(Object o) {
104+
if (this == o) {
105+
return true;
106+
}
107+
if (!(o instanceof CloudMonitoringResult)) {
108+
return false;
109+
}
110+
CloudMonitoringResult result = (CloudMonitoringResult) o;
111+
return workers == result.workers
112+
&& object_size == result.object_size
113+
&& app_buffer_size == result.app_buffer_size
114+
&& chunksize == result.chunksize
115+
&& crc32c_enabled == result.crc32c_enabled
116+
&& md5_enabled == result.md5_enabled
117+
&& cpu_time_us == result.cpu_time_us
118+
&& Double.compare(result.throughput, throughput) == 0
119+
&& Objects.equals(library, result.library)
120+
&& Objects.equals(api, result.api)
121+
&& Objects.equals(op, result.op)
122+
&& Objects.equals(bucket_name, result.bucket_name)
123+
&& Objects.equals(status, result.status)
124+
&& Objects.equals(transfer_size, result.transfer_size)
125+
&& Objects.equals(transfer_offset, result.transfer_offset)
126+
&& Objects.equals(failure_msg, result.failure_msg);
127+
}
128+
129+
@Override
130+
public int hashCode() {
131+
return Objects.hash(
132+
library,
133+
api,
134+
op,
135+
workers,
136+
object_size,
137+
app_buffer_size,
138+
chunksize,
139+
crc32c_enabled,
140+
md5_enabled,
141+
cpu_time_us,
142+
bucket_name,
143+
status,
144+
transfer_size,
145+
transfer_offset,
146+
failure_msg,
147+
throughput);
148+
}
149+
150+
public static class Builder {
151+
152+
private String library;
153+
private String api;
154+
private String op;
155+
private int workers;
156+
private int objectSize;
157+
private int appBufferSize;
158+
private int chunksize;
159+
private boolean crc32cEnabled;
160+
private boolean md5Enabled;
161+
private int cpuTimeUs;
162+
private String bucketName;
163+
private String status;
164+
private String transferSize;
165+
private String transferOffset;
166+
private String failureMsg;
167+
private double throughput;
168+
169+
public Builder setLibrary(String library) {
170+
this.library = library;
171+
return this;
172+
}
173+
174+
public Builder setApi(String api) {
175+
this.api = api;
176+
return this;
177+
}
178+
179+
public Builder setOp(String op) {
180+
this.op = op;
181+
return this;
182+
}
183+
184+
public Builder setWorkers(int workers) {
185+
this.workers = workers;
186+
return this;
187+
}
188+
189+
public Builder setObjectSize(int objectSize) {
190+
this.objectSize = objectSize;
191+
return this;
192+
}
193+
194+
public Builder setAppBufferSize(int appBufferSize) {
195+
this.appBufferSize = appBufferSize;
196+
return this;
197+
}
198+
199+
public Builder setChunksize(int chunksize) {
200+
this.chunksize = chunksize;
201+
return this;
202+
}
203+
204+
public Builder setCrc32cEnabled(boolean crc32cEnabled) {
205+
this.crc32cEnabled = crc32cEnabled;
206+
return this;
207+
}
208+
209+
public Builder setMd5Enabled(boolean md5Enabled) {
210+
this.md5Enabled = md5Enabled;
211+
return this;
212+
}
213+
214+
public Builder setCpuTimeUs(int cpuTimeUs) {
215+
this.cpuTimeUs = cpuTimeUs;
216+
return this;
217+
}
218+
219+
public Builder setBucketName(String bucketName) {
220+
this.bucketName = bucketName;
221+
return this;
222+
}
223+
224+
public Builder setStatus(String status) {
225+
this.status = status;
226+
return this;
227+
}
228+
229+
public Builder setTransferSize(String transferSize) {
230+
this.transferSize = transferSize;
231+
return this;
232+
}
233+
234+
public Builder setTransferOffset(String transferOffset) {
235+
this.transferOffset = transferOffset;
236+
return this;
237+
}
238+
239+
public Builder setFailureMsg(String failureMsg) {
240+
this.failureMsg = failureMsg;
241+
return this;
242+
}
243+
244+
public Builder setThroughput(double throughput) {
245+
this.throughput = throughput;
246+
return this;
247+
}
248+
249+
public CloudMonitoringResult build() {
250+
return new CloudMonitoringResult(
251+
library,
252+
api,
253+
op,
254+
workers,
255+
objectSize,
256+
appBufferSize,
257+
chunksize,
258+
crc32cEnabled,
259+
md5Enabled,
260+
cpuTimeUs,
261+
bucketName,
262+
status,
263+
transferSize,
264+
transferOffset,
265+
failureMsg,
266+
throughput);
267+
}
268+
}
269+
}

0 commit comments

Comments
 (0)