<commit_before>// Copyright 2015, 2016 Eris Industries (UK) Ltd.
// This file is part of Eris-RT

// Eris-RT is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Eris-RT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Eris-RT.  If not, see <http://www.gnu.org/licenses/>.

package core_types

import (
	"github.com/eris-ltd/eris-db/core/types"
)

// UnwrapResultDumpStorage does a deep copy to remove /rpc/tendermint/core/types
// and expose /core/types instead.  This is largely an artefact to be removed once
// go-wire and go-rpc are deprecated.
// This is not an efficient code, especially given Storage can be big.
func UnwrapResultDumpStorage(result *ResultDumpStorage) (*types.Storage) {
	storageRoot := make([]byte, len(result.StorageRoot))
	copy(storageRoot, result.StorageRoot)
	storageItems := make([]types.StorageItem, len(result.StorageItems))
	for i, item := range result.StorageItems {
		key := make([]byte, len(item.Key))
		value := make([]byte, len(item.Value))
		copy(key,  item.Key)
		copy(value, item.Value)
		storageItems[i] = types.StorageItem{<commit_msg>rpc/tendermint: rename package name to types, following other PR<commit_after>// Copyright 2015, 2016 Eris Industries (UK) Ltd.
// This file is part of Eris-RT

// Eris-RT is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Eris-RT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Eris-RT.  If not, see <http://www.gnu.org/licenses/>.

package types

import (
	"github.com/eris-ltd/eris-db/core/types"
)

// UnwrapResultDumpStorage does a deep copy to remove /rpc/tendermint/core/types
// and expose /core/types instead.  This is largely an artefact to be removed once
// go-wire and go-rpc are deprecated.
// This is not an efficient code, especially given Storage can be big.
func UnwrapResultDumpStorage(result *ResultDumpStorage) (*types.Storage) {
	storageRoot := make([]byte, len(result.StorageRoot))
	copy(storageRoot, result.StorageRoot)
	storageItems := make([]types.StorageItem, len(result.StorageItems))
	for i, item := range result.StorageItems {
		key := make([]byte, len(item.Key))
		value := make([]byte, len(item.Value))
		copy(key,  item.Key)
		copy(value, item.Value)
		storageItems[i] = types.StorageItem{
{'fraction_non_alphanumeric': 0.10392535392535393, 'fraction_numerical': 0.005791505791505791, 'mean_word_length': 3.966453674121406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4881834', 'n_tokens_mistral': 927, 'n_tokens_neox': 891, 'n_words': 369}