Rename replicator config to replica
This commit is contained in:
@@ -48,11 +48,11 @@ func ReadConfigFile(filename string) (Config, error) {
|
||||
}
|
||||
|
||||
type DBConfig struct {
|
||||
Path string `yaml:"path"`
|
||||
Replicators []*ReplicatorConfig `yaml:"replicators`
|
||||
Path string `yaml:"path"`
|
||||
Replicas []*ReplicaConfig `yaml:"replicas"`
|
||||
}
|
||||
|
||||
type ReplicatorConfig struct {
|
||||
type ReplicaConfig struct {
|
||||
Type string `yaml:"type"` // "file", "s3"
|
||||
Name string `yaml:"name"` // name of replicator, optional.
|
||||
Path string `yaml:"path"` // used for file replicators
|
||||
|
||||
@@ -117,7 +117,7 @@ func (m *Main) openDB(config *DBConfig) error {
|
||||
db := litestream.NewDB(config.Path)
|
||||
|
||||
// Instantiate and attach replicators.
|
||||
for _, rconfig := range config.Replicators {
|
||||
for _, rconfig := range config.Replicas {
|
||||
r, err := m.createReplicator(db, rconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -135,7 +135,7 @@ func (m *Main) openDB(config *DBConfig) error {
|
||||
}
|
||||
|
||||
// createReplicator instantiates a replicator for a DB based on a config.
|
||||
func (m *Main) createReplicator(db *litestream.DB, config *ReplicatorConfig) (litestream.Replicator, error) {
|
||||
func (m *Main) createReplicator(db *litestream.DB, config *ReplicaConfig) (litestream.Replicator, error) {
|
||||
switch config.Type {
|
||||
case "", "file":
|
||||
return m.createFileReplicator(db, config)
|
||||
@@ -145,7 +145,7 @@ func (m *Main) createReplicator(db *litestream.DB, config *ReplicatorConfig) (li
|
||||
}
|
||||
|
||||
// createFileReplicator returns a new instance of FileReplicator build from config.
|
||||
func (m *Main) createFileReplicator(db *litestream.DB, config *ReplicatorConfig) (*litestream.FileReplicator, error) {
|
||||
func (m *Main) createFileReplicator(db *litestream.DB, config *ReplicaConfig) (*litestream.FileReplicator, error) {
|
||||
if config.Path == "" {
|
||||
return nil, fmt.Errorf("file replicator path require for db %q", db.Path())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user