fix databroker restart versioning, handle missing sessions (#1145)

* fix databroker restart versioning, handle missing sessions

* send empty server version to detect change

* only rebuild if there are updated records
This commit is contained in:
Caleb Doxsey 2020-07-29 08:45:41 -06:00 committed by GitHub
parent a5e8abd6af
commit 557aef2a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 62 deletions

View file

@ -402,6 +402,11 @@ func getDenyVar(vars rego.Vars) []Result {
// DataBrokerData stores the data broker data by type => id => record
type DataBrokerData map[string]map[string]interface{}
// Clear removes all the data for the given type URL from the databroekr data.
func (dbd DataBrokerData) Clear(typeURL string) {
delete(dbd, typeURL)
}
// Get gets a record from the DataBrokerData.
func (dbd DataBrokerData) Get(typeURL, id string) interface{} {
m, ok := dbd[typeURL]