()
| 1752 | } |
| 1753 | |
| 1754 | func (u *userTSDB) acquireReadLock() error { |
| 1755 | u.stateMtx.RLock() |
| 1756 | defer u.stateMtx.RUnlock() |
| 1757 | |
| 1758 | switch u.state { |
| 1759 | case active: |
| 1760 | case activeShipping: |
| 1761 | case forceCompacting: |
| 1762 | // Read are allowed. |
| 1763 | case closing: |
| 1764 | return errors.New("TSDB is closing") |
| 1765 | default: |
| 1766 | return errors.New("TSDB is not active") |
| 1767 | } |
| 1768 | |
| 1769 | u.readInFlight.Add(1) |
| 1770 | return nil |
| 1771 | } |
| 1772 | |
| 1773 | func (u *userTSDB) releaseReadLock() { |
| 1774 | u.readInFlight.Done() |
no test coverage detected