storj/cmd/uplinkng/ultest/external.go
Michał Niewrzał 8f07abafe0 cmd/uplinkng/ultest: make possible to test access commands
Test external implementation doesn't support OpenAccess
method. This makes imposible to test output of commands like
inspect or share. This implements only basic functionality.

Change-Id: I127ef0bb45a01634bd5265ed80840f8095c72794
2021-11-22 10:43:02 +00:00

39 lines
859 B
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package ultest
import (
"context"
"storj.io/storj/cmd/uplinkng/ulext"
"storj.io/storj/cmd/uplinkng/ulfs"
"storj.io/uplink"
)
type external struct {
ulext.External
fs ulfs.Filesystem
project *uplink.Project
}
func newExternal(fs ulfs.Filesystem, project *uplink.Project) *external {
return &external{
fs: fs,
project: project,
}
}
func (ex *external) OpenFilesystem(ctx context.Context, access string, options ...ulext.Option) (ulfs.Filesystem, error) {
return ex.fs, nil
}
func (ex *external) OpenProject(ctx context.Context, access string, options ...ulext.Option) (*uplink.Project, error) {
return ex.project, nil
}
func (ex *external) OpenAccess(accessName string) (access *uplink.Access, err error) {
return uplink.ParseAccess(accessName)
}