config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndicesKey = "indices"
	DriveDb    = "drivedb"
)
View Source
const (
	O_RWForAll = 0666
)

Variables

View Source
var (
	GDDirSuffix   = ".gd"
	PathSeparator = fmt.Sprintf("%c", os.PathSeparator)

	ErrNoDriveContext      = errors.New("no drive context found; run `drive init` or go into one of the directories (sub directories) that you performed `drive init`")
	ErrDerefNilIndex       = errors.New("cannot dereference a nil index")
	ErrDerefNilDB          = errors.New("cannot dereference a nil db")
	ErrEmptyFileIdForIndex = errors.New("fileId for index must be non-empty")
	ErrNoSuchDbKey         = errors.New("no such db key exists")
	ErrNoSuchDbBucket      = errors.New("no such bucket exists")
)

Functions

func DbSuffixedPath added in v0.2.6

func DbSuffixedPath(dir string) string

func LeastNonExistantRoot

func LeastNonExistantRoot(contextAbsPath string) string

Types

type Context

type Context struct {
	GSAJWTConfig *jwt.Config `json:"gsa_jwt_config,omitempty"`

	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	RefreshToken string `json:"refresh_token"`
	AbsPath      string `json:"-"`
}

func Discover

func Discover(currentAbsPath string) (*Context, error)

Discovers the gd directory, if no gd directory or credentials could be found for the path, returns ErrNoContext.

func Initialize

func Initialize(absPath string) (pathGD string, firstInit bool, c *Context, err error)

func (*Context) AbsPathOf

func (c *Context) AbsPathOf(fileOrDirPath string) string

func (*Context) CreateIndicesBucket added in v0.2.6

func (c *Context) CreateIndicesBucket() error

func (*Context) Cwd added in v0.3.2

func (c *Context) Cwd() string

func (*Context) DeInitialize added in v0.2.6

func (c *Context) DeInitialize(prompter func(...interface{}) bool, returnOnAnyError bool) error

func (*Context) DeserializeIndex

func (c *Context) DeserializeIndex(key string) (*Index, error)

func (*Context) ListKeys added in v0.2.6

func (c *Context) ListKeys(dir, bucketName string) (chan string, error)

func (*Context) OpenDB added in v0.2.8

func (c *Context) OpenDB() (*bolt.DB, error)

func (*Context) PopIndicesKey added in v0.2.6

func (c *Context) PopIndicesKey(key string) error

func (*Context) Read

func (c *Context) Read() error

func (*Context) RemoveIndex added in v0.2.5

func (c *Context) RemoveIndex(index *Index, p string) error

func (*Context) SerializeIndex

func (c *Context) SerializeIndex(index *Index) error

func (*Context) Write

func (c *Context) Write() error

type Index

type Index struct {
	FileId      string `json:"id"`
	Etag        string `json:"etag"`
	Md5Checksum string `json:"md5"`
	MimeType    string `json:"mtype"`
	ModTime     int64  `json:"mtime"`
	Version     int64  `json:"version"`
	IndexTime   int64  `json:"itime"`
}

type Mount

type Mount struct {
	CreatedMountDir   string
	ShortestMountRoot string
	Points            []*MountPoint
}

func MountPoints

func MountPoints(contextPath, contextAbsPath string, paths []string, hidden bool) (
	mount *Mount, sources []string)

type MountPoint

type MountPoint struct {
	CanClean  bool
	Name      string
	AbsPath   string
	MountPath string
}

func (*MountPoint) Unmount

func (mpt *MountPoint) Unmount() error

Jump to

Keyboard shortcuts

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