Skip to content

Commit

Permalink
eosgrpc now can upload using xrdcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Furano committed Oct 6, 2020
1 parent 6d8ed4b commit 35f781b
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions pkg/storage/fs/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 35f781b

Please sign in to comment.