feat: refactor to ymsctl & yms-daemon

This commit is contained in:
2026-08-17 02:10:10 +08:00
parent 7755da72e7
commit 79f18fcdea
23 changed files with 394 additions and 47 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ const maximumRequestBytes = 1 << 20
type backendUpdater interface {
UpdateRepack(context.Context, string, backendupdate.ProgressReporter) (transaction.Transaction, error)
UpdateNativeJAR(context.Context, string, backendupdate.ProgressReporter) (transaction.Transaction, error)
UpdateContainerImage(context.Context, string, backendupdate.ProgressReporter) (transaction.Transaction, error)
UpdateContainerImage(context.Context, string, bool, backendupdate.ProgressReporter) (transaction.Transaction, error)
Restart(context.Context, backendupdate.ProgressReporter) (transaction.Transaction, error)
}
@@ -141,7 +141,7 @@ func (s *Server) handle(ctx context.Context, connection net.Conn) {
_ = s.writeResponse(connection, daemonapi.Response{Kind: daemonapi.ResponseResult, Error: "container-image requires imageReference and does not accept file"})
return
}
record, updateErr = s.updater.UpdateContainerImage(ctx, request.ImageReference, report)
record, updateErr = s.updater.UpdateContainerImage(ctx, request.ImageReference, request.StartLog, report)
default:
_ = s.writeResponse(connection, daemonapi.Response{Kind: daemonapi.ResponseResult, Error: "inputType must be repack-zip, native-jar, or container-image"})
return
+2 -2
View File
@@ -98,7 +98,7 @@ func TestServerAcceptsContainerImageThroughUnixSocket(t *testing.T) {
waitForSocket(t, socketPath, serveResult)
imageReference := "harbor.ymswell.asia/ymswell/glory-ymswell:20260813-184902-a37bf50d-v1.1.8.1"
response, err := daemonclient.UpdateContainerImage(context.Background(), socketPath, "backend", imageReference, nil)
response, err := daemonclient.UpdateContainerImage(context.Background(), socketPath, "backend", imageReference, true, nil)
if err != nil {
t.Fatalf("submit container backend image: %v", err)
}
@@ -217,7 +217,7 @@ func (u *fakeUpdater) UpdateNativeJAR(_ context.Context, file string, report bac
return u.record, u.err
}
func (u *fakeUpdater) UpdateContainerImage(_ context.Context, imageReference string, report backendupdate.ProgressReporter) (transaction.Transaction, error) {
func (u *fakeUpdater) UpdateContainerImage(_ context.Context, imageReference string, _ bool, report backendupdate.ProgressReporter) (transaction.Transaction, error) {
u.file = imageReference
u.inputType = daemonapi.InputTypeContainerImage
u.operation = daemonapi.OperationUpdate