src/server/enterprise/server/api_server.go
func (a *apiServer) Deactivate(ctx context.Context, req *ec.DeactivateRequest) (resp *ec.DeactivateResponse, retErr error) {
	a.LogReq(req)
	defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())

	pachClient := a.env.GetPachClient(ctx)
	if err := pachClient.DeleteAll(); err != nil {
		return nil, fmt.Errorf("could not delete all pachyderm data: %v", err)
	}

	if _, err := col.NewSTM(ctx, a.env.GetEtcdClient(), func(stm col.STM) error {
		// blind delete
		return a.enterpriseToken.ReadWrite(stm).Delete(enterpriseTokenKey)
	}); err != nil {
		return nil, err
	}

	// Wait until watcher observes the write
	if err := backoff.Retry(func() error {
		if t := a.enterpriseExpiration.Load().(time.Time); !t.IsZero() {
			return fmt.Errorf("enterprise still activated")
		}
		return nil
	}, backoff.RetryEvery(time.Second)); err != nil {
		return nil, err
	}
	time.Sleep(time.Second) // give other pachd nodes time to observe the write

	return &ec.DeactivateResponse{}, nil
}
func (a *apiServer) Deactivate(ctx context.Context, req *ec.DeactivateRequest) (resp *ec.DeactivateResponse, retErr error) {
	a.LogReq(req)
	defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())

	pachClient := a.env.GetPachClient(ctx)
	if err := pachClient.DeleteAll(); err != nil {
		return nil, fmt.Errorf("could not delete all pachyderm data: %v", err)
	}

	if _, err := col.NewSTM(ctx, a.env.GetEtcdClient(), func(stm col.STM) error {
		// blind delete
		return a.enterpriseToken.ReadWrite(stm).Delete(enterpriseTokenKey)
	}); err != nil {
		return nil, err
	}

	// Wait until watcher observes the write
	if err := backoff.Retry(func() error {
		if t := a.enterpriseExpiration.Load().(time.Time); !t.IsZero() {
			return fmt.Errorf("enterprise still activated")
		}
		return nil
	}, backoff.RetryEvery(time.Second)); err != nil {
		return nil, err
	}
	time.Sleep(time.Second) // give other pachd nodes time to observe the write

	return &ec.DeactivateResponse{}, nil
}
// Deactivate deletes the current cluster's enterprise token, and puts the
// cluster in the "NONE" enterprise state. It also deletes all data in the
// cluster, to avoid invalid cluster states. This call only makes sense for
// testing