// Unregister removes a component with a given name from the component registry and returns true
// or returns false if no such component is registered.
508274
func (f *Factory) Unregister(componentName string) error {
	if _, exists := f.registry[componentName]; exists {
		delete(f.registry, componentName)
		return nil
	}
	return fmt.Errorf("Registry error: component '%s' is not registered", componentName)
}
207808
func (reg *WatchDataReg) Unregister(keyPrefix string) error {
	reg.adapter.access.Lock()
	defer reg.adapter.access.Unlock()

	subs := reg.adapter.subscriptions[reg.ResyncName]
	// verify if key is registered for change events
	if subs.ChangeChan == nil {
		// not an error
		logrus.DefaultLogger().Infof("key %v not registered for change events", keyPrefix)
		return nil
	}
	if subs.CloseChan == nil {
		return fmt.Errorf("unable to unregister key %v, close channel in subscription is nil", keyPrefix)
	}

	for index, prefix := range subs.KeyPrefixes {
		if prefix == keyPrefix {
			subs.KeyPrefixes = append(subs.KeyPrefixes[:index], subs.KeyPrefixes[index+1:]...)
			subs.CloseChan <- keyPrefix
			logrus.DefaultLogger().WithField("resyncName", reg.ResyncName).Infof("Key %v removed from subscription", keyPrefix)
			return nil
		}
	}

	return fmt.Errorf("key %v to unregister was not found", keyPrefix)
}
960793
func (mapOp *MapOperation) SetRegister(key string, value []byte) *MapOperation {
	if mapOp.removeRegisters != nil {
		delete(mapOp.removeRegisters, key)
	}
	if mapOp.registersToSet == nil {
		mapOp.registersToSet = make(map[string][]byte)
	}
	mapOp.registersToSet[key] = value
	return mapOp
}
346026
func (cs *clientStore) unregister(ID string) (*client, error) {
	cs.Lock()
	defer cs.Unlock()
	c := cs.clients[ID]
	if c == nil {
		return nil, nil
	}
	c.Lock()
	if c.hbt != nil {
		c.hbt.Stop()
		c.hbt = nil
	}
	connID := c.info.ConnID
	c.Unlock()
	delete(cs.clients, ID)
	if len(connID) > 0 {
		delete(cs.connIDs, string(connID))
	}
	if cs.waitOnRegister != nil {
		delete(cs.waitOnRegister, ID)
	}
	err := cs.store.DeleteClient(ID)
	return c, err
}
574943
func (r *PrefixedRegistry) Unregister(name string) {
	realName := r.prefix + name
	r.underlying.Unregister(realName)
}
151292
func Registry(r registry.Registry) Option {
	return func(o *Options) {
		o.Registry = r
	}
}
114808
func (r *Registry) Unregister(c Collector) bool {
	var (
		descChan    = make(chan *Desc, capDescChan)
		descIDs     = map[uint64]struct{}{}
		collectorID uint64 // Just a sum of the desc IDs.
	)
	go func() {
		c.Describe(descChan)
		close(descChan)
	}()
	for desc := range descChan {
		if _, exists := descIDs[desc.id]; !exists {
			collectorID += desc.id
			descIDs[desc.id] = struct{}{}
		}
	}

	r.mtx.RLock()
	if _, exists := r.collectorsByID[collectorID]; !exists {
		r.mtx.RUnlock()
		return false
	}
	r.mtx.RUnlock()

	r.mtx.Lock()
	defer r.mtx.Unlock()

	delete(r.collectorsByID, collectorID)
	for id := range descIDs {
		delete(r.descIDs, id)
	}
	// dimHashesByName is left untouched as those must be consistent
	// throughout the lifetime of a program.
	return true
}
936817
func (f *lightFetcher) unregisterPeer(p *peer) {
	p.lock.Lock()
	p.hasBlock = nil
	p.lock.Unlock()

	f.lock.Lock()
	defer f.lock.Unlock()

	// check for potential timed out block delay statistics
	f.checkUpdateStats(p, nil)
	delete(f.peers, p)
}
220658
func NewRegistry() *Registry {
	return &Registry{
		collectorsByID:  map[uint64]Collector{},
		descIDs:         map[uint64]struct{}{},
		dimHashesByName: map[string]uint64{},
	}
}
1287986
func NewRegistry() *Registry {
	r := &Registry{}
	r.functions = make(map[string]*function)
	return r
}
1220460
func (m *MultiplexedListener) UnregisterListener(ltype common.ListenerType) error {
	m.Lock()
	defer m.Unlock()

	delete(m.protomap, ltype)

	return nil
}
1086905
func Unregister(name string, port int) error {
	// service doesn't have a name or has an invalid port
	svc := &Service{name, port, os.Getenv("HOSTNAME")}
	if err := svc.validate(); err != nil {
		log.WithFields(log.Fields{
			"action":  "Validate",
			"service": name,
			"port":    svc.Port,
			"errstr":  err.Error(),
		}).Error("Service Validation Failed.")
		return err
	}

	// initialize a new etcd client
	c, err := client.New(cfg)
	if err != nil {
		log.WithFields(log.Fields{"service": "portmapper", "errstr": err.Error()}).Fatal("Error initializing etcd client")
		panic(err)
	}

	kAPI := client.NewKeysAPI(c)

	// attempt to delete the svc's path with exponential backoff
	for try := 0; try < MaxRetries; try++ {
		// 5 second context
		ctx, cancel := context.WithTimeout(context.Background(), RequestTimeoutSec*time.Second)
		defer cancel()

		_, err = kAPI.Delete(ctx, svc.path(), nil)
		if err != nil {
			// handle error
			if err == context.DeadlineExceeded {
				log.WithFields(log.Fields{
					"action":  "Validate",
					"service": name,
					"port":    svc.Port,
					"attempt": try,
					"errstr":  err.Error(),
				}).Warn("Service path deletion exceeded context deadline. Retrying")
			} else {
				log.WithFields(log.Fields{
					"action":  "Validate",
					"service": name,
					"port":    svc.Port,
					"errstr":  err.Error(),
				}).Error("Service path deletion failed.")
				return err
			}
		} else {
			log.WithFields(log.Fields{
				"action":  "set",
				"service": name,
				"port":    svc.Port,
				"path":    svc.path(),
			}).Info("Successfully unregistered service with etcd")
			break
		}

		time.Sleep(2 << uint(try) * time.Millisecond)
	}

	return nil
}
674114
func Uninstall(context Context, components []string, log Log) keybase1.UninstallResult {
	return keybase1.UninstallResult{}
}
1136391
func (nu *Numbered) Unregister(id int64, reason string) {
	success := nu.unregister(id, reason)
	if success {
		nu.recentlyUnregistered.Set(
			fmt.Sprintf("%v", id), &unregistered{reason: reason, timeUnregistered: time.Now()})
	}
}
1244123
func (c *Connect) UnregisterCloseCallback() error {
	connData := getConnectionData(c)
	if connData.closeCallbackId == nil {
		return nil
	}
	var err C.virError
	res := C.virConnectUnregisterCloseCallbackWrapper(c.ptr, &err)
	if res != 0 {
		return makeError(&err)
	}
	connData.closeCallbackId = nil
	return nil
}
940094
func (ps *peerSet) Unregister(id string) error {
	ps.lock.Lock()
	p, ok := ps.peers[id]
	if !ok {
		defer ps.lock.Unlock()
		return errNotRegistered
	}
	delete(ps.peers, id)
	ps.lock.Unlock()

	ps.peerDropFeed.Send(p)
	return nil
}
1009804
func (qri *Map) UnRegisterSource(ruleSource string) {
	qri.mu.Lock()
	defer qri.mu.Unlock()
	delete(qri.queryRulesMap, ruleSource)
}