2424import 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 (
0 commit comments