// DisableWAL sets whether WAL should be active or not.
// If true, writes will not first go to the write ahead log,
// and the write may got lost after a crash.
// Default: false
7274
func (opts *WriteOptions) DisableWAL(value bool) {
	C.rocksdb_writeoptions_disable_WAL(opts.c, C.int(btoi(value)))
}
16458
func MigrateWAL(logger log.Logger, dir string) (err error) {
	if logger == nil {
		logger = log.NewNopLogger()
	}
	if exists, err := deprecatedWALExists(logger, dir); err != nil || !exists {
		return err
	}
	level.Info(logger).Log("msg", "migrating WAL format")

	tmpdir := dir + ".tmp"
	if err := os.RemoveAll(tmpdir); err != nil {
		return errors.Wrap(err, "cleanup replacement dir")
	}
	repl, err := wal.New(logger, nil, tmpdir)
	if err != nil {
		return errors.Wrap(err, "open new WAL")
	}

	// It should've already been closed as part of the previous finalization.
	// Do it once again in case of prior errors.
	defer func() {
		if err != nil {
			repl.Close()
		}
	}()

	w, err := OpenSegmentWAL(dir, logger, time.Minute, nil)
	if err != nil {
		return errors.Wrap(err, "open old WAL")
	}
	defer w.Close()

	rdr := w.Reader()

	var (
		enc RecordEncoder
		b   []byte
	)
	decErr := rdr.Read(
		func(s []RefSeries) {
			if err != nil {
				return
			}
			err = repl.Log(enc.Series(s, b[:0]))
		},
		func(s []RefSample) {
			if err != nil {
				return
			}
			err = repl.Log(enc.Samples(s, b[:0]))
		},
		func(s []Stone) {
			if err != nil {
				return
			}
			err = repl.Log(enc.Tombstones(s, b[:0]))
		},
	)
	if decErr != nil {
		return errors.Wrap(err, "decode old entries")
	}
	if err != nil {
		return errors.Wrap(err, "write new entries")
	}
	// We explicitly close even when there is a defer for Windows to be
	// able to delete it. The defer is in place to close it in-case there
	// are errors above.
	if err := w.Close(); err != nil {
		return errors.Wrap(err, "close old WAL")
	}
	if err := repl.Close(); err != nil {
		return errors.Wrap(err, "close new WAL")
	}
	if err := fileutil.Replace(tmpdir, dir); err != nil {
		return errors.Wrap(err, "replace old WAL")
	}
	return nil
}
1102418
func (c *Config) DisableNetworkManagement() (bool, bool) {
	v, ok := c.defined["disable-network-management"].(bool)
	return v, ok
}
739933
func ListWAL(ctx context.Context, s logical.Storage) ([]string, error) {
	keys, err := s.List(ctx, WALPrefix)
	if err != nil {
		return nil, err
	}

	for i, k := range keys {
		keys[i] = strings.TrimPrefix(k, WALPrefix)
	}

	return keys, nil
}
528066
func (b *Bot) Disable(cmds []string) {
	b.disabledCmds = append(b.disabledCmds, cmds...)
}
1111623
func NewWAL(path string) *WAL {
	logger := zap.NewNop()
	return &WAL{
		path:    path,
		enabled: true,

		// these options should be overridden by any options in the config
		SegmentSize: DefaultSegmentSize,
		closing:     make(chan struct{}),
		syncWaiters: make(chan chan error, 1024),
		limiter:     limiter.NewFixed(defaultWaitingWALWrites),
		logger:      logger,
	}
}
747251
func (j *JournalManager) EnableAuto(ctx context.Context) error {
	j.lock.Lock()
	defer j.lock.Unlock()
	if j.serverConfig.EnableAuto {
		// Nothing to do.
		return nil
	}

	j.log.CDebugf(ctx, "Enabling auto-journaling")
	j.serverConfig.EnableAuto = true
	j.serverConfig.EnableAutoSetByUser = true
	return j.writeConfig()
}
577477
func (provider *Provider) IsEnabledForLevel(level Level) bool {
	return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0))
}
220659
func (m *BaseMechanismManager) Disable() {
	atomic.StoreInt64(&m.activated, 0)
	atomic.StoreInt64(&m.enabled, 0)

	m.Mechanisms.Iter(func(_ string, mechanism Mechanism) bool {
		mechanism.Disable()
		return true
	})
}
856577
func (comments *Comments) Disable() error {
	switch comments.item.media.(type) {
	case *StoryMedia:
		return fmt.Errorf("Incompatible type. Cannot use Disable() with StoryMedia type")
	default:
	}

	insta := comments.item.media.instagram()
	data, err := insta.prepareData(
		map[string]interface{}{
			"media_id": comments.item.ID,
		},
	)
	if err != nil {
		return err
	}

	_, err = insta.sendRequest(
		&reqOptions{
			Endpoint: fmt.Sprintf(urlCommentDisable, comments.item.ID),
			Query:    generateSignature(data),
			IsPost:   true,
		},
	)
	return err
}
1254083
func (s *ReceiptRule) SetEnabled(v bool) *ReceiptRule {
	s.Enabled = &v
	return s
}
199852
func (s *AccountSettings) SetEnableDialOut(v bool) *AccountSettings {
	s.EnableDialOut = &v
	return s
}
55094
func (s *SetPermissionInput) SetAllowSsh(v bool) *SetPermissionInput {
	s.AllowSsh = &v
	return s
}
1374688
func (l *WAL) Close() error {
	l.mu.Lock()
	defer l.mu.Unlock()

	l.once.Do(func() {
		// Close, but don't set to nil so future goroutines can still be signaled
		l.traceLogger.Info("Closing WAL file", zap.String("path", l.path))
		close(l.closing)

		if l.currentSegmentWriter != nil {
			l.sync()
			l.currentSegmentWriter.close()
			l.currentSegmentWriter = nil
		}
	})

	return nil
}
470305
func (p *Plugin) IsEnabled() bool {
	p.mu.RLock()
	defer p.mu.RUnlock()

	return p.PluginObj.Enabled
}
1094948
func (u *User) Disable() error {
	if err := u.ensureNotDeleted(); err != nil {
		return errors.Annotate(err, "cannot disable")
	}
	owner, err := u.st.ControllerOwner()
	if err != nil {
		return errors.Trace(err)
	}
	if u.doc.Name == owner.Name() {
		return errors.Unauthorizedf("cannot disable controller model owner")
	}
	return errors.Annotatef(u.setDeactivated(true), "cannot disable user %q", u.Name())
}
456849
func (m *mapReact) DisableAll() {
	m.ro.Lock()
	for ms := range m.ma {
		m.ma[ms] = false
	}
	m.ro.Unlock()
}