func NewPartSetFromData(data []byte, partSize def.INT) *PartSet {
	intPartSize := int(partSize)
	total := (len(data) + intPartSize - 1) / intPartSize
	parts := make([]*PartCache, total)
	parts_ := make([]merkle.Hashable, total)
	partsBitArray := NewBitArray(total)
	for i := 0; i < total; i++ {
		part := &PartCache{
			Part: &pbtypes.Part{
				Index: def.HINT(i),
				Bytes: data[i*intPartSize : MinInt(len(data), (i+1)*intPartSize)],
			},
		}
		parts[i] = part
		parts_[i] = part
		partsBitArray.SetIndex(i, true)
	}
	root, proofs := merkle.SimpleProofsFromHashables(parts_)
	for i := 0; i < total; i++ {
		parts[i].init(proofs[i].Aunts)
	}
	return &PartSet{
		total:         def.INT(total),
		hash:          root,
		parts:         parts,
		partsBitArray: partsBitArray,
		count:         def.INT(total),
	}
}
Returns an immutable, full PartSet from the data bytes.
The data bytes are split into "partSize" chunks, and merkle tree computed.
package types
import (
	"bytes"
	"errors"
	"fmt"
	"sync"
	"golang.org/x/crypto/ripemd160"
	pbtypes "github.com/annchain/annchain/angine/protos/types"
	. "github.com/annchain/annchain/module/lib/go-common"
	"github.com/annchain/annchain/module/lib/go-merkle"
	"github.com/annchain/annchain/module/xlib/def"
)
var (
	ErrPartSetUnexpectedIndex = errors.New("Error part set unexpected index")
	ErrPartSetInvalidProof    = errors.New("Error part set invalid proof")
)
type PartCache struct {
	*pbtypes.Part
	hash []byte
}
func NewPartCache(p *pbtypes.Part) *PartCache {
	return &PartCache{
		Part: p,
	}
}
func (part *PartCache) init(aunt [][]byte) {
	if part == nil {
		part = &PartCache{}
	}
	if part.Part == nil {
		part.Part = &pbtypes.Part{}
	}
	if part.Part.Proof == nil {
		part.Part.Proof = &pbtypes.SimpleProof{}
	}
	part.Part.Proof.Bytes = aunt
}
func (part *PartCache) Hash() []byte {
	if part.hash != nil {
		return part.hash
	}
	hasher := ripemd160.New()
	hasher.Write(part.Bytes)  
	part.hash = hasher.Sum(nil)
	return part.hash
}
func (part *PartCache) CString() string {
	if part == nil {
		return "nil"
	}
	return part.StringIndented("")
}
func (part *PartCache) StringIndented(indent string) string {
	proof := part.MerkleProof()
	return fmt.Sprintf(`Part{#%v
%s  Bytes: %X...
%s  Proof: %v
%s}`,
		part.Index,
		indent, Fingerprint(part.Bytes),
		indent, (&proof).StringIndented(indent+"  "),
		indent)
}
type PartSet struct {
	total def.INT
	hash  []byte
	mtx           sync.Mutex
	parts         []*PartCache
	partsBitArray *BitArray
	count         def.INT
}