Refactor the multi-host salt install page.
[arvados.git] / services / keepstore / mock_mutex_for_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package keepstore
6
7 type MockMutex struct {
8         AllowLock   chan struct{}
9         AllowUnlock chan struct{}
10 }
11
12 func NewMockMutex() *MockMutex {
13         return &MockMutex{
14                 AllowLock:   make(chan struct{}),
15                 AllowUnlock: make(chan struct{}),
16         }
17 }
18
19 // Lock waits for someone to send to AllowLock.
20 func (m *MockMutex) Lock() {
21         <-m.AllowLock
22 }
23
24 // Unlock waits for someone to send to AllowUnlock.
25 func (m *MockMutex) Unlock() {
26         <-m.AllowUnlock
27 }