// channels returns a flat slice of all channels in all topics
762557
func (n *NSQD) channels() []*Channel {
	var channels []*Channel
	n.RLock()
	for _, t := range n.topicMap {
		t.RLock()
		for _, c := range t.channelMap {
			channels = append(channels, c)
		}
		t.RUnlock()
	}
	n.RUnlock()
	return channels
}
274577
func Subscribe(topic string, channel string) *Command {
	var params = [][]byte{[]byte(topic), []byte(channel)}
	return &Command{[]byte("SUB"), params, nil}
}
1167704
func (s *ChannelsService) Info(channel string) *ChannelsInfoCall {
	var call ChannelsInfoCall
	call.service = s
	call.channel = channel
	return &call
}
473097
func (evR *EvidenceReactor) GetChannels() []*p2p.ChannelDescriptor {
	return []*p2p.ChannelDescriptor{
		{
			ID:       EvidenceChannel,
			Priority: 5,
		},
	}
}
503823
func (s *AiffSettings) SetChannels(v int64) *AiffSettings {
	s.Channels = &v
	return s
}
909045
func (c *APIClient) ChannelsList() ([]*Channel, error) {
	dest := ChannelsList{}
	if err := c.slackMethodAndParse("channels.list", &dest); err != nil {
		return nil, err
	}

	return dest.Channels, nil
}
450997
func (d *DB) FetchAllChannels() ([]*OpenChannel, error) {
	var channels []*OpenChannel

	// TODO(halseth): fetch all in one db tx.
	openChannels, err := d.FetchAllOpenChannels()
	if err != nil {
		return nil, err
	}
	channels = append(channels, openChannels...)

	pendingChannels, err := d.FetchPendingChannels()
	if err != nil {
		return nil, err
	}
	channels = append(channels, pendingChannels...)

	waitingClose, err := d.FetchWaitingCloseChannels()
	if err != nil {
		return nil, err
	}
	channels = append(channels, waitingClose...)

	return channels, nil
}
1104241
func (n *NotifyRouter) SetChannels(i ConnectionID, nc keybase1.NotificationChannels) {
	n.setNotificationChannels(i, nc)
}
67252
func (memR *MempoolReactor) GetChannels() []*p2p.ChannelDescriptor {
	return []*p2p.ChannelDescriptor{
		{
			ID:       MempoolChannel,
			Priority: 5,
		},
	}
}
1242075
func (c *chatLocal) GetChannels(
	ctx context.Context, tlfName tlf.CanonicalName, tlfType tlf.Type,
	chatType chat1.TopicType) (
	convIDs []chat1.ConversationID, channelNames []string, err error) {
	if chatType != chat1.TopicType_KBFSFILEEDIT {
		panic(fmt.Sprintf("Bad topic type: %d", chatType))
	}

	c.data.lock.RLock()
	defer c.data.lock.RUnlock()
	byID := c.data.convs[tlfType][tlfName]
	for _, conv := range byID {
		convIDs = append(convIDs, conv.convID)
		channelNames = append(channelNames, conv.chanName)
	}
	return convIDs, channelNames, nil
}
135772
func (st *stateTracker) Topic(c, topic string) *Channel {
	st.mu.Lock()
	defer st.mu.Unlock()
	ch, ok := st.chans[c]
	if !ok {
		return nil
	}
	ch.topic = topic
	return ch.Channel()
}
988257
func (s *WavSettings) SetChannels(v int64) *WavSettings {
	s.Channels = &v
	return s
}
789414
func (st *stateTracker) ChannelModes(c, modes string, args ...string) *Channel {
	st.mu.Lock()
	defer st.mu.Unlock()
	ch, ok := st.chans[c]
	if !ok {
		return nil
	}
	ch.parseModes(modes, args...)
	return ch.Channel()
}
482632
func (s *Session) UserChannels() (st []*Channel, err error) {

	body, err := s.RequestWithBucketID("GET", EndpointUserChannels("@me"), nil, EndpointUserChannels(""))
	if err != nil {
		return
	}

	err = unmarshal(body, &st)
	return
}
391123
func (s *Server) GetChannel(name string) (*Channel, bool) {
	ch, ok := s.channels[name]
	return ch, ok
}
607955
func (m *ChannelDeMultiplexer) AddChannel(predicate common.MessageAcceptor) chan interface{} {
	m.lock.Lock()
	defer m.lock.Unlock()
	ch := &channel{ch: make(chan interface{}, 10), pred: predicate}
	m.channels = append(m.channels, ch)
	return ch.ch
}
1160923
func (c *Client) ListChannels() (rec []ChannelInfo, err error) {
	req, err := newGETRequest(c, "channels")
	if err != nil {
		return []ChannelInfo{}, err
	}

	if err = executeAndParseRequest(c, req, &rec); err != nil {
		return []ChannelInfo{}, err
	}

	return rec, nil
}