MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / status

Method status

component/space.go:646–675  ·  view source on GitHub ↗
(ctx context.Context, s *database.Space)

Source from the content-addressed store, hash-verified

644}
645
646func (c *SpaceComponent) status(ctx context.Context, s *database.Space) (string, string, error) {
647 if !s.HasAppFile {
648 if s.Sdk == scheduler.NGINX.Name {
649 return "", SpaceStatusNoNGINXConf, nil
650 }
651 return "", SpaceStatusNoAppFile, nil
652 }
653 // get latest Deploy for space by space id
654 deploy, err := c.deploy.GetLatestDeployBySpaceID(ctx, s.ID)
655 if err != nil || deploy == nil {
656 slog.Error("fail to get latest space deploy by space id", slog.Any("SpaceID", s.ID))
657 return "", SpaceStatusStopped, fmt.Errorf("can't get space deployment,%w", err)
658 }
659
660 namespace, name := s.Repository.NamespaceAndName()
661 // request space deploy status by deploy id
662 srvName, code, _, err := c.deployer.Status(ctx, types.DeployRepo{
663 DeployID: deploy.ID,
664 SpaceID: deploy.SpaceID,
665 ModelID: deploy.ModelID,
666 Namespace: namespace,
667 Name: name,
668 SvcName: deploy.SvcName,
669 }, true)
670 if err != nil {
671 slog.Error("error happen when get space status", slog.Any("error", err), slog.String("path", s.Repository.Path))
672 return "", SpaceStatusStopped, err
673 }
674 return srvName, deployStatusCodeToString(code), nil
675}
676
677func (c *SpaceComponent) Status(ctx context.Context, namespace, name string) (string, string, error) {
678 s, err := c.ss.FindByPath(ctx, namespace, name)

Callers 6

ShowMethod · 0.95
IndexMethod · 0.95
UserSpacesMethod · 0.95
UserLikesSpacesMethod · 0.95
ListByPathMethod · 0.95
StatusMethod · 0.95

Calls 5

deployStatusCodeToStringFunction · 0.85
ErrorMethod · 0.80
StatusMethod · 0.65
NamespaceAndNameMethod · 0.45

Tested by

no test coverage detected