Skip to content

feat: allow for object versioining in gcp aws - #2628

Open
ppatel9703 wants to merge 28 commits into
devfrom
aws-gcp-object-versioning
Open

feat: allow for object versioining in gcp aws#2628
ppatel9703 wants to merge 28 commits into
devfrom
aws-gcp-object-versioning

Conversation

@ppatel9703

@ppatel9703 ppatel9703 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Object Versioning Support for AWS S3 & Google Cloud Storage

Summary

Adds object versioning support to the SEMOSS storage layer for AWS S3 and Google Cloud Storage engines. The approach is minimal: copyToStorage now returns a String (the version ID) instead of void. When bucket versioning is enabled, the SDK naturally returns the version identifier — we simply capture and surface it. No extra configuration, detection logic, or .smss properties needed.

Changes

Interface & Base Class

  • IStorageEngine.java — Changed void copyToStorage(...)String copyToStorage(...). Added listVersions(path) and copyToLocal(path, dir, versionId) as default methods.
  • AbstractStorageEngine.java — Cleaned up (removed unused versioning fields)

Engine Implementations (return version ID)

  • AWSNativeBlobStorageEngine.javacopyToStorage returns PutObjectResponse.versionId() (null when versioning disabled). Added listVersions() (ListObjectVersions API) and copyToLocal(..., versionId) (GetObjectRequest with versionId).
  • GoogleCloudNativeBlobStorageEngine.javacopyToStorage returns Blob.getGeneration() as String. Added listVersions() (BlobListOption.versions(true)) and copyToLocal(..., versionId) (BlobId with generation).

Engine Implementations (return null — no versioning)

  • AzureNativeBlobStorageEngine.javavoidString, returns null
  • AbstractRCloneStorageEngine.javavoidString, returns null
  • DeveloperLocalFileSystemStorageEngine.javavoidString, returns null
  • SFTPStorageEngine.javavoidString, returns null
  • JCIFSStorageEngine.javavoidString, returns null

Reactors

  • PushToStorageReactor.java — Calls copyToStorage, if return is non-null returns {success: true, versionId: "..."} as MAP, otherwise returns boolean true
  • PullFromStorageReactor.java — Accepts optional version parameter; delegates to versioned copyToLocal when provided
  • ListStorageVersionsReactor.java (new) — Lists all versions of a specific storage object

Pixel Usage

// Upload — returns versionId when bucket versioning is enabled
PushToStorage(storage=["<id>"], storagePath=["folder"], filePath=["/file.pdf"]);
// → {success: true, versionId: "rAIoC2FkJ_VVnsU0hSSRk9Uz.WPaQU7Q"}

// Download specific version
PullFromStorage(storage=["<id>"], storagePath=["folder/file.pdf"], filePath=["downloads"], version=["rAIoC2FkJ_..."]);

// List all versions of a file
ListStorageVersions(storage=["<id>"], storagePath=["folder/file.pdf"]);
// → [{versionId, lastModified, size, isLatest, key}, ...]

Design Decisions

  • Return type change over separate methods — Instead of adding copyToStorageVersioned(), isVersioningEnabled(), or .smss config, we simply changed the return type. The SDK always returns version info when versioning is on — no detection needed.
  • Null = no versioning — Engines without versioning support return null. Callers (PushToStorageReactor) branch on null vs non-null.
  • Backward compatible — Callers that previously ignored the void return continue to work (Java allows discarding return values). No breaking changes to existing Pixel scripts or CentralCloudStorage.
  • Interface default methodslistVersions() and versioned copyToLocal() throw UnsupportedOperationException by default. Only AWS/GCS override them.

Testing

  • Verified on S3 bucket (parth-semoss-test, us-east-2) with versioning enabled
  • PushToStorage returns versionId: "rAIoC2FkJ_VVnsU0hSSRk9Uz.WPaQU7Q"
  • Multiple uploads of same file produce different versionIds
  • ListStorageVersions returns version history with isLatest flag
  • PullFromStorage with version param downloads specific version

Files Changed (12)

File Change
src/prerna/engine/api/IStorageEngine.java voidString return; +2 default methods
src/prerna/engine/impl/storage/AbstractStorageEngine.java Removed unused versioning fields
src/prerna/engine/impl/storage/AWSNativeBlobStorageEngine.java Returns versionId; +listVersions, +versioned download
src/prerna/engine/impl/storage/GoogleCloudNativeBlobStorageEngine.java Returns generation; +listVersions, +versioned download
src/prerna/engine/impl/storage/AzureNativeBlobStorageEngine.java voidString, returns null
src/prerna/engine/impl/storage/AbstractRCloneStorageEngine.java voidString, returns null
src/prerna/engine/impl/storage/DeveloperLocalFileSystemStorageEngine.java voidString, returns null
src/prerna/engine/impl/storage/SFTPStorageEngine.java voidString, returns null
src/prerna/engine/impl/storage/JCIFSStorageEngine.java voidString, returns null
src/prerna/reactor/storage/PushToStorageReactor.java Simplified — checks non-null versionId
src/prerna/reactor/storage/PullFromStorageReactor.java +optional version param
src/prerna/reactor/storage/ListStorageVersionsReactor.java New reactor

AWS NATIVE BLOB TEST
image
image

GCP STORAGE TEST
image
image

@ppatel9703
ppatel9703 requested a review from a team as a code owner June 11, 2026 14:06
@mattfreshwaters

Copy link
Copy Markdown
Contributor
Screenshot 2026-06-15 at 9 34 48 AM Here is the behavior when versioning is turned OFF for GCS - same document uploaded twice, only one persists.

@snyk-io

snyk-io Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants