-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqllivenesstestutils: add FakeSession
Release note: None
- Loading branch information
Showing
4 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package sqllivenesstestutils | ||
|
||
import ( | ||
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness" | ||
"github.com/cockroachdb/cockroach/pkg/util/hlc" | ||
) | ||
|
||
// FakeSession is an implementation of sqlliveness.Session for testing. | ||
type FakeSession struct { | ||
SessionID sqlliveness.SessionID | ||
ExpTS hlc.Timestamp | ||
StartTS hlc.Timestamp | ||
} | ||
|
||
var _ sqlliveness.Session = (*FakeSession)(nil) | ||
|
||
// ID returns f.SessionID. | ||
func (f *FakeSession) ID() sqlliveness.SessionID { return f.SessionID } | ||
|
||
// Expiration returns f.ExpTS. | ||
func (f *FakeSession) Expiration() hlc.Timestamp { return f.ExpTS } | ||
|
||
// Start return f.StartTS. | ||
func (f *FakeSession) Start() hlc.Timestamp { return f.StartTS } |