func (d *dependencyFaultyDisk) disable() {
	d.mu.Lock()
	d.disabled = true
	d.mu.Unlock()
}
disabled allows the caller to temporarily disable the dependency
package writeaheadlog
import (
	"io/ioutil"
	"os"
	"sync"
	"github.com/NebulousLabs/errors"
	"github.com/NebulousLabs/fastrand"
)
func scrambleData(d []byte) []byte {
	randomData := fastrand.Bytes(len(d))
	scrambled := make([]byte, len(d), len(d))
	for i := 0; i < len(d); i++ {
		if fastrand.Intn(4) == 0 {  
			scrambled[i] = randomData[i]
		} else {
			scrambled[i] = d[i]
		}
	}
	return scrambled
}
type dependencyFaultyDisk struct {
	disabled        bool
	failed          bool
	failDenominator int
	totalWrites     int
	writeLimit      int
	mu sync.Mutex
}
func newFaultyDiskDependency(writeLimit int) *dependencyFaultyDisk {
	return &dependencyFaultyDisk{
		writeLimit: writeLimit,
	}
}
func (d *dependencyFaultyDisk) create(path string) (file, error) {
	d.mu.Lock()
	defer d.mu.Unlock()
	if d.tryFail() {
		return nil, errors.New("failed to create file (faulty disk)")
	}
	f, err := os.Create(path)
	if err != nil {
		return nil, err
	}
	return d.newFaultyFile(f), nil
}