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

	for {
		select {
		case <-caller.stopChan:
			return nil
		case <-ctx.Done():
			return ctx.Err()
		case payload, ok := <-stream:
			if !ok {
				_, err = client.CloseAndRecv()

				return err
			}

			if err := client.Send(payload); err != nil {
				return err
			}
		}
	}
}
// UploadStream calls streaming RPC to upload the data.
UploadStream calls streaming RPC to upload the data.
// UploadStream calls streaming RPC to upload the data .
func (caller *PortCaller) UploadStream(ctx context.Context, stream <-chan *proto.Payload) error {
	client, err := caller.StorageClient.Save(ctx)
	if err != nil {
		return err
	}
	for {
		select {
		case <-caller.stopChan:
			return nil
		case <-ctx.Done():
			return ctx.Err()
		case payload, ok := <-stream:
			if !ok {
				_, err = client.CloseAndRecv()
				return err
			}
			if err := client.Send(payload); err != nil {
				return err
			}
		}
	}
}
func ( caller * PortCaller ) UploadStream ( ctx context . Context , stream <- chan * proto . Payload ) error { client , err := caller . StorageClient . Save ( ctx ) if err != nil { return err } for { select { case <- caller . stopChan : return nil case <- ctx . Done ( ) : return ctx . Err ( ) case payload , ok := <- stream : if ! ok { _ , err = client . CloseAndRecv ( ) return err } if err := client . Send ( payload ) ; err != nil { return err } } } }
UploadStream calls streaming RPC to upload the data.
UploadStream calls streaming RPC to upload the data .