add filer replication to google cloud storage

This commit is contained in:
Chris Lu
2018-10-06 13:08:38 -07:00
parent f8c2704d2b
commit 84d4a2c8a0
2 changed files with 5 additions and 10 deletions

View File

@@ -179,7 +179,7 @@ ttlSec = 0
[sink.s3] [sink.s3]
# experimental # experimental
# See https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/sessions.html # read credentials doc at https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/sessions.html
# default loads credentials from the shared credentials file (~/.aws/credentials). # default loads credentials from the shared credentials file (~/.aws/credentials).
enabled = false enabled = false
aws_access_key_id = "" # if empty, loads from the shared credentials file (~/.aws/credentials). aws_access_key_id = "" # if empty, loads from the shared credentials file (~/.aws/credentials).
@@ -189,13 +189,11 @@ bucket = "your_bucket_name" # an existing bucket
directory = "" # destination directory (do not prefix or suffix with "/") directory = "" # destination directory (do not prefix or suffix with "/")
[sink.google_cloud_storage] [sink.google_cloud_storage]
# experimental # read credentials doc at https://cloud.google.com/docs/authentication/getting-started
# see https://cloud.google.com/docs/authentication/getting-started
enabled = false enabled = false
google_application_credentials = "/path/to/x.json" # path to json credential file google_application_credentials = "/path/to/x.json" # path to json credential file
projectId = "your_project_id" bucket = "your_bucket_seaweedfs" # an existing bucket
bucket = "your_bucket_name" # an existing bucket directory = "/" # destination directory
directory = "/" # destination directory
` `
) )

View File

@@ -17,7 +17,6 @@ import (
type GcsSink struct { type GcsSink struct {
client *storage.Client client *storage.Client
projectId string
bucket string bucket string
dir string dir string
filerSource *source.FilerSource filerSource *source.FilerSource
@@ -38,7 +37,6 @@ func (g *GcsSink) GetSinkToDirectory() string {
func (g *GcsSink) Initialize(configuration util.Configuration) error { func (g *GcsSink) Initialize(configuration util.Configuration) error {
return g.initialize( return g.initialize(
configuration.GetString("google_application_credentials"), configuration.GetString("google_application_credentials"),
configuration.GetString("projectId"),
configuration.GetString("bucket"), configuration.GetString("bucket"),
configuration.GetString("directory"), configuration.GetString("directory"),
) )
@@ -48,8 +46,7 @@ func (g *GcsSink) SetSourceFiler(s *source.FilerSource) {
g.filerSource = s g.filerSource = s
} }
func (g *GcsSink) initialize(google_application_credentials, projectId, bucketName, dir string) (error) { func (g *GcsSink) initialize(google_application_credentials, bucketName, dir string) (error) {
g.projectId = projectId
g.bucket = bucketName g.bucket = bucketName
g.dir = dir g.dir = dir