type BiMultimap … // NewBiMultimap creates a map. func NewBiMultimap() *BiMultimap { … } type Key … // Parse turns a string in the format namespace/name into a Key. func Parse(s string) (key Key) { … } func (k Key) String() string { … } type selectorKey … type selectingObject … type selectingObjects … type labelsKey … type labeledObject … type labeledObjects … // Put inserts or updates an object and the incoming associations // based on the object labels. func (m *BiMultimap) Put(key Key, labels map[string]string) { … } // Delete removes a labeled object and incoming associations. func (m *BiMultimap) Delete(key Key) { … } func (m *BiMultimap) delete(key Key) { … } // Exists returns true if the labeled object is present in the map. func (m *BiMultimap) Exists(key Key) bool { … } // PutSelector inserts or updates an object with a selector. Associations // are created or updated based on the selector. func (m *BiMultimap) PutSelector(key Key, selector pkglabels.Selector) { … } // DeleteSelector deletes a selecting object and associations created by its // selector. func (m *BiMultimap) DeleteSelector(key Key) { … } func (m *BiMultimap) deleteSelector(key Key) { … } // SelectorExists returns true if the selecting object is present in the map. func (m *BiMultimap) SelectorExists(key Key) bool { … } // KeepOnly retains only the specified labeled objects and deletes the // rest. Like calling Delete for all keys not specified. func (m *BiMultimap) KeepOnly(keys []Key) { … } // KeepOnlySelectors retains only the specified selecting objects and // deletes the rest. Like calling DeleteSelector for all keys not // specified. func (m *BiMultimap) KeepOnlySelectors(keys []Key) { … } // Select finds objects associated with a selecting object. If the // given key was found in the map `ok` will be true. Otherwise false. func (m *BiMultimap) Select(key Key) (keys []Key, ok bool) { … } // ReverseSelect finds objects selecting the given object. If the // given key was found in the map `ok` will be true. Otherwise false. func (m *BiMultimap) ReverseSelect(key Key) (keys []Key, ok bool) { … } func copyLabels(labels map[string]string) map[string]string { … }