func (casCli *CASClient) ByteStreamRead(r dialer.Resolver, digest *remoteexecution.Digest, b backoff.BackOff) (bytes []byte, err error) {
	if digest == nil || bazel.IsEmptyDigest(digest) {
		return nil, nil
	}
	try := 1
	backoff.Retry(func() error {
		log.Debugf("Try #%d", try)
		bytes, err = casCli.byteStreamRead(r, digest)
		try += 1
		if IsNotFoundError(err) {
			return nil
		}
		return err
	}, b)
	return bytes, err
}
Read data as bytes from a CAS. Takes a Resolver for addressing and a bazel Digest to read.
Returns bytes read or an error. If the requested resource was not found,
returns a NotFoundError
package cas
import (
	"fmt"
	"github.com/cenkalti/backoff"
	uuid "github.com/nu7hatch/gouuid"
	log "github.com/sirupsen/logrus"
	"golang.org/x/net/context"
	"google.golang.org/genproto/googleapis/bytestream"
	rpc_code "google.golang.org/genproto/googleapis/rpc/code"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	"github.com/twitter/scoot/bazel"
	conn "github.com/twitter/scoot/bazel/cas/connection"
	"github.com/twitter/scoot/bazel/remoteexecution"
	"github.com/twitter/scoot/common/dialer"
)
type NotFoundError struct {
	Err string
}
func MakeCASpbClient(cc conn.ClientConnPtr) remoteexecution.ContentAddressableStorageClient {
	return remoteexecution.NewContentAddressableStorageClient(cc.(*grpc.ClientConn))
}
type CASClient struct {
	grpcDialer conn.GRPCDialer
	CASpbMaker func(cc conn.ClientConnPtr) remoteexecution.ContentAddressableStorageClient  
}
func MakeCASClient() *CASClient {
	return &CASClient{
		grpcDialer: conn.MakeRealGRPCDialer(),  
		CASpbMaker: MakeCASpbClient,            
	}
}
func (casCli *CASClient) SetGrpcDialer(dialer conn.GRPCDialer) *CASClient {
	casCli.grpcDialer = dialer
	return casCli
}
func (casCli *CASClient) SetCASpbMaker(pcClientMaker func(cc conn.ClientConnPtr) remoteexecution.ContentAddressableStorageClient) *CASClient {
	casCli.CASpbMaker = pcClientMaker
	return casCli
}
func (e *NotFoundError) Error() string {
	if e == nil {
		return ""
	}
	return e.Err
}
func IsNotFoundError(err error) bool {
	if _, ok := err.(*NotFoundError); ok {
		return true
	}
	return false
}