Exemple #1
0
func constructDataKey(i dvid.InstanceID, v dvid.VersionID, c dvid.ClientID, tk TKey) Key {
	key := append([]byte{dataKeyPrefix}, i.Bytes()...)
	key = append(key, tk...)
	key = append(key, v.Bytes()...)
	key = append(key, c.Bytes()...)
	return Key(append(key, MarkData))
}
Exemple #2
0
func UpdateDataKey(k Key, instance dvid.InstanceID, version dvid.VersionID, client dvid.ClientID) error {
	if k[0] != dataKeyPrefix {
		return fmt.Errorf("Cannot update non-DataContext key: %v", k)
	}
	copy(k[1:1+dvid.InstanceIDSize], instance.Bytes())
	start := len(k) - dvid.VersionIDSize - dvid.ClientIDSize - 1
	copy(k[start:start+dvid.VersionIDSize], version.Bytes())
	start += dvid.VersionIDSize
	copy(k[start:start+dvid.ClientIDSize], client.Bytes())
	return nil
}