func (caller *PortCaller) DownloadStream(ctx context.Context, stream chan<- *proto.Payload) error {
	client, err := caller.StorageClient.Load(ctx, &empty.Empty{})
	if err != nil {
		return err
	}

	for {
		payload, err := client.Recv()
		if errors.Is(err, io.EOF) {
			break
		}

		if err != nil {
			return err
		}

		select {
		case <-caller.stopChan:
			return nil
		case stream <- payload:
		case <-ctx.Done():
			return ctx.Err()
		}
	}

	return nil
}
// DownloadStream calls streaming RPC to fetch the data.
DownloadStream calls streaming RPC to fetch the data.
// DownloadStream calls streaming RPC to fetch the data .
func (caller *PortCaller) DownloadStream(ctx context.Context, stream chan<- *proto.Payload) error {
	client, err := caller.StorageClient.Load(ctx, &empty.Empty{})
	if err != nil {
		return err
	}
	for {
		payload, err := client.Recv()
		if errors.Is(err, io.EOF) {
			break
		}
		if err != nil {
			return err
		}
		select {
		case <-caller.stopChan:
			return nil
		case stream <- payload:
		case <-ctx.Done():
			return ctx.Err()
		}
	}
	return nil
}
func ( caller * PortCaller ) DownloadStream ( ctx context . Context , stream chan <- * proto . Payload ) error { client , err := caller . StorageClient . Load ( ctx , & empty . Empty { } ) if err != nil { return err } for { payload , err := client . Recv ( ) if errors . Is ( err , io . EOF ) { break } if err != nil { return err } select { case <- caller . stopChan : return nil case stream <- payload : case <- ctx . Done ( ) : return ctx . Err ( ) } } return nil }
DownloadStream calls streaming RPC to fetch the data.
DownloadStream calls streaming RPC to fetch the data .