1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-06-25 14:32:52 +02:00

Scale services concurrently

This commit is contained in:
Frederik Ring
2024-01-27 17:00:43 +01:00
parent bb37b8b1d8
commit 7ad6fc9355
2 changed files with 122 additions and 95 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt"
"io"
"os"
"sync"
)
var noop = func() error { return nil }
@ -50,3 +51,31 @@ func (b *bufferingWriter) Write(p []byte) (n int, err error) {
}
return b.writer.Write(p)
}
type noopWriteCloser struct {
io.Writer
}
func (noopWriteCloser) Close() error {
return nil
}
type handledSwarmService struct {
serviceID string
initialReplicaCount uint64
}
type concurrentSlice[T any] struct {
val []T
sync.Mutex
}
func (c *concurrentSlice[T]) append(v T) {
c.Lock()
defer c.Unlock()
c.val = append(c.val, v)
}
func (c *concurrentSlice[T]) value() []T {
return c.val
}