move common api types to api package

This commit is contained in:
Pavel Sviderski
2024-12-05 15:17:36 +10:00
parent 88ce2d5181
commit 3ac166e6cb
7 changed files with 80 additions and 83 deletions
+4 -4
View File
@@ -10,8 +10,8 @@ import (
"github.com/docker/docker/client"
"log/slog"
"time"
"uncloud/internal/api"
"uncloud/internal/machine/store"
"uncloud/internal/service"
)
const (
@@ -152,8 +152,8 @@ func (m *Manager) syncContainersToStore(ctx context.Context) error {
// List only Uncloud service containers identified by their labels.
containers, err := m.client.ContainerList(ctx, dockercontainer.ListOptions{
Filters: filters.NewArgs(
filters.Arg("label", service.LabelServiceID),
filters.Arg("label", service.LabelServiceName),
filters.Arg("label", api.LabelServiceID),
filters.Arg("label", api.LabelServiceName),
),
})
if err != nil {
@@ -185,7 +185,7 @@ func (m *Manager) syncContainersToStore(ctx context.Context) error {
// Create or update the current Docker containers in the store.
for _, dc := range containers {
c := &service.Container{Container: dc}
c := &api.Container{Container: dc}
if err = m.store.CreateOrUpdateContainer(ctx, c, m.machineID); err != nil {
storeErr = errors.Join(storeErr, fmt.Errorf("create or update container %q: %w", c.ID, err))
}