Browse Source

capture the path of the data the first time we see it

Mark deVilliers 2 years ago
parent
commit
a1f229a659
2 changed files with 3 additions and 0 deletions
  1. 1 0
      node/api/metadata_store.go
  2. 2 0
      node/device_manager.go

+ 1 - 0
node/api/metadata_store.go

@@ -10,6 +10,7 @@ type Metadata struct {
10 10
 	Description string `json:"description" description:"human readable description of the data"`
11 11
 	Subject     string `json:"subject" description:"description of the data"`
12 12
 	Name        string `json:"name" description:"name of the data"`
13
+	Path        string `json:"path" description:"path to the key of the data"`
13 14
 }
14 15
 
15 16
 func NewMetadataStore() *MetadataStore {

+ 2 - 0
node/device_manager.go

@@ -96,9 +96,11 @@ func (d *device_manager) loop() {
96 96
 				currentSubject := subject.String()
97 97
 				ss, _ := utils.ParseSubject(ent.Subject)
98 98
 
99
+				// is this the first time we have seen this data?
99 100
 				if ss.IsRoot() {
100 101
 
101 102
 					m.Subject = currentSubject
103
+					m.Path = k
102 104
 					d.metaStore.Add(m)
103 105
 
104 106
 					ent.Subject = currentSubject