BackingStore defines the behaviour exposed by the underlying store implementation (e.g. file, database).
| 40 | // BackingStore defines the behaviour exposed by the underlying store |
| 41 | // implementation (e.g. file, database). |
| 42 | type BackingStore interface { |
| 43 | // Set replaces the current configuration in its entirety and updates the backing store. |
| 44 | Set(*model.Config) error |
| 45 | |
| 46 | // Load retrieves the configuration stored. If there is no configuration stored |
| 47 | // the io.ReadCloser will be nil |
| 48 | Load() ([]byte, error) |
| 49 | |
| 50 | // GetFile fetches the contents of a previously persisted configuration file. |
| 51 | // If no such file exists, an empty byte array will be returned without error. |
| 52 | GetFile(name string) ([]byte, error) |
| 53 | |
| 54 | // SetFile sets or replaces the contents of a configuration file. |
| 55 | SetFile(name string, data []byte) error |
| 56 | |
| 57 | // HasFile returns true if the given file was previously persisted. |
| 58 | HasFile(name string) (bool, error) |
| 59 | |
| 60 | // RemoveFile removes a previously persisted configuration file. |
| 61 | RemoveFile(name string) error |
| 62 | |
| 63 | // String describes the backing store for the config. |
| 64 | String() string |
| 65 | |
| 66 | // Close cleans up resources associated with the store. |
| 67 | Close() error |
| 68 | } |
| 69 | |
| 70 | // NewStoreFromBacking creates and returns a new config store given a backing store. |
| 71 | func NewStoreFromBacking(backingStore BackingStore, customDefaults *model.Config, readOnly bool) (*Store, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…