<commit_before>// Copyright 2013-2014 Aerospike, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package aerospike

import (
	. "github.com/aerospike/aerospike-client-go/logger"
	. "github.com/aerospike/aerospike-client-go/types"
	Buffer "github.com/aerospike/aerospike-client-go/utils/buffer"
)

type batchCommandGet struct {
	*baseMultiCommand

	batchNamespace *batchNamespace
	policy         Policy
	keyMap         map[string]*batchItem
	binNames       map[string]struct{}
	records        []*Record
	readAttr       int
}

func newBatchCommandGet(
	node *Node,
	batchNamespace *batchNamespace,
	policy Policy,
	keyMap map[string]*batchItem,
	binNames map[string]struct{},
	records []*Record,
	readAttr int,
) *batchCommandGet {
	return &batchCommandGet{
		baseMultiCommand: newMultiCommand(node, nil),
		batchNamespace:   batchNamespace,
		policy:           policy,
		keyMap:           keyMap,
		records:          records,
		readAttr:         readAttr,
	}
}

func (cmd *batchCommandGet) getPolicy(ifc command) Policy {
	return cmd.policy
}

func (cmd *batchCommandGet) writeBuffer(ifc command) error {
	return cmd.setBatchGet(cmd.policy, cmd.batchNamespace, cmd.binNames, cmd.readAttr)
}

// Parse all results in the batch.  Add records to shared list.
// If the record was not found, the bins will be nil.
func (cmd *batchCommandGet) parseRecordResults(ifc command, receiveSize int) (bool, error) {
	//Parse each message response and add it to the result array
	cmd.dataOffset = 0
<commit_msg>Fix: newBatchCommandGet() ignoring binNames restrictions<commit_after>// Copyright 2013-2014 Aerospike, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package aerospike

import (
	. "github.com/aerospike/aerospike-client-go/logger"
	. "github.com/aerospike/aerospike-client-go/types"
	Buffer "github.com/aerospike/aerospike-client-go/utils/buffer"
)

type batchCommandGet struct {
	*baseMultiCommand

	batchNamespace *batchNamespace
	policy         Policy
	keyMap         map[string]*batchItem
	binNames       map[string]struct{}
	records        []*Record
	readAttr       int
}

func newBatchCommandGet(
	node *Node,
	batchNamespace *batchNamespace,
	policy Policy,
	keyMap map[string]*batchItem,
	binNames map[string]struct{},
	records []*Record,
	readAttr int,
) *batchCommandGet {
	return &batchCommandGet{
		baseMultiCommand: newMultiCommand(node, nil),
		batchNamespace:   batchNamespace,
		policy:           policy,
		keyMap:           keyMap,
		binNames:         binNames,
		records:          records,
		readAttr:         readAttr,
	}
}

func (cmd *batchCommandGet) getPolicy(ifc command) Policy {
	return cmd.policy
}

func (cmd *batchCommandGet) writeBuffer(ifc command) error {
	return cmd.setBatchGet(cmd.policy, cmd.batchNamespace, cmd.binNames, cmd.readAttr)
}

// Parse all results in the batch.  Add records to shared list.
// If the record was not found, the bins will be nil.
func (cmd *batchCommandGet) parseRecordResults(ifc command, receiveSize int) (bool, error) {
	//Parse each message response and add it to the result array
	cmd.dataOffset = 0

{'fraction_non_alphanumeric': 0.09317681584739546, 'fraction_numerical': 0.006358522866226461, 'mean_word_length': 3.7065592635212887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6571133', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1189, 'n_words': 408}