3
0
mirror of https://kolaente.dev/konrad/docker-db-backup.git synced 2026-01-10 02:50:08 +01:00

feat: move running the actual dump command to the db container

This commit is contained in:
kolaente
2021-12-05 12:39:23 +01:00
parent c5f0b46e77
commit 2e58388a0b
7 changed files with 52 additions and 67 deletions

View File

@@ -2,11 +2,12 @@ package main
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"strings"
)
type Dumper interface {
Dump() error
Dump(c *client.Client) error
}
func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
@@ -22,12 +23,12 @@ func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
return nil
}
func dumpAllDatabases() error {
func dumpAllDatabases(c *client.Client) error {
lock.Lock()
defer lock.Unlock()
for _, dumper := range store {
err := dumper.Dump()
err := dumper.Dump(c)
if err != nil {
return err
}