github.com/micro/go-micro/v2@v2.9.1/config/source/source.go (about) 1 // Package source is the interface for sources 2 package source 3 4 import ( 5 "errors" 6 "time" 7 ) 8 9 var ( 10 // ErrWatcherStopped is returned when source watcher has been stopped 11 ErrWatcherStopped = errors.New("watcher stopped") 12 ) 13 14 // Source is the source from which config is loaded 15 type Source interface { 16 Read() (*ChangeSet, error) 17 Write(*ChangeSet) error 18 Watch() (Watcher, error) 19 String() string 20 } 21 22 // ChangeSet represents a set of changes from a source 23 type ChangeSet struct { 24 Data []byte 25 Checksum string 26 Format string 27 Source string 28 Timestamp time.Time 29 } 30 31 // Watcher watches a source for changes 32 type Watcher interface { 33 Next() (*ChangeSet, error) 34 Stop() error 35 }