code: func (db *DB) SetReadOnly() error {
  	if err := db.ok(); err != nil {
  		return err
  	}
  
  	// Lock writer.
  	select {
  	case db.writeLockC <- struct{}{}:
  		db.compWriteLocking = true
  	case err := <-db.compPerErrC:
  		return err
  	case <-db.closeC:
  		return ErrClosed
  	}
  
  	// Set compaction read-only.
  	select {
  	case db.compErrSetC <- ErrReadOnly:
  	case perr := <-db.compPerErrC:
  		return perr
  	case <-db.closeC:
  		return ErrClosed
  	}
  
  	return nil
  }
docs: // SetReadOnly makes DB read-only. It will stay read-only until reopened.