src/server/pkg/hashtree/db.go
func (r *Reader) Read() (*MergeNode, error) {
	_k, err := r.pbr.ReadBytes()
	if err != nil {
		return nil, err
	}
	if r.filter != nil {
		for {
			if r.filter(_k) {
				break
			}
			_, err = r.pbr.ReadBytes()
			if err != nil {
				return nil, err
			}
			_k, err = r.pbr.ReadBytes()
			if err != nil {
				return nil, err
			}
		}

	}
	k := make([]byte, len(_k))
	copy(k, _k)
	_v, err := r.pbr.ReadBytes()
	if err != nil {
		return nil, err
	}
	v := make([]byte, len(_v))
	copy(v, _v)
	return &MergeNode{
		k: k,
		v: v,
	}, nil
}
func (r *Reader) Read() (*MergeNode, error) {
	_k, err := r.pbr.ReadBytes()
	if err != nil {
		return nil, err
	}
	if r.filter != nil {
		for {
			if r.filter(_k) {
				break
			}
			_, err = r.pbr.ReadBytes()
			if err != nil {
				return nil, err
			}
			_k, err = r.pbr.ReadBytes()
			if err != nil {
				return nil, err
			}
		}

	}
	k := make([]byte, len(_k))
	copy(k, _k)
	_v, err := r.pbr.ReadBytes()
	if err != nil {
		return nil, err
	}
	v := make([]byte, len(_v))
	copy(v, _v)
	return &MergeNode{
		k: k,
		v: v,
	}, nil
}
func ( r * Reader ) Read ( ) ( * MergeNode , error ) { _k , err := r . pbr . ReadBytes ( ) if err != nil { return nil , err } if r . filter != nil { for { if r . filter ( _k ) { break } _ , err = r . pbr . ReadBytes ( ) if err != nil { return nil , err } _k , err = r . pbr . ReadBytes ( ) if err != nil { return nil , err } } } k := make ( [ ] byte , len ( _k ) ) copy ( k , _k ) _v , err := r . pbr . ReadBytes ( ) if err != nil { return nil , err } v := make ( [ ] byte , len ( _v ) ) copy ( v , _v ) return & MergeNode { k : k , v : v , } , nil }
// Read reads the next merge node.
Read reads the next merge node .