gdrivefs

package
v0.0.0-...-24ba59d Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

func File(gfile *drive.File) *basefs.File

File converts a google drive File structure to baseFS

func New

func New(core *core.Core) core.DriverFS

New new Filesystem implementation based on gdrive Service

Types

type Config

type Config struct {
	ClientSecret struct {
		ClientID     string `json:"client_id" yaml:"client_id"`
		ClientSecret string `json:"client_secret" yaml:"client_secret"`
	} `json:"client_secret" yaml:"client_secret"`

	Auth    *oauth2.Token     `json:"auth" yaml:"auth"`
	Mime    map[string]string `json:"mime" yaml:"mime"`
	Options struct {
		Safemode bool
	}
}

Config gdrive.yaml config file structure

type Service

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

Service gdrive service information

func NewService

func NewService(coreConfig *core.Config) *Service

NewService creates and initializes a new GDrive service

func (*Service) Changes

func (s *Service) Changes() ([]*basefs.Change, error)

Changes populate a list with changes to be handled on basefs

func (*Service) Create

func (s *Service) Create(parent *basefs.File, name string, isDir bool) (*basefs.File, error)

Create create an entry in google drive

func (*Service) Delete

func (s *Service) Delete(file *basefs.File) error

Delete file from drive

func (*Service) DownloadTo

func (s *Service) DownloadTo(w io.Writer, file *basefs.File) error

DownloadTo from gdrive to a writer

func (*Service) ListAll

func (s *Service) ListAll() ([]*basefs.File, error)

ListAll lists all files recursively to cache locally

func (*Service) Move

func (s *Service) Move(file *basefs.File, newParent *basefs.File, name string) (*basefs.File, error)

Move a file in drive

func (*Service) StatFS

func (s *Service) StatFS(op *fuseops.StatFSOp) error

StatFS fetches filesystem usage and freespace

func (*Service) Upload

func (s *Service) Upload(reader io.Reader, file *basefs.File) (*basefs.File, error)

Upload a file

Jump to

Keyboard shortcuts

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