7661: rename MagiDirectory by_pdh as pdh_only
[arvados.git] / services / keepstore / mock_mutex_for_test.go
1 package main
2
3 type MockMutex struct {
4         AllowLock   chan struct{}
5         AllowUnlock chan struct{}
6 }
7
8 func NewMockMutex() *MockMutex {
9         return &MockMutex{
10                 AllowLock:   make(chan struct{}),
11                 AllowUnlock: make(chan struct{}),
12         }
13 }
14
15 // Lock waits for someone to send to AllowLock.
16 func (m *MockMutex) Lock() {
17         <-m.AllowLock
18 }
19
20 // Unlock waits for someone to send to AllowUnlock.
21 func (m *MockMutex) Unlock() {
22         <-m.AllowUnlock
23 }