src/server/pkg/hashtree/db.go
func PutHashTree(pachClient *client.APIClient, tree HashTree, tags ...string) (*pfs.Object, error) {
	r, w := io.Pipe()
	var eg errgroup.Group
	eg.Go(func() (retErr error) {
		defer func() {
			if err := w.Close(); err != nil && retErr == nil {
				retErr = err
			}
		}()
		return tree.Serialize(w)
	})
	var treeRef *pfs.Object
	eg.Go(func() error {
		var err error
		treeRef, _, err = pachClient.PutObject(r, tags...)
		return err
	})
	if err := eg.Wait(); err != nil {
		return nil, err
	}
	return treeRef, nil
}
func PutHashTree(pachClient *client.APIClient, tree HashTree, tags ...string) (*pfs.Object, error) {
	r, w := io.Pipe()
	var eg errgroup.Group
	eg.Go(func() (retErr error) {
		defer func() {
			if err := w.Close(); err != nil && retErr == nil {
				retErr = err
			}
		}()
		return tree.Serialize(w)
	})
	var treeRef *pfs.Object
	eg.Go(func() error {
		var err error
		treeRef, _, err = pachClient.PutObject(r, tags...)
		return err
	})
	if err := eg.Wait(); err != nil {
		return nil, err
	}
	return treeRef, nil
}
func PutHashTree ( pachClient * client . APIClient , tree HashTree , tags ... string ) ( * pfs . Object , error ) { r , w := io . Pipe ( ) var eg errgroup . Group eg . Go ( func ( ) ( retErr error ) { defer func ( ) { if err := w . Close ( ) ; err != nil && retErr == nil { retErr = err } } ( ) return tree . Serialize ( w ) } ) var treeRef * pfs . Object eg . Go ( func ( ) error { var err error treeRef , _ , err = pachClient . PutObject ( r , tags ... ) return err } ) if err := eg . Wait ( ) ; err != nil { return nil , err } return treeRef , nil }
// PutHashTree is a convenience function for putting a HashTree to an object store.
PutHashTree is a convenience function for putting a HashTree to an object store .