// AddTopic adds an http endpoint for the specified topicARN which will
// automatically handle SNS subscription confirmation, and parse message
// notifications which are sent to the goroutine callback.
432776
func (s *Server) AddTopic(topicARN, endpoint string, callback func(*Message)) {
	t := &topicDescription{
		TopicARN: topicARN,
		Callback: callback,
	}
	if endpoint[:1] != "/" {
		endpoint = "/" + endpoint
	}
	if s.topics == nil {
		s.topics = map[string]*topicDescription{
			endpoint: t,
		}
	} else {
		s.topics[endpoint] = t
	}
	if s.Logger != nil {
		s.Logger.Printf("Adding endpoint '%s' for topic '%s'\n", endpoint, topicARN)
	}
}
718618
func (s *SNSDestination) SetTopicARN(v string) *SNSDestination {
	s.TopicARN = &v
	return s
}
947033
func (c *connection) CreateTopic(req *proto.CreateTopicsReq) (*proto.CreateTopicsResp, error) {
	b, err := c.sendRequest(req)
	if err != nil {
		return nil, err
	}
	return proto.ReadCreateTopicsResp(bytes.NewReader(b))
}
105350
func (n *NSQD) DeleteExistingTopic(topicName string) error {
	n.RLock()
	topic, ok := n.topicMap[topicName]
	if !ok {
		n.RUnlock()
		return errors.New("topic does not exist")
	}
	n.RUnlock()

	// delete empties all channels and the topic itself before closing
	// (so that we dont leave any messages around)
	//
	// we do this before removing the topic from map below (with no lock)
	// so that any incoming writes will error and not create a new topic
	// to enforce ordering
	topic.Delete()

	n.Lock()
	delete(n.topicMap, topicName)
	n.Unlock()

	return nil
}
528250
func (l *Logger) SetTopic(topic string) {
	if len(topic) == 0 {
		panic("Empty tag")
	}

	l.topic.Store(topic)
}
812470
func BytesToTopic(b []byte) (t TopicType) {
	sz := TopicLength
	if x := len(b); x < TopicLength {
		sz = x
	}
	for i := 0; i < sz; i++ {
		t[i] = b[i]
	}
	return t
}
1194522
func normalizeTopicName(topic string) (result string) {
	if strings.HasPrefix(topic, "/topics/") {
		return topic
	}
	return fmt.Sprint("/topics/", topic)
}
700976
func (s *SNSAction) SetTopicArn(v string) *SNSAction {
	s.TopicArn = &v
	return s
}
368451
func GetTopic(e interface{}) string {
	switch e.(type) {
	case *events.TaskCreate:
		return runtime.TaskCreateEventTopic
	case *events.TaskStart:
		return runtime.TaskStartEventTopic
	case *events.TaskOOM:
		return runtime.TaskOOMEventTopic
	case *events.TaskExit:
		return runtime.TaskExitEventTopic
	case *events.TaskDelete:
		return runtime.TaskDeleteEventTopic
	case *events.TaskExecAdded:
		return runtime.TaskExecAddedEventTopic
	case *events.TaskExecStarted:
		return runtime.TaskExecStartedEventTopic
	case *events.TaskPaused:
		return runtime.TaskPausedEventTopic
	case *events.TaskResumed:
		return runtime.TaskResumedEventTopic
	case *events.TaskCheckpointed:
		return runtime.TaskCheckpointedEventTopic
	default:
		logrus.Warnf("no topic for type %#v", e)
	}
	return runtime.TaskUnknownTopic
}
1227369
func (s *ticketStore) addTopic(topic Topic, register bool) {
	log.Trace("Adding discovery topic", "topic", topic, "register", register)
	if s.radius[topic] == nil {
		s.radius[topic] = newTopicRadius(topic)
	}
	if register && s.tickets[topic] == nil {
		s.tickets[topic] = &topicTickets{buckets: make(map[timeBucket][]ticketRef)}
	}
}
677382
func (s *EventTopic) SetTopicName(v string) *EventTopic {
	s.TopicName = &v
	return s
}
730632
func (s *GroupsService) SetTopic(channel string, topic string) *GroupsSetTopicCall {
	var call GroupsSetTopicCall
	call.service = s
	call.channel = channel
	call.topic = topic
	return &call
}
1096517
func (s *ModifyReplicationGroupInput) SetNotificationTopicStatus(v string) *ModifyReplicationGroupInput {
	s.NotificationTopicStatus = &v
	return s
}
1354189
func (s *ListTopicsOutput) SetTopics(v []*Topic) *ListTopicsOutput {
	s.Topics = v
	return s
}
1159265
func (b *BigIP) AddNode(config *Node) error {
	return b.post(config, uriLtm, uriNode)
}
199041
func (s *RegisterEventTopicInput) SetTopicName(v string) *RegisterEventTopicInput {
	s.TopicName = &v
	return s
}
1026474
func (s *NotificationConfiguration) SetTopicConfigurations(v []*TopicConfiguration) *NotificationConfiguration {
	s.TopicConfigurations = v
	return s
}