Make minor changes to OasGenerator (#977)

* Added log message
* Remove Reset function from OasGenerator interface, use Stop+Start instead
* SetEntriesQuery returns a bool stating whether the query changed
This commit is contained in:
Nimrod Gilboa Markevich
2022-04-07 10:46:30 +03:00
committed by GitHub
parent 6575495fa5
commit f344bd2633

View File

@@ -22,9 +22,8 @@ type OasGenerator interface {
Start()
Stop()
IsStarted() bool
Reset()
GetServiceSpecs() *sync.Map
SetEntriesQuery(query string)
SetEntriesQuery(query string) bool
}
type defaultOasGenerator struct {
@@ -61,7 +60,7 @@ func (g *defaultOasGenerator) Stop() {
return
}
g.cancel()
g.Reset()
g.reset()
g.started = false
}
@@ -168,7 +167,7 @@ func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen {
return gen
}
func (g *defaultOasGenerator) Reset() {
func (g *defaultOasGenerator) reset() {
g.serviceSpecs = &sync.Map{}
}
@@ -176,8 +175,10 @@ func (g *defaultOasGenerator) GetServiceSpecs() *sync.Map {
return g.serviceSpecs
}
func (g *defaultOasGenerator) SetEntriesQuery(query string) {
func (g *defaultOasGenerator) SetEntriesQuery(query string) bool {
changed := g.entriesQuery != query
g.entriesQuery = query
return changed
}
func NewDefaultOasGenerator(conn *basenine.Connection) *defaultOasGenerator {