mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
* chore: fix landing logo shadow * feat: implement service logs command with colored output and strict ordering * revert Makefile * fix after rebase * move logs command under services with root shortcut * simplify server options for streaming logs and CLI flags * refactor ContainerLogs grpc server * update --tail flag * minor docker.proto * refactor client ServiceLogs and ContainerLogs * move ProxyMachinesContext from api to client pkg * minor refactor proto Stream * add api/logs * implement LogMerger * fix LogMerger to correctly use semaphore * increate inflish entries to 100 per stream * send heartbeats * refactor ContainerLogs to synchronise Send of entries and heartbeats to the steram * minor logmerege * remove ContainerName form ServiceLogEntryMetadata * refactor ContainerLogs into docker.Service * detect stalled container logs streams * update logmerger tests * fix comment in test * refactor LogMerger with options * uc logs: format one or multiple services * make LogMerger emit heartbeats, emit entries <= watermark, rewrite tests * update uc logs with new LogMerger * go mod tidy * fix after merge --------- Co-authored-by: Evgenii Orlov <evgenii.orlov@semrush.com>
58 lines
2.1 KiB
Go
58 lines
2.1 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/api/types/volume"
|
|
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
|
)
|
|
|
|
type Client interface {
|
|
ContainerClient
|
|
DNSClient
|
|
ImageClient
|
|
MachineClient
|
|
ServiceClient
|
|
VolumeClient
|
|
}
|
|
|
|
type ContainerClient interface {
|
|
CreateContainer(
|
|
ctx context.Context, serviceID string, spec ServiceSpec, machineID string,
|
|
) (container.CreateResponse, error)
|
|
InspectContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) (MachineServiceContainer, error)
|
|
RemoveContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, opts container.RemoveOptions) error
|
|
StartContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) error
|
|
StopContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, opts container.StopOptions) error
|
|
ExecContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, config ExecOptions) (int, error)
|
|
}
|
|
|
|
type DNSClient interface {
|
|
GetDomain(ctx context.Context) (string, error)
|
|
}
|
|
|
|
type ImageClient interface {
|
|
InspectImage(ctx context.Context, id string) ([]MachineImage, error)
|
|
InspectRemoteImage(ctx context.Context, id string) ([]MachineRemoteImage, error)
|
|
}
|
|
|
|
type MachineClient interface {
|
|
InspectMachine(ctx context.Context, id string) (*pb.MachineMember, error)
|
|
ListMachines(ctx context.Context, filter *MachineFilter) (MachineMembersList, error)
|
|
UpdateMachine(ctx context.Context, req *pb.UpdateMachineRequest) (*pb.MachineInfo, error)
|
|
RenameMachine(ctx context.Context, nameOrID, newName string) (*pb.MachineInfo, error)
|
|
}
|
|
|
|
type ServiceClient interface {
|
|
RunService(ctx context.Context, spec ServiceSpec) (RunServiceResponse, error)
|
|
InspectService(ctx context.Context, id string) (Service, error)
|
|
RemoveService(ctx context.Context, id string) error
|
|
}
|
|
|
|
type VolumeClient interface {
|
|
CreateVolume(ctx context.Context, machineNameOrID string, opts volume.CreateOptions) (MachineVolume, error)
|
|
ListVolumes(ctx context.Context, filter *VolumeFilter) ([]MachineVolume, error)
|
|
RemoveVolume(ctx context.Context, machineNameOrID, volumeName string, force bool) error
|
|
}
|