This commit is contained in:
Chris Lu 2018-10-11 00:08:13 -07:00
parent 1d7e01b754
commit 08266b7256
11 changed files with 44 additions and 42 deletions

View file

@ -5,12 +5,12 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/replication" "github.com/chrislusf/seaweedfs/weed/replication"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/spf13/viper"
"github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/sink"
_ "github.com/chrislusf/seaweedfs/weed/replication/sink/s3sink"
_ "github.com/chrislusf/seaweedfs/weed/replication/sink/filersink" _ "github.com/chrislusf/seaweedfs/weed/replication/sink/filersink"
_ "github.com/chrislusf/seaweedfs/weed/replication/sink/gcssink" _ "github.com/chrislusf/seaweedfs/weed/replication/sink/gcssink"
_ "github.com/chrislusf/seaweedfs/weed/replication/sink/s3sink"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/spf13/viper"
) )
func init() { func init() {

View file

@ -1,17 +1,18 @@
package command package command
import ( import (
"net/http"
"os" "os"
"runtime" "runtime"
"runtime/pprof"
"strconv" "strconv"
"strings" "strings"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
"net/http"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/server"
"time" "time"
"runtime/pprof"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
) )
var ( var (

View file

@ -66,7 +66,7 @@ func (dir *Dir) Attr(context context.Context, attr *fuse.Attr) error {
return err return err
} }
if resp.Entry!=nil { if resp.Entry != nil {
dir.attributes = resp.Entry.Attributes dir.attributes = resp.Entry.Attributes
} }

View file

@ -10,9 +10,9 @@ import (
"net/http" "net/http"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/glog"
) )
type DeleteResult struct { type DeleteResult struct {

View file

@ -1,17 +1,17 @@
package replication package replication
import ( import (
"encoding/json"
"fmt" "fmt"
"io/ioutil"
"sync"
"time"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"io/ioutil"
"encoding/json"
"sync"
"time"
) )
func init() { func init() {

View file

@ -4,11 +4,11 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/glog"
) )
type Replicator struct { type Replicator struct {

View file

@ -1,17 +1,17 @@
package azuresink package azuresink
import ( import (
"bytes"
"context" "context"
"fmt" "fmt"
"net/url" "net/url"
"bytes"
"github.com/Azure/azure-storage-blob-go/2016-05-31/azblob"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/Azure/azure-storage-blob-go/2016-05-31/azblob"
) )
type AzureSink struct { type AzureSink struct {
@ -46,7 +46,7 @@ func (g *AzureSink) SetSourceFiler(s *source.FilerSource) {
g.filerSource = s g.filerSource = s
} }
func (g *AzureSink) initialize(accountName, accountKey, container, dir string) (error) { func (g *AzureSink) initialize(accountName, accountKey, container, dir string) error {
g.container = container g.container = container
g.dir = dir g.dir = dir

View file

@ -7,9 +7,9 @@ import (
"github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
) )
type FilerSink struct { type FilerSink struct {
@ -22,7 +22,7 @@ type FilerSink struct {
dataCenter string dataCenter string
} }
func init(){ func init() {
sink.Sinks = append(sink.Sinks, &FilerSink{}) sink.Sinks = append(sink.Sinks, &FilerSink{})
} }

View file

@ -7,11 +7,11 @@ import (
"os" "os"
"cloud.google.com/go/storage" "cloud.google.com/go/storage"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"google.golang.org/api/option" "google.golang.org/api/option"
) )
@ -46,7 +46,7 @@ func (g *GcsSink) SetSourceFiler(s *source.FilerSource) {
g.filerSource = s g.filerSource = s
} }
func (g *GcsSink) initialize(google_application_credentials, bucketName, dir string) (error) { func (g *GcsSink) initialize(google_application_credentials, bucketName, dir string) error {
g.bucket = bucketName g.bucket = bucketName
g.dir = dir g.dir = dir

View file

@ -4,16 +4,16 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/replication/sink"
"github.com/chrislusf/seaweedfs/weed/replication/source"
"github.com/chrislusf/seaweedfs/weed/util"
) )
type S3Sink struct { type S3Sink struct {
@ -50,7 +50,7 @@ func (s3sink *S3Sink) SetSourceFiler(s *source.FilerSource) {
s3sink.filerSource = s s3sink.filerSource = s
} }
func (s3sink *S3Sink) initialize(awsAccessKeyId, aswSecretAccessKey, region, bucket, dir string) (error) { func (s3sink *S3Sink) initialize(awsAccessKeyId, aswSecretAccessKey, region, bucket, dir string) error {
s3sink.region = region s3sink.region = region
s3sink.bucket = bucket s3sink.bucket = bucket
s3sink.dir = dir s3sink.dir = dir

View file

@ -1,16 +1,17 @@
package S3Sink package S3Sink
import ( import (
"github.com/aws/aws-sdk-go/service/s3" "bytes"
"github.com/aws/aws-sdk-go/aws"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/aws/aws-sdk-go/aws/awserr"
"fmt" "fmt"
"io" "io"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"bytes"
) )
func (s3sink *S3Sink) deleteObject(key string) error { func (s3sink *S3Sink) deleteObject(key string) error {