From 35f781b6dcbe29182041c7815239a4142a581088 Mon Sep 17 00:00:00 2001 From: Fabrizio Furano Date: Wed, 9 Sep 2020 09:21:32 +0200 Subject: [PATCH] eosgrpc now can upload using xrdcopy --- pkg/storage/fs/eosgrpc/eosgrpc.go | 45 ++++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/pkg/storage/fs/eosgrpc/eosgrpc.go b/pkg/storage/fs/eosgrpc/eosgrpc.go index ea754805c38..f518d8ebd31 100644 --- a/pkg/storage/fs/eosgrpc/eosgrpc.go +++ b/pkg/storage/fs/eosgrpc/eosgrpc.go @@ -238,9 +238,9 @@ func New(m map[string]interface{}) (storage.FS, error) { } // InitiateUpload returns an upload id that can be used for uploads with tus -func (fs *eosfs) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (uploadID string, err error) { - return "", errtypes.NotSupported("op not supported") -} +//func (fs *eosfs) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (uploadID string, err error) { +// return "", errtypes.NotSupported("op not supported") +//} func (fs *eosfs) Shutdown(ctx context.Context) error { // TODO(labkode): in a grpc implementation we can close connections. @@ -301,6 +301,7 @@ func (fs *eosfs) getNsMatch(internal string, nss []string) string { var match string for _, ns := range nss { + if strings.HasPrefix(internal, ns) && len(ns) > len(match) { match = ns } @@ -1227,25 +1228,25 @@ func (fs *eosfs) Download(ctx context.Context, ref *provider.Reference) (io.Read return fs.c.Read(ctx, u.Username, fn) } -func (fs *eosfs) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) error { - u, err := getUser(ctx) - if err != nil { - return errors.Wrap(err, "eos: no user in ctx") - } - - p, err := fs.resolve(ctx, u, ref) - if err != nil { - return errors.Wrap(err, "eos: error resolving reference") - } - - if fs.isShareFolder(ctx, p) { - return errtypes.PermissionDenied("eos: cannot download under the virtual share folder") - } - - fn := fs.wrap(ctx, p) - - return fs.c.Write(ctx, u.Username, fn, r) -} +//func (fs *eosfs) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) error { +// u, err := getUser(ctx) +// if err != nil { +// return errors.Wrap(err, "eos: no user in ctx") +// } +// +// p, err := fs.resolve(ctx, u, ref) +// if err != nil { +// return errors.Wrap(err, "eos: error resolving reference") +// } +// +// if fs.isShareFolder(ctx, p) { +// return errtypes.PermissionDenied("eos: cannot download under the virtual share folder") +// } +// +// fn := fs.wrap(ctx, p) +// +// return fs.c.Write(ctx, u.Username, fn, r) +//} func (fs *eosfs) ListRevisions(ctx context.Context, ref *provider.Reference) ([]*provider.FileVersion, error) { u, err := getUser(ctx)