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(firestore): adds snapshot reads impl. #6718

Merged
merged 29 commits into from Oct 17, 2022
Merged

feat(firestore): adds snapshot reads impl. #6718

merged 29 commits into from Oct 17, 2022

Conversation

telpirion
Copy link
Contributor

@telpirion telpirion commented Sep 21, 2022

This PR adds the ReadOption struct and allows callers to specify a read time for documents from the database.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: firestore Issues related to the Firestore API. labels Sep 21, 2022
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Sep 22, 2022
@telpirion telpirion marked this pull request as ready for review September 23, 2022 15:52
@telpirion telpirion requested review from enocom and a team as code owners September 23, 2022 15:52
@enocom enocom self-assigned this Sep 29, 2022
Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

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

Some general design questions first.

firestore/client.go Outdated Show resolved Hide resolved
firestore/client.go Outdated Show resolved Hide resolved
firestore/docref.go Outdated Show resolved Hide resolved
firestore/client.go Outdated Show resolved Hide resolved
firestore/client.go Outdated Show resolved Hide resolved
firestore/client.go Outdated Show resolved Hide resolved
firestore/client.go Outdated Show resolved Hide resolved
},
})

_, err := c.WithReadOptions(ReadTime(tm)).GetAll(ctx, []*DocumentRef{
Copy link
Member

Choose a reason for hiding this comment

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

Does this call fail if it doesn't match what was added with srv.addRPC above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

firestore/collref.go Outdated Show resolved Hide resolved
firestore/mock_test.go Show resolved Hide resolved
firestore/query.go Outdated Show resolved Hide resolved
firestore/transaction.go Outdated Show resolved Hide resolved
Database: db,
Transaction: tid,
},
&pb.CommitResponse{CommitTime: aTimestamp3},
Copy link
Member

Choose a reason for hiding this comment

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

Could we declare a timestamp within this test? Otherwise it's hard to know how it relates to tm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but that wouldn't really exercise anything meaningful. The mock server simply returns the response object we define here--we would be testing that we set up the response in the mock server correctly, not the read time behavior.

@telpirion telpirion requested a review from enocom October 12, 2022 20:03
firestore/client.go Outdated Show resolved Hide resolved
firestore/docref.go Outdated Show resolved Hide resolved
firestore/transaction_test.go Show resolved Hide resolved
@telpirion telpirion requested a review from enocom October 12, 2022 21:36
firestore/integration_test.go Outdated Show resolved Hide resolved
@telpirion telpirion enabled auto-merge (squash) October 17, 2022 18:16
@telpirion telpirion added the automerge Merge the pull request once unit tests and other checks pass. label Oct 17, 2022
@telpirion telpirion merged commit 43cc5bc into main Oct 17, 2022
@telpirion telpirion deleted the firestore-snapshot branch October 17, 2022 18:29
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants