Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockBackend ¶
type LockBackend interface { // PrepareBackend prepares the backend for use. This is called once per lock. // Locking is aborted if this fails. PrepareBackend(ctx context.Context, lockId string) error // AcquireLock acquires the lock. This is called once per lock. Locking is aborted // if this fails. AcquireLock(ctx context.Context, contents *LockState) error // RenewLock renews the lock. This is called periodically while the lock is held. RenewLock(ctx context.Context, leaseId string) error // ReleaseLock releases the lock. This is called once per lock. ReleaseLock(ctx context.Context, leaseId string) error // RefreshDuration returns the duration between calls to RenewLock. RefreshDuration() time.Duration }
LockBackend is the interface for a lock backend.
type LockState ¶
type LockState struct { // Lockable is the lock id of the lockable resource. Lockable string // LeaseId is the lease id of the lock. LeaseId string // Start is the time the lock was acquired. Start time.Time // Expiry is the time the lock expires. Expiry time.Time // IsInDebug is true if the test is running in debug mode. IsInDebug bool // Test is the name of the test, if applicable. Test string // User is the user running the test. User string `env:"USER"` // GithubActions is true if the test is running in Github Actions. GithubActions string `env:"GITHUB_ACTIONS"` // GithubRef is the ref of the Github Actions workflow. GithubRef string `env:"GITHUB_REF"` // GithubRepository is the repository of the Github Actions workflow, e.g. `databricks/databricks-sdk-go`. GithubRepository string `env:"GITHUB_REPOSITORY"` // GithubRunId is the ID of the Github Actions run. GithubRunId string `env:"GITHUB_RUN_ID"` // GithubRunNumber is the number of the Github Actions run. GithubRunNumber string `env:"GITHUB_RUN_NUMBER"` // GithubSha is the SHA of the Github Actions commit. GithubSha string `env:"GITHUB_SHA"` // GithubWorkflow is the name of the Github Actions workflow. GithubWorkflow string `env:"GITHUB_WORKFLOW"` }
LockState represents the state of a lock.
func NewLockState ¶
func NewLockState(lockable Lockable, leaseId string, leaseDuration time.Duration, t *testing.T) *LockState
NewLockState creates a new LockState object with the given lockable, lease ID, and lease duration. If t is not nil, the test name is also set.
Click to show internal directories.
Click to hide internal directories.