Skip to content

Commit a5d80e6

Browse files
committed
fix(dataconverter): align workflow type names
Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
1 parent bf7bc7d commit a5d80e6

4 files changed

Lines changed: 27 additions & 22 deletions

File tree

src/main/java/com/uber/cadence/samples/dataconverter/CompressionStarter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* <pre>
3333
* cadence --domain samples-domain \
3434
* workflow start \
35-
* --workflow_type CompressionDataConverterWorkflow \
35+
* --workflow_type CompressedDataConverterWorkflow \
3636
* --tl data-compression \
3737
* --et 60
3838
* </pre>

src/main/java/com/uber/cadence/samples/dataconverter/DataConverterConstants.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
/**
2323
* Shared identifiers for the DataConverter samples.
2424
*
25-
* <p>Each of the three samples runs on its own task list so it can have its own
26-
* {@code DataConverter}. {@code DataConverter} is bound to a {@code WorkflowClient}, and each task
27-
* list maps to one worker built from one client; that is why one process needs three clients to
28-
* host all three samples.
25+
* <p>Each of the three samples runs on its own task list so it can have its own {@code
26+
* DataConverter}. {@code DataConverter} is bound to a {@code WorkflowClient}, and each task list
27+
* maps to one worker built from one client; that is why one process needs three clients to host all
28+
* three samples.
2929
*/
3030
public final class DataConverterConstants {
3131

@@ -44,10 +44,10 @@ private DataConverterConstants() {}
4444
public static final String TASK_LIST_S3 = "data-s3";
4545

4646
/** Registered workflow type for {@code CompressedDataConverterWorkflow}. */
47-
public static final String COMPRESSION_WORKFLOW_TYPE = "CompressionDataConverterWorkflow";
47+
public static final String COMPRESSION_WORKFLOW_TYPE = "CompressedDataConverterWorkflow";
4848

4949
/** Registered workflow type for {@code EncryptedDataConverterWorkflow}. */
50-
public static final String ENCRYPTION_WORKFLOW_TYPE = "EncryptionDataConverterWorkflow";
50+
public static final String ENCRYPTION_WORKFLOW_TYPE = "EncryptedDataConverterWorkflow";
5151

5252
/** Registered workflow type for {@code S3OffloadDataConverterWorkflow}. */
5353
public static final String S3_OFFLOAD_WORKFLOW_TYPE = "S3OffloadDataConverterWorkflow";

src/main/java/com/uber/cadence/samples/dataconverter/DataConverterWorker.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import com.uber.cadence.worker.WorkerFactory;
2525

2626
/**
27-
* Hosts all three DataConverter sample workers in a single process. Each sample uses its own
28-
* {@link WorkflowClient} (and therefore its own {@link WorkerFactory}) because the
29-
* {@code DataConverter} is bound to {@code WorkflowClientOptions}.
27+
* Hosts all three DataConverter sample workers in a single process. Each sample uses its own {@link
28+
* WorkflowClient} (and therefore its own {@link WorkerFactory}) because the {@code DataConverter}
29+
* is bound to {@code WorkflowClientOptions}.
3030
*
3131
* <p>On startup the worker prints a stats banner per sample showing the visible benefit of each
3232
* pattern (compression ratio, ciphertext preview, claim-check size), then begins polling all three
@@ -38,7 +38,8 @@ private DataConverterWorker() {}
3838

3939
public static void main(String[] args) {
4040
DataConverter compressionConverter = new CompressedJsonDataConverter();
41-
DataConverter encryptionConverter = new EncryptedJsonDataConverter(EncryptionKeyLoader.loadEncryptionKey());
41+
DataConverter encryptionConverter =
42+
new EncryptedJsonDataConverter(EncryptionKeyLoader.loadEncryptionKey());
4243
LocalFsBlobStore blobStore = new LocalFsBlobStore();
4344
DataConverter s3Converter =
4445
new S3OffloadDataConverter(
@@ -119,8 +120,10 @@ private static void printCompressionStats(DataConverter converter) {
119120

120121
System.out.println();
121122
System.out.println("=== Compression Sample Statistics ===");
122-
System.out.printf("Original JSON size: %d bytes (%.2f KB)%n", originalSize, originalSize / 1024.0);
123-
System.out.printf("Compressed size: %d bytes (%.2f KB)%n", compressedSize, compressedSize / 1024.0);
123+
System.out.printf(
124+
"Original JSON size: %d bytes (%.2f KB)%n", originalSize, originalSize / 1024.0);
125+
System.out.printf(
126+
"Compressed size: %d bytes (%.2f KB)%n", compressedSize, compressedSize / 1024.0);
124127
System.out.printf("Compression ratio: %.2f%% reduction%n", pct);
125128
System.out.printf(
126129
"Space saved: %d bytes (%.2f KB)%n",
@@ -147,7 +150,7 @@ private static void printEncryptionStats(DataConverter converter) {
147150
System.out.println("=== Encryption Sample Statistics ===");
148151
System.out.printf("Plaintext JSON size: %d bytes%n", plaintextSize);
149152
System.out.printf(
150-
"Ciphertext size: %d bytes (overhead: %d bytes nonce+tag)%n",
153+
"Encrypted payload: %d bytes (growth: %d bytes vs plaintext JSON)%n",
151154
ciphertextSize, ciphertextSize - plaintextSize);
152155
System.out.printf("Ciphertext preview: %s%n", preview);
153156
System.out.printf(
@@ -164,11 +167,11 @@ private static void printS3OffloadStats(LocalFsBlobStore store) {
164167
S3OffloadDataConverterWorkflow.createS3LargePayload();
165168
byte[] jsonBytes = JsonDataConverter.getInstance().toData(payload);
166169
int jsonSize = jsonBytes == null ? 0 : jsonBytes.length;
167-
// History footprint = 1 prefix byte + JSON envelope {"__s3_ref":"<bucket>/<sha256hex>"}.
170+
// History footprint = 1 prefix byte + JSON envelope {"s3Ref":"<bucket>/<sha256hex>"}.
168171
// SHA-256 hex digest is 64 chars; bucket + "/" + 64 hex chars.
169172
int cadenceBytes =
170173
1
171-
+ ("{\"__s3_ref\":\""
174+
+ ("{\"s3Ref\":\""
172175
+ DataConverterConstants.S3_BUCKET
173176
+ "/"
174177
+ repeatChar('a', 64)
@@ -177,8 +180,10 @@ private static void printS3OffloadStats(LocalFsBlobStore store) {
177180

178181
System.out.println();
179182
System.out.println("=== S3 Offload Sample Statistics ===");
180-
System.out.printf("Full payload JSON size: %d bytes (%.2f KB)%n", jsonSize, jsonSize / 1024.0);
181-
System.out.printf("Stored in BlobStore: %d bytes (%.2f KB)%n", jsonSize, jsonSize / 1024.0);
183+
System.out.printf(
184+
"Full payload JSON size: %d bytes (%.2f KB)%n", jsonSize, jsonSize / 1024.0);
185+
System.out.printf(
186+
"Stored in BlobStore: %d bytes (%.2f KB)%n", jsonSize, jsonSize / 1024.0);
182187
System.out.printf(
183188
"Stored in Cadence history: %d bytes (claim-check reference only)%n", cadenceBytes);
184189
System.out.printf(

src/main/java/com/uber/cadence/samples/dataconverter/EncryptionStarter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
/**
2626
* Starts {@link EncryptedDataConverterWorkflow} (async, fire-and-forget).
2727
*
28-
* <p>The workflow takes no inputs and generates its own payload, so this starter does not need
29-
* the encryption key — the worker owns the key. The same effect can be achieved from the Cadence
30-
* CLI via:
28+
* <p>The workflow takes no inputs and generates its own payload, so this starter does not need the
29+
* encryption key — the worker owns the key. The same effect can be achieved from the Cadence CLI
30+
* via:
3131
*
3232
* <pre>
3333
* cadence --domain samples-domain \
3434
* workflow start \
35-
* --workflow_type EncryptionDataConverterWorkflow \
35+
* --workflow_type EncryptedDataConverterWorkflow \
3636
* --tl data-encryption \
3737
* --et 60
3838
* </pre>

0 commit comments

Comments
 (0)