// ToProto parse a vtree to protobuf.
ToProto parse a vtree to protobuf.
// ToProto parse a vtree to protobuf .
func (vn *VNode) ToProto() *pb.FSNode {
	pbNode := &pb.FSNode{
		ID:    vn.ID,
		Path:  vn.Path,
		Links: []*pb.FSNode{},
	}
	if !vn.IsDir() {
		pbNode.Source = vn.Source.Src
	}
	var wg sync.WaitGroup
	for _, vnode := range vn.Links {
		wg.Add(1)
		go func(vn *VNode) {
			pbNode.Links = append(pbNode.Links, vn.ToProto())
			wg.Done()
		}(vnode)
	}
	wg.Wait()
	return pbNode
}
func ( vn * VNode ) ToProto ( ) * pb . FSNode { pbNode := & pb . FSNode { ID : vn . ID , Path : vn . Path , Links : [ ] * pb . FSNode { } , } if ! vn . IsDir ( ) { pbNode . Source = vn . Source . Src } var wg sync . WaitGroup for _ , vnode := range vn . Links { wg . Add ( 1 ) go func ( vn * VNode ) { pbNode . Links = append ( pbNode . Links , vn . ToProto ( ) ) wg . Done ( ) } ( vnode ) } wg . Wait ( ) return pbNode }
ToProto parse a vtree to protobuf.
ToProto parse a vtree to protobuf .