// UpdateKeyspace updates the keyspace data. It checks the keyspace is locked.
359805
func (ts *Server) UpdateKeyspace(ctx context.Context, ki *KeyspaceInfo) error {
	// make sure it is locked first
	if err := CheckKeyspaceLocked(ctx, ki.keyspace); err != nil {
		return err
	}

	data, err := proto.Marshal(ki.Keyspace)
	if err != nil {
		return err
	}
	keyspacePath := path.Join(KeyspacesPath, ki.keyspace, KeyspaceFile)
	version, err := ts.globalCell.Update(ctx, keyspacePath, data, ki.version)
	if err != nil {
		return err
	}
	ki.version = version

	event.Dispatch(&events.KeyspaceChange{
		KeyspaceName: ki.keyspace,
		Keyspace:     ki.Keyspace,
		Status:       "updated",
	})
	return nil
}
114285
func (client *Client) UpdateSpaceDeveloper(spaceGUID string, uaaID string) (Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PutSpaceDeveloperRequest,
		URIParams: map[string]string{
			"space_guid":     spaceGUID,
			"developer_guid": uaaID,
		},
	})
	if err != nil {
		return Warnings{}, err
	}

	response := cloudcontroller.Response{}
	err = client.connection.Make(request, &response)
	return response.Warnings, err
}
331715
func (l *DB) GetOrCreateKeyspace(name string) (ks Keyspace, err error) {
    err = l.db.Update(func(tx *bolt.Tx) error {
        _, er := tx.CreateBucketIfNotExists([]byte(name))

        ks = &BoltKeyspace{name, l.db}
        return er
    })
    return ks, err
}
836464
func SetNamespace(namespace string) VisitorFunc {
	return func(info *Info, err error) error {
		if err != nil {
			return err
		}
		if !info.Namespaced() {
			return nil
		}
		if len(info.Namespace) == 0 {
			info.Namespace = namespace
			UpdateObjectNamespace(info, nil)
		}
		return nil
	}
}
430354
func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, keyspace string, cells []string) (err error) {
	ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "RebuildKeyspace")
	if lockErr != nil {
		return lockErr
	}
	defer unlock(&err)

	return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cells)
}
411319
func (s *Metric) SetNamespace(v string) *Metric {
	s.Namespace = &v
	return s
}
718517
func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string) error {
	a, key, err := ks.getDecryptedKey(a, passphrase)
	if err != nil {
		return err
	}
	return ks.storage.StoreKey(a.URL.Path, key, newPassphrase)
}
647220
func updateMaps(xu *xgbutil.XUtil, e xevent.MappingNotifyEvent) {
	keyMap, modMap := MapsGet(xu)

	// So we used to go through the old mapping and the new mapping and pick
	// out precisely where there are changes. But after allowing for a
	// one-to-many mapping from keysym to keycodes, this process became too
	// complex. So we're going to bust out our hammer and rebind everything
	// based on the initial key strings.
	if e.Request == xproto.MappingKeyboard {
		// We must ungrab everything first, in case two keys are being swapped.
		keys := keyKeys(xu)
		for _, key := range keys {
			Ungrab(xu, key.Win, key.Mod, key.Code)
			detach(xu, key.Evtype, key.Win)
		}

		// Wipe the slate clean.
		xu.KeybindsLck.Lock()
		xu.Keybinds = make(map[xgbutil.KeyKey][]xgbutil.CallbackKey, len(keys))
		xu.Keygrabs = make(map[xgbutil.KeyKey]int, len(keys))
		keyStrs := xu.Keystrings
		xu.KeybindsLck.Unlock()

		// Update our mappings before rebinding.
		KeyMapSet(xu, keyMap)
		ModMapSet(xu, modMap)

		// Now rebind everything in Keystrings
		for _, ks := range keyStrs {
			err := connect(xu,
				ks.Callback, ks.Evtype, ks.Win, ks.Str, ks.Grab, true)
			if err != nil {
				xgbutil.Logger.Println(err)
			}
		}
	} else {
		// We don't have to do something with MappingModifier like we do with
		// MappingKeyboard. This is due to us requiring that key strings use
		// modifier names built into X. (i.e., the names seen in the output of
		// `xmodmap`.) This means that the modifier mappings happen on the X
		// server side, so we don't *typically* have to care what key is
		// actually being pressed to trigger a modifier. (There are some
		// exceptional cases, and when that happens, we simply query on-demand
		// which keys are modifiers. See the RunKey{Press,Release}Callbacks
		// functions in keybind/callback.go for the deets.)
		KeyMapSet(xu, keyMap)
		ModMapSet(xu, modMap)
	}
}
431660
func (ts *Server) GetKeyspace(ctx context.Context, keyspace string) (*KeyspaceInfo, error) {
	keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile)
	data, version, err := ts.globalCell.Get(ctx, keyspacePath)
	if err != nil {
		return nil, err
	}

	k := &topodatapb.Keyspace{}
	if err = proto.Unmarshal(data, k); err != nil {
		return nil, vterrors.Wrap(err, "bad keyspace data")
	}

	return &KeyspaceInfo{
		keyspace: keyspace,
		version:  version,
		Keyspace: k,
	}, nil
}
1159769
func (client *Client) UpdateSpaceManagerByUsername(spaceGUID string, username string) (Warnings, error) {
	requestBody := updateRoleRequestBody{
		Username: username,
	}

	bodyBytes, err := json.Marshal(requestBody)
	if err != nil {
		return Warnings{}, err
	}
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PutSpaceManagerByUsernameRequest,
		URIParams:   map[string]string{"space_guid": spaceGUID},
		Body:        bytes.NewReader(bodyBytes),
	})

	if err != nil {
		return nil, err
	}

	response := cloudcontroller.Response{}

	err = client.connection.Make(request, &response)

	return response.Warnings, err
}
705605
func (ts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error {
	data, err := proto.Marshal(value)
	if err != nil {
		return err
	}

	keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile)
	if _, err := ts.globalCell.Create(ctx, keyspacePath, data); err != nil {
		return err
	}
	event.Dispatch(&events.KeyspaceChange{
		KeyspaceName: keyspace,
		Keyspace:     value,
		Status:       "created",
	})
	return nil
}
1230083
func (s *CustomizedMetricSpecification) SetNamespace(v string) *CustomizedMetricSpecification {
	s.Namespace = &v
	return s
}
1192204
func (cmd *TargetCommand) setSpace() error {
	if !cmd.Config.HasTargetedOrganization() {
		return translatableerror.NoOrganizationTargetedError{BinaryName: cmd.Config.BinaryName()}
	}

	space, warnings, err := cmd.Actor.GetSpaceByOrganizationAndName(cmd.Config.TargetedOrganization().GUID, cmd.Space)
	cmd.UI.DisplayWarnings(warnings)
	if err != nil {
		return err
	}

	cmd.Config.SetSpaceInformation(space.GUID, space.Name, space.AllowSSH)

	return nil
}
1007348
func (s *DeleteGroupInput) SetNamespace(v string) *DeleteGroupInput {
	s.Namespace = &v
	return s
}
330559
func (s *MetricAlarm) SetNamespace(v string) *MetricAlarm {
	s.Namespace = &v
	return s
}
11412
func (s *UpdateUserInput) SetNamespace(v string) *UpdateUserInput {
	s.Namespace = &v
	return s
}
300417
func (c *Client) SetNamespace(namespace string) {
	c.modifyLock.Lock()
	defer c.modifyLock.Unlock()
	c.setNamespace(namespace)
}