// deposeCurrentObject is part of the real implementation of
// SyncState.DeposeResourceInstanceObject. The exported method uses a lock
// to ensure that we can safely allocate an unused deposed key without
// collision.
deposeCurrentObject is part of the real implementation of
SyncState.DeposeResourceInstanceObject. The exported method uses a lock
to ensure that we can safely allocate an unused deposed key without
collision.
// deposeCurrentObject is part of the real implementation of // SyncState . DeposeResourceInstanceObject . The exported method uses a lock // to ensure that we can safely allocate an unused deposed key without // collision .
func (i *ResourceInstance) deposeCurrentObject(forceKey DeposedKey) DeposedKey {
	if !i.HasCurrent() {
		return NotDeposed
	}
	key := forceKey
	if key == NotDeposed {
		key = i.findUnusedDeposedKey()
	} else {
		if _, exists := i.Deposed[key]; exists {
			panic(fmt.Sprintf("forced key %s is already in use", forceKey))
		}
	}
	i.Deposed[key] = i.Current
	i.Current = nil
	return key
}
func ( i * ResourceInstance ) deposeCurrentObject ( forceKey DeposedKey ) DeposedKey { if ! i . HasCurrent ( ) { return NotDeposed } key := forceKey if key == NotDeposed { key = i . findUnusedDeposedKey ( ) } else { if _ , exists := i . Deposed [ key ] ; exists { panic ( fmt . Sprintf ( " " , forceKey ) ) } } i . Deposed [ key ] = i . Current i . Current = nil return key }
deposeCurrentObject is part of the real implementation of
SyncState.DeposeResourceInstanceObject.
deposeCurrentObject is part of the real implementation of SyncState . DeposeResourceInstanceObject .