Skip to content

Commit

Permalink
Merge pull request #12 from kmorkos/BAAS-26195
Browse files Browse the repository at this point in the history
BAAS-26195: Expose SnapshotTime on Session
  • Loading branch information
mpobrien authored Nov 20, 2023
2 parents 5f1738c + 1a8932b commit 5cd00b5
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 @@ -123,6 +123,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 @@ -362,6 +366,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 5cd00b5

Please sign in to comment.