remove attributes from periodic fingerprints when state changes

write test for client periodic fingerprinters
This commit is contained in:
Chelsea Holland Komlo
2018-01-26 14:31:37 -05:00
parent f5fc20a564
commit ae889b4fba
14 changed files with 162 additions and 4 deletions

View File

@@ -210,6 +210,17 @@ func (f *FingerprintResponse) AddAttribute(name, value string) {
f.attributes[name] = value
}
// RemoveAttribute sets the given attribute to empty, which will later remove
// it entirely from the node
func (f *FingerprintResponse) RemoveAttribute(name string) {
// initialize attributes if it has not been already
if f.attributes == nil {
f.attributes = make(map[string]string, 0)
}
f.attributes[name] = ""
}
// GetAttributes fetches the attributes for the fingerprint response
func (f *FingerprintResponse) GetAttributes() map[string]string {
// initialize attributes if it has not been already
@@ -230,6 +241,17 @@ func (f *FingerprintResponse) AddLink(name, value string) {
f.links[name] = value
}
// RemoveLink removes a link entry from the fingerprint response. This will
// later remove it entirely from the node
func (f *FingerprintResponse) RemoveLink(name string) {
// initialize links if it has not been already
if f.links == nil {
f.links = make(map[string]string, 0)
}
f.links[name] = ""
}
// GetLinks returns the links for the fingerprint response
func (f *FingerprintResponse) GetLinks() map[string]string {
// initialize links if it has not been already