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

Method Delete

component/space.go:499–525  ·  view source on GitHub ↗
(ctx context.Context, namespace, name, currentUser string)

Source from the content-addressed store, hash-verified

497}
498
499func (c *SpaceComponent) Delete(ctx context.Context, namespace, name, currentUser string) error {
500 space, err := c.ss.FindByPath(ctx, namespace, name)
501 if err != nil {
502 return fmt.Errorf("failed to find space, error: %w", err)
503 }
504
505 deleteDatabaseRepoReq := types.DeleteRepoReq{
506 Username: currentUser,
507 Namespace: namespace,
508 Name: name,
509 RepoType: types.SpaceRepo,
510 }
511 _, err = c.DeleteRepo(ctx, deleteDatabaseRepoReq)
512 if err != nil {
513 return fmt.Errorf("failed to delete repo of space, error: %w", err)
514 }
515
516 err = c.ss.Delete(ctx, *space)
517 if err != nil {
518 return fmt.Errorf("failed to delete database space, error: %w", err)
519 }
520
521 // stop any running space instance
522 go c.Stop(ctx, namespace, name)
523
524 return nil
525}
526
527func (c *SpaceComponent) Deploy(ctx context.Context, namespace, name, currentUser string) (int64, error) {
528 s, err := c.ss.FindByPath(ctx, namespace, name)

Callers

nothing calls this directly

Calls 3

StopMethod · 0.95
DeleteRepoMethod · 0.65
FindByPathMethod · 0.45

Tested by

no test coverage detected