@@ -19,7 +19,7 @@ import (
19
19
20
20
// CollectionState represents the persistent state of a collection
21
21
type CollectionState struct {
22
- ExternalSources []ExternalSource `json:"external_sources"`
22
+ ExternalSources []* ExternalSource `json:"external_sources"`
23
23
Index map [string ][]engine.Result `json:"index"`
24
24
}
25
25
@@ -29,7 +29,7 @@ type PersistentKB struct {
29
29
path string
30
30
assetDir string
31
31
maxChunkSize int
32
- sources []ExternalSource
32
+ sources []* ExternalSource
33
33
34
34
index map [string ][]engine.Result
35
35
}
@@ -48,7 +48,7 @@ func loadDB(path string) (*CollectionState, error) {
48
48
if err := json .Unmarshal (data , & legacyFiles ); err != nil {
49
49
return nil , err
50
50
}
51
- state .ExternalSources = []ExternalSource {}
51
+ state .ExternalSources = []* ExternalSource {}
52
52
state .Index = map [string ][]engine.Result {}
53
53
}
54
54
@@ -68,7 +68,7 @@ func NewPersistentCollectionKB(stateFile, assetDir string, store Engine, maxChun
68
68
Engine : store ,
69
69
assetDir : assetDir ,
70
70
maxChunkSize : maxChunkSize ,
71
- sources : []ExternalSource {},
71
+ sources : []* ExternalSource {},
72
72
index : map [string ][]engine.Result {},
73
73
}
74
74
persistentKB .Lock ()
@@ -104,7 +104,7 @@ func (db *PersistentKB) Reset() error {
104
104
for f := range db .index {
105
105
os .Remove (filepath .Join (db .assetDir , f ))
106
106
}
107
- db .sources = []ExternalSource {}
107
+ db .sources = []* ExternalSource {}
108
108
db .index = map [string ][]engine.Result {}
109
109
db .save ()
110
110
db .Unlock ()
@@ -368,14 +368,14 @@ func chunkFile(fpath string, maxchunksize int) ([]string, error) {
368
368
}
369
369
370
370
// GetExternalSources returns the list of external sources for this collection
371
- func (db * PersistentKB ) GetExternalSources () []ExternalSource {
371
+ func (db * PersistentKB ) GetExternalSources () []* ExternalSource {
372
372
db .Lock ()
373
373
defer db .Unlock ()
374
374
return db .sources
375
375
}
376
376
377
377
// AddExternalSource adds an external source to the collection
378
- func (db * PersistentKB ) AddExternalSource (source ExternalSource ) error {
378
+ func (db * PersistentKB ) AddExternalSource (source * ExternalSource ) error {
379
379
db .Lock ()
380
380
defer db .Unlock ()
381
381
0 commit comments