Massive architectural rework

This commit massively overhauls the project's structure to simplify
development. Most parts are now correctly compartmentalized and
dependencies are passed in a sane way rather than global variables
galore xd.
This commit is contained in:
Zoe
2025-05-02 12:15:40 -05:00
parent f4bf2ff5a1
commit c891c24843
50 changed files with 2684 additions and 2410 deletions

37
internal/docker/volume.go Normal file
View File

@@ -0,0 +1,37 @@
package docker
import (
"context"
"fmt"
"github.com/docker/docker/api/types/volume"
"go.uber.org/zap"
)
type DockerVolume struct {
VolumeID string
Mountpoint string
}
func (d *DockerClient) CreateDockerVolume(ctx context.Context) (vol *DockerVolume, err error) {
dockerVolume, err := d.client.VolumeCreate(ctx, volume.CreateOptions{
Driver: "local",
DriverOpts: map[string]string{},
})
if err != nil {
return nil, fmt.Errorf("failed to create volume: %v", err)
}
d.logger.Debugw("Volume created", zap.String("volume_id", dockerVolume.Name), zap.String("mountpoint", dockerVolume.Mountpoint))
vol = &DockerVolume{
VolumeID: dockerVolume.Name,
}
return vol, nil
}
func (d *DockerClient) DeleteDockerVolume(ctx context.Context, volumeID string) error {
d.logger.Debugw("Removing volume", zap.String("volume_id", volumeID))
return d.client.VolumeRemove(ctx, volumeID, true)
}