// Mode retrieves the current mode of the pin.
485703
func (p *pin) Mode() Mode {
	var mode string
	mode, p.err = readFile(p.modePath)
	return Mode(mode)
}
308506
func (b *Buffer) mode(keyspace, shard string) bufferMode {
	// Actual buffering is enabled if
	// a) no keyspaces and shards were listed in particular,
	if *enabled && len(b.keyspaces) == 0 && len(b.shards) == 0 {
		// No explicit whitelist given i.e. all shards should be buffered.
		return bufferEnabled
	}
	// b) or this keyspace is listed,
	if b.keyspaces[keyspace] {
		return bufferEnabled
	}
	// c) or this shard is listed.
	keyspaceShard := topoproto.KeyspaceShardString(keyspace, shard)
	if b.shards[keyspaceShard] {
		return bufferEnabled
	}

	if *enabledDryRun {
		return bufferDryRun
	}

	return bufferDisabled
}
421853
func (fn *GaussDecayFunction) MultiValueMode(mode string) *GaussDecayFunction {
	fn.multiValueMode = mode
	return fn
}
994180
func (fi headerFileInfo) Mode() (mode os.FileMode) {
	// Set file permission bits.
	mode = os.FileMode(fi.h.Mode).Perm()
	return mode
}
604292
func (l *localFileInfo) GetModePerm() os.FileMode {
	return l.fileInfo.Mode() & os.ModePerm
}
1275271
func (s *StartAutomationExecutionInput) SetMode(v string) *StartAutomationExecutionInput {
	s.Mode = &v
	return s
}
118634
func (s *ObjectLockRetention) SetMode(v string) *ObjectLockRetention {
	s.Mode = &v
	return s
}
1142671
func (ch *channel) parseModes(modes string, modeargs ...string) {
	var modeop bool // true => add mode, false => remove mode
	var modestr string
	for i := 0; i < len(modes); i++ {
		switch m := modes[i]; m {
		case '+':
			modeop = true
			modestr = string(m)
		case '-':
			modeop = false
			modestr = string(m)
		case 'i':
			ch.modes.InviteOnly = modeop
		case 'm':
			ch.modes.Moderated = modeop
		case 'n':
			ch.modes.NoExternalMsg = modeop
		case 'p':
			ch.modes.Private = modeop
		case 'r':
			ch.modes.Registered = modeop
		case 's':
			ch.modes.Secret = modeop
		case 't':
			ch.modes.ProtectedTopic = modeop
		case 'z':
			ch.modes.SSLOnly = modeop
		case 'Z':
			ch.modes.AllSSL = modeop
		case 'O':
			ch.modes.OperOnly = modeop
		case 'k':
			if modeop && len(modeargs) != 0 {
				ch.modes.Key, modeargs = modeargs[0], modeargs[1:]
			} else if !modeop {
				ch.modes.Key = ""
			} else {
				logging.Warn("Channel.ParseModes(): not enough arguments to "+
					"process MODE %s %s%c", ch.name, modestr, m)
			}
		case 'l':
			if modeop && len(modeargs) != 0 {
				ch.modes.Limit, _ = strconv.Atoi(modeargs[0])
				modeargs = modeargs[1:]
			} else if !modeop {
				ch.modes.Limit = 0
			} else {
				logging.Warn("Channel.ParseModes(): not enough arguments to "+
					"process MODE %s %s%c", ch.name, modestr, m)
			}
		case 'q', 'a', 'o', 'h', 'v':
			if len(modeargs) != 0 {
				if nk, ok := ch.lookup[modeargs[0]]; ok {
					cp := ch.nicks[nk]
					switch m {
					case 'q':
						cp.Owner = modeop
					case 'a':
						cp.Admin = modeop
					case 'o':
						cp.Op = modeop
					case 'h':
						cp.HalfOp = modeop
					case 'v':
						cp.Voice = modeop
					}
					modeargs = modeargs[1:]
				} else {
					logging.Warn("Channel.ParseModes(): untracked nick %s "+
						"received MODE on channel %s", modeargs[0], ch.name)
				}
			} else {
				logging.Warn("Channel.ParseModes(): not enough arguments to "+
					"process MODE %s %s%c", ch.name, modestr, m)
			}
		default:
			logging.Info("Channel.ParseModes(): unknown mode char %c", m)
		}
	}
}
1370017
func (c pin) respond(err error) {
	select {
	case <-c.stop:
	case c.response <- err:
	}
}
129886
func (s *AutomationExecutionMetadata) SetMode(v string) *AutomationExecutionMetadata {
	s.Mode = &v
	return s
}
812746
func (s *DescribeEndpointsInput) SetMode(v string) *DescribeEndpointsInput {
	s.Mode = &v
	return s
}
1187391
func (s *AutomationExecution) SetMode(v string) *AutomationExecution {
	s.Mode = &v
	return s
}
900907
func (r PinVerifyRes) Format(out io.Writer) {
	if r.Ok {
		fmt.Fprintf(out, "%s ok\n", r.Cid)
	} else {
		fmt.Fprintf(out, "%s broken\n", r.Cid)
		for _, e := range r.BadNodes {
			fmt.Fprintf(out, "  %s: %s\n", e.Cid, e.Err)
		}
	}
}
695852
func (s *ImportDocumentationPartsInput) SetMode(v string) *ImportDocumentationPartsInput {
	s.Mode = &v
	return s
}
765421
func (p Pinned) String() string {
	switch p.Mode {
	case NotPinned:
		return "not pinned"
	case Indirect:
		return fmt.Sprintf("pinned via %s", p.Via)
	default:
		modeStr, _ := ModeToString(p.Mode)
		return fmt.Sprintf("pinned: %s", modeStr)
	}
}
1308625
func (p *pinner) RemovePinWithMode(c cid.Cid, mode Mode) {
	p.lock.Lock()
	defer p.lock.Unlock()
	switch mode {
	case Direct:
		p.directPin.Remove(c)
	case Recursive:
		p.recursePin.Remove(c)
	default:
		// programmer error, panic OK
		panic("unrecognized pin type")
	}
}
224463
func (c *Client) currentPin() (string, string) {
	c.mu.RLock()
	defer c.mu.RUnlock()
	return c.leader, c.pinned
}