Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add TTL support to OpenSaves #458

Merged
merged 12 commits into from
Mar 13, 2025
Merged

Conversation

Zurvarian
Copy link
Contributor

Add TTL support for both Records and Blobs via the new field ExpiresAt.

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind fix
/kind feat
/kind build
/kind chore
/kind ci
/kind docs
/kind style
/kind refactor
/kind perf
/kind test

What this PR does / Why we need it:
This PR adds a new ExpiresAt field to Records and Blobs.
Also handles that the new ExpiresAt value is inherited by Blobs when these are attached to Records.

Finally, to prevent needing to add ExpiresAt to Chunks, it changes the behavior of the chunk update to delete the previously existing chunk.

Which issue(s) this PR fixes:

Closes #457

Special notes for your reviewer:

@@ -668,15 +718,6 @@ func (s *openSavesServer) UploadChunk(stream pb.OpenSaves_UploadChunkServer) err
return stream.SendAndClose(chunk.ToProto())
}

// deleteObjectOnExit deletes the object from GS if there are errors uploading the data or inserting a chunkref
func (s *openSavesServer) deleteObjectOnExit(ctx context.Context, path string) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the pattern in this file, I've moved this helper function on top of the public function that is using it.

@@ -623,6 +637,12 @@ func (m *MetaDB) PromoteBlobRefWithRecordUpdater(ctx context.Context, blob *blob
}
}

// Call the custom defined updater method as well to modify the record.
record, err := updater(record)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to update the record previously to update the Blob, this is because the record could have its ExpiresAt updated, and thus we need to update the Blob's too.

@Zurvarian Zurvarian marked this pull request as ready for review March 11, 2025 15:02
@Zurvarian
Copy link
Contributor Author

Missing UT for the new Collector.

@lorangf
Copy link
Collaborator

lorangf commented Mar 11, 2025

/gcbrun

@Zurvarian
Copy link
Contributor Author

Zurvarian commented Mar 12, 2025

@vasconcelosvcd @lorangf I've fixed the failing test though, please, wait until I add the missing UT for the Async Collector to run /gcbrun again.

EDIT: I've added the missing test.

Copy link

@Qohar97 Qohar97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasconcelosvcd
Copy link
Collaborator

/gcbrun

@googleforgames googleforgames deleted a comment from QoHaR-1997 Mar 12, 2025
@vasconcelosvcd
Copy link
Collaborator

/gcbrun

@Zurvarian Zurvarian requested a review from lorangf March 12, 2025 13:52
@vasconcelosvcd
Copy link
Collaborator

/gcbrun

@lorangf lorangf requested a review from vasconcelosvcd March 13, 2025 00:47
Copy link
Collaborator

@lorangf lorangf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

We should be create a new release and bump up the minor version at a minimum since there were some changes in the interface but nothing that is not backward compatible.

@vasconcelosvcd vasconcelosvcd merged commit ae8df3b into googleforgames:main Mar 13, 2025
4 checks passed
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.

Add TTL support for Records and Blobs
4 participants