func (c *crush) canUse(chosenKeys []interface{}, newKey interface{}) bool {
	switch newKey.(type) {
	case string:
		n := newKey.(string)
		for _, s := range chosenKeys {
			if s != nil && s.(string) == n {
				return false
			}
		}
		return true
	case uint64:
		n := newKey.(uint64)
		for _, i := range chosenKeys {
			if i != nil && i.(uint64) == n {
				return false
			}
		}
		return true
	default:
		return false
	}
}
// right now canUse only checks whether this peer has been selected already
// in the future we could probably double-check whether the peer is healthy or has space or whatever
right now canUse only checks whether this peer has been selected already
in the future we could probably double-check whether the peer is healthy or has space or whatever
// right now canUse only checks whether this peer has been selected already // in the future we could probably double - check whether the peer is healthy or has space or whatever
func (c *crush) canUse(chosenKeys []interface{}, newKey interface{}) bool {
	switch newKey.(type) {
	case string:
		n := newKey.(string)
		for _, s := range chosenKeys {
			if s != nil && s.(string) == n {
				return false
			}
		}
		return true
	case uint64:
		n := newKey.(uint64)
		for _, i := range chosenKeys {
			if i != nil && i.(uint64) == n {
				return false
			}
		}
		return true
	default:
		return false
	}
}
func ( c * crush ) canUse ( chosenKeys [ ] interface { } , newKey interface { } ) bool { switch newKey . ( type ) { case string : n := newKey . ( string ) for _ , s := range chosenKeys { if s != nil && s . ( string ) == n { return false } } return true case uint64 : n := newKey . ( uint64 ) for _ , i := range chosenKeys { if i != nil && i . ( uint64 ) == n { return false } } return true default : return false } }
right now canUse only checks whether this peer has been selected already
in the future we could probably double-check whether the peer is healthy or has space or whatever
right now canUse only checks whether this peer has been selected already in the future we could probably double - check whether the peer is healthy or has space or whatever