Browse Source

Remove rclone code

HEAD
Yang Luo 2 years ago
parent
commit
61d2b70116
3 changed files with 26 additions and 1414 deletions
  1. +26
    -1
      go.mod
  2. +0
    -1335
      go.sum
  3. +0
    -78
      storage/rclone.go

+ 26
- 1
go.mod View File

@@ -8,17 +8,42 @@ require (
github.com/astaxie/beego v1.12.3
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/casdoor/casdoor-go-sdk v0.25.0
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/danaugrs/go-tsne/tsne v0.0.0-20220306155740-2250969e057f
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/goccy/go-json v0.9.11 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/muesli/clusters v0.0.0-20200529215643-2700303c1762
github.com/muesli/kmeans v0.3.0
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.27.1 // indirect
github.com/pkoukk/tiktoken-go v0.1.1
github.com/rclone/rclone v1.63.0
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sashabaranov/go-openai v1.12.0
github.com/tealeg/xlsx v1.0.5
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 // indirect
golang.org/x/net v0.8.0
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/time v0.3.0 // indirect
gonum.org/v1/gonum v0.11.0
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.36.3 // indirect
modernc.org/ccgo/v3 v3.16.9 // indirect
modernc.org/libc v1.17.1 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.18.1 // indirect
modernc.org/strutil v1.1.3 // indirect
xorm.io/core v0.7.3
xorm.io/xorm v1.2.5
)

+ 0
- 1335
go.sum
File diff suppressed because it is too large
View File


+ 0
- 78
storage/rclone.go View File

@@ -1,78 +0,0 @@
// Copyright 2023 The casbin Authors. All Rights Reserved.
//
// 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 storage

import (
"context"
"fmt"
"io"

_ "github.com/rclone/rclone/backend/all"
"github.com/rclone/rclone/fs"
)

func getFs(bucketName string) (fs.Fs, error) {
f, err := fs.NewFs(context.Background(), bucketName)
if err != nil {
return nil, err
}

return f, nil
}

func ListObjects2(bucketName string, prefix string) ([]fs.DirEntry, error) {
if bucketName == "" {
return nil, fmt.Errorf("bucket name is empty")
}

f, err := getFs(bucketName)
if err != nil {
return nil, err
}

entries, err := f.List(context.Background(), prefix)
if err != nil {
return nil, err
}

return entries, nil
}

func PutObject2(bucketName string, key string, in io.Reader) error {
f, err := getFs(bucketName)
if err != nil {
return err
}

// Use Rcat to put an object to the remote
//_, err = operations.Rcat(context.Background(), f, key, nil, nil, nil)
print(f)

return err
}

func DeleteObject2(bucketName string, key string) error {
f, err := getFs(bucketName)
if err != nil {
return err
}

remoteObj, err := f.NewObject(context.Background(), key)
if err != nil {
return err
}

return remoteObj.Remove(context.Background())
}

Loading…
Cancel
Save