fs

package
v0.0.0-...-b3e5fcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfigPath

func ValidateConfigPath(path string) error

ValidateConfigPath just makes sure, that the path provided is a file, that can be read

Types

type Config

type Config struct {
	Server struct {
		ServerURL    string `yaml:"url" default:"sdfss://localhost:6442" envconfig:"URL"`
		Password     string `yaml:"password" default:"" envconfig:"PASSWORD"`
		DisableTrust bool   `yaml:"disable_trust" envconfig:"DISABLE_TRUST"`
	} `yaml:"server"`
	Listener struct {
		Download bool     `yaml:"download" envconfig:"DOWNLOAD"`
		Upload   bool     `yaml:"upload" envconfig:"UPLOAD"`
		Write    bool     `yaml:"write" envconfig:"WRITE"`
		Delete   bool     `yaml:"delete" envconfig:"READ"`
		Ignore   []string `yaml:"ignore" default:".sdfsclitemp/"`
	} `yaml:"listener"`
	GCS struct {
		Credentials string `yaml:"credentials" envconfig:"GOOGLE_APPLICATION_CREDENTIALS"`
		BucketName  string `yaml:"bucket" envconfig:"GCS_BUCKET"`
		ProjectID   string `yaml:"projectid" envconfig:"GCS_PROJECT_ID"`
		BasePath    string `yaml:"base_path" evnconfig:"GCS_BASE_PATH"`
		Enabled     bool   `yaml:"enabled" envconfig:"GCS_ENABLED"`
		Region      string `yaml:"region" default:"US" envconfig:"GCS_REGION"`
		TempDir     string `yaml:"tempdir" default:"/tmp" envconfig:"GCS_TEMP_DIR"`
		Retry       int    `yaml:"retry" default:"3" envconfig:"GCS_RETRY"`
		// contains filtered or unexported fields
	} `yaml:"gcs"`
	FOLDER struct {
		Path        string `yaml:"base_path" envconfig:"LOCAL_PATH"`
		Owner       int64  `yaml:"owner" default:"0" envconfig:"LOCAL_OWNER"`
		Group       int64  `yaml:"group" default:"0" envconfig:"LOCAL_GROUP"`
		Permissions int32  `yaml:"permissions" default:"0" envconfig:"LOCAL_PERMISSIONS"`
		Enabled     bool   `yaml:"enabled" envconfig:"LOCAL_ENABLED"`
	} `yaml:"folder"`
}

Config is the configuration of the Connection

func NewConfig

func NewConfig(configPath string) (*Config, error)

NewConfig returns a new decoded Config struct

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener is the listener object for executing on changes

func NewsdfsListener

func NewsdfsListener(config string, debug bool) (*Listener, error)

NewsdfsListener returns a listener for a sdfs file system changes whose config file is the given config file. This node implements all NodeXxxxer operations available.

func (*Listener) CopyLocally

func (n *Listener) CopyLocally(ctx context.Context, resp *spb.FileInfoResponse) error

CopyLocally creates a local copy of the file

func (*Listener) CreateGCSBucket

func (n *Listener) CreateGCSBucket(ctx context.Context) error

CreateGCSBucket creates a GCS bucket if it does not exist

func (*Listener) Listen

func (n *Listener) Listen(ctx context.Context) error

Listen captures changes and runs stuff

func (*Listener) UploadToGCS

func (n *Listener) UploadToGCS(ctx context.Context, resp *spb.FileInfoResponse) error

UploadToGCS uploads a file to GCS

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL