Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refact file interface #313

Merged
merged 16 commits into from
Nov 11, 2021
14 changes: 10 additions & 4 deletions cmd/layotto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ import (
"strconv"
"time"

"mosn.io/layotto/components/file/local"

"mosn.io/layotto/components/file/s3/alicloud"
"mosn.io/layotto/components/file/s3/aws"
"mosn.io/layotto/components/file/s3/minio"

dbindings "github.com/dapr/components-contrib/bindings"
"github.com/dapr/components-contrib/bindings/http"
"mosn.io/layotto/components/configstores/etcdv3"
"mosn.io/layotto/components/file"
alicloud_oss "mosn.io/layotto/components/file/alicloud/oss"
minio_oss "mosn.io/layotto/components/file/minio/oss"
"mosn.io/layotto/components/sequencer"
"mosn.io/layotto/pkg/runtime/bindings"
runtime_sequencer "mosn.io/layotto/pkg/runtime/sequencer"
Expand Down Expand Up @@ -162,8 +166,10 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp

// File
runtime.WithFileFactory(
file.NewFileFactory("aliOSS", alicloud_oss.NewAliCloudOSS),
file.NewFileFactory("minioOSS", minio_oss.NewMinioOss),
file.NewFileFactory("aliOSS", alicloud.NewAliCloudOSS),
file.NewFileFactory("minioOSS", minio.NewMinioOss),
file.NewFileFactory("awsOSS", aws.NewAwsOss),
file.NewFileFactory("local", local.NewLocalStore),
),

// PubSub
Expand Down
215 changes: 0 additions & 215 deletions components/file/alicloud/oss/oss.go

This file was deleted.

111 changes: 0 additions & 111 deletions components/file/alicloud/oss/oss_test.go

This file was deleted.

29 changes: 29 additions & 0 deletions components/file/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2021 Layotto Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package file

import (
"errors"
)

var (
ErrInvalid = errors.New("invalid argument")
ErrPermission = errors.New("permission denied")
ErrExist = errors.New("file already exists")
ErrNotExist = errors.New("file does not exist")
ErrExpired = errors.New("file does not exist")
)
Loading