Skip to content

Commit

Permalink
Expose SnapshotTime on Session
Browse files Browse the repository at this point in the history
(cherry picked from commit 1a8932b)
  • Loading branch information
kmorkos authored and dpish committed Jan 23, 2024
1 parent 5c1c188 commit be3ea3f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mongo/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ type Session interface {
// OperationTime returns the current operation time document associated with the session.
OperationTime() *primitive.Timestamp

// SnapshotTime returns the snapshot timestamp being used for the session.
// If the session is not a snapshot session, or no operations have run on the session yet, it will return nil.
SnapshotTime() *primitive.Timestamp

// Client the Client associated with the session.
Client() *Client

Expand Down Expand Up @@ -361,6 +365,11 @@ func (s *sessionImpl) OperationTime() *primitive.Timestamp {
return s.clientSession.OperationTime
}

// SnapshotTime implements the Session interface.
func (s *sessionImpl) SnapshotTime() *primitive.Timestamp {
return s.clientSession.SnapshotTime
}

// AdvanceOperationTime implements the Session interface.
func (s *sessionImpl) AdvanceOperationTime(ts *primitive.Timestamp) error {
return s.clientSession.AdvanceOperationTime(ts)
Expand Down

0 comments on commit be3ea3f

Please sign in to comment.