// DeleteAvailableShard a shard ID from the available shard set cache.
DeleteAvailableShard a shard ID from the available shard set cache.
// DeleteAvailableShard a shard ID from the available shard set cache .
func (api *API) DeleteAvailableShard(_ context.Context, indexName, fieldName string, shardID uint64) error {
	if err := api.validate(apiDeleteAvailableShard); err != nil {
		return errors.Wrap(err, "validating api method")
	}
	field := api.holder.Field(indexName, fieldName)
	if field == nil {
		return newNotFoundError(ErrFieldNotFound)
	}
	if err := field.RemoveAvailableShard(shardID); err != nil {
		return errors.Wrap(err, "deleting available shard")
	}
	err := api.server.SendSync(
		&DeleteAvailableShardMessage{
			Index:   indexName,
			Field:   fieldName,
			ShardID: shardID,
		})
	if err != nil {
		api.server.logger.Printf("problem sending DeleteAvailableShard message: %s", err)
		return errors.Wrap(err, "sending DeleteAvailableShard message")
	}
	api.holder.Stats.CountWithCustomTags("deleteAvailableShard", 1, 1.0, []string{fmt.Sprintf("index:%s", indexName), fmt.Sprintf("field:%s", fieldName)})
	return nil
}
func ( api * API ) DeleteAvailableShard ( _ context . Context , indexName , fieldName string , shardID uint64 ) error { if err := api . validate ( apiDeleteAvailableShard ) ; err != nil { return errors . Wrap ( err , " " ) } field := api . holder . Field ( indexName , fieldName ) if field == nil { return newNotFoundError ( ErrFieldNotFound ) } if err := field . RemoveAvailableShard ( shardID ) ; err != nil { return errors . Wrap ( err , " " ) } err := api . server . SendSync ( & DeleteAvailableShardMessage { Index : indexName , Field : fieldName , ShardID : shardID , } ) if err != nil { api . server . logger . Printf ( " " , err ) return errors . Wrap ( err , " " ) } api . holder . Stats . CountWithCustomTags ( " " , 1 , 1.0 , [ ] string { fmt . Sprintf ( " " , indexName ) , fmt . Sprintf ( " " , fieldName ) } ) return nil }
DeleteAvailableShard a shard ID from the available shard set cache.
DeleteAvailableShard a shard ID from the available shard set cache .
// Find field. // Delete shard from the cache. // Send the delete shard message to all nodes.