From cb4e465828b868c0f110a598fbb35b643553b502 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Mon, 4 Dec 2023 18:08:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20CheckState?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/spaces/service.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/spaces/service.go b/pkg/spaces/service.go index e77cd813..14f1cef1 100644 --- a/pkg/spaces/service.go +++ b/pkg/spaces/service.go @@ -63,3 +63,14 @@ func IsSpaceAvailable(ctx context.Context, spcs Spaces, spaceId string) error { return nil } + +func CheckState(ctx context.Context, spcs Spaces, spaceID string) error { + sp, err := spcs.Get(ctx, spaceID) + if err != nil { + return errors.Wrap(err, "fail to get space") + } + if sp.State == StateMigration { + return errors.Errorf("space '%s' is migrating, fail to do operation", sp.ID) + } + return nil +} -- GitLab