func (s *Source) Upload(ctx context.Context, stream pb.Source_UploadStream) error {
	acc, ok := auth.AccountFromContext(ctx)
	if !ok {
		return errors.Unauthorized("runtime.Source.Upload", "An account is required to upload source")
	}
	namespace := acc.Issuer
	buf := bytes.NewBuffer(nil)
	var srv *pb.Service
	for {
		req, err := stream.Recv()
		if err == io.EOF {
			break
		} else if err != nil {
			return errors.InternalServerError("runtime.Source.Upload", err.Error())
		}
		if req.Service != nil {
			srv = req.Service
		}
		if _, err := buf.Write(req.Data); err != nil {
			return err
		}
	}
	if buf == nil {
		return errors.BadRequest("runtime.Source.Upload", "No blob was sent")
	}
	if srv == nil {
		return errors.BadRequest("runtime.Source.Upload", "No service was sent")
	}
	key := fmt.Sprintf("source://%v:%v", srv.Name, srv.Version)
	opt := store.BlobNamespace(namespace)
	if err := store.DefaultBlobStore.Write(key, buf, opt); err != nil {
		return fmt.Errorf("Error writing source to blob store: %v", err)
	}
	return stream.SendAndClose(&pb.UploadResponse{Id: key})
}
Upload source to the server
package handler
import (
	"bytes"
	"context"
	"fmt"
	"io"
	pb "github.com/micro/micro/v3/proto/runtime"
	"github.com/micro/micro/v3/service/auth"
	"github.com/micro/micro/v3/service/errors"
	"github.com/micro/micro/v3/service/store"
)
const (
	sourcePrefix        = "source://"
	blobNamespacePrefix = "micro/runtime"
)
type Source struct{}