folder

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePathMap   = 1
	TypeCloudSync = 2
	TypeCifsSmb   = 3
)
View Source
const (
	StatusErrorConfig = "ErrorConfig"
	StatusDisable     = "Disable"
	StatusEnable      = "Enable"
	StatusPause       = "Pause"
	StatusSyncing     = "Syncing"
)

Folder Status definition

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudSyncConfig

type CloudSyncConfig struct {
	SyncThingID   string `json:"syncThingID"`
	BuilderSThgID string `json:"builderSThgID"`
}

CloudSyncConfig CloudSync (AKA Syncthing) specific data

type EventCB

type EventCB func(cfg *FolderConfig, data *EventCBData)

type EventCBData

type EventCBData map[string]interface{}

type FolderConfig

type FolderConfig struct {
	ID         string     `json:"id"`
	Label      string     `json:"label"`
	ClientPath string     `json:"path"`
	Type       FolderType `json:"type"`
	Status     string     `json:"status"`
	IsInSync   bool       `json:"isInSync"`
	DefaultSdk string     `json:"defaultSdk"`

	// Not exported fields from REST API point of view
	RootPath string `json:"-"`

	// Specific data depending on which Type is used
	DataPathMap   PathMapConfig   `json:"dataPathMap,omitempty"`
	DataCloudSync CloudSyncConfig `json:"dataCloudSync,omitempty"`
}

FolderConfig is the config for one folder

type FolderType

type FolderType int

FolderType definition

type IFOLDER

type IFOLDER interface {
	NewUID(suffix string) string                              // Get a new folder UUID
	Add(cfg FolderConfig) (*FolderConfig, error)              // Add a new folder
	GetConfig() FolderConfig                                  // Get folder public configuration
	GetFullPath(dir string) string                            // Get folder full path
	Remove() error                                            // Remove a folder
	RegisterEventChange(cb *EventCB, data *EventCBData) error // Request events registration (sent through WS)
	UnRegisterEventChange() error                             // Un-register events
	Sync() error                                              // Force folder files synchronization
	IsInSync() (bool, error)                                  // Check if folder files are in-sync
}

IFOLDER Folder interface

type PathMap

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

PathMap .

func NewFolderPathMap

func NewFolderPathMap(gc *xdsconfig.Config) *PathMap

NewFolderPathMap Create a new instance of PathMap

func (*PathMap) Add

func (f *PathMap) Add(cfg FolderConfig) (*FolderConfig, error)

Add a new folder

func (*PathMap) GetConfig

func (f *PathMap) GetConfig() FolderConfig

GetConfig Get public part of folder config

func (*PathMap) GetFullPath

func (f *PathMap) GetFullPath(dir string) string

GetFullPath returns the full path

func (*PathMap) IsInSync

func (f *PathMap) IsInSync() (bool, error)

IsInSync Check if folder files are in-sync

func (*PathMap) NewUID

func (f *PathMap) NewUID(suffix string) string

NewUID Get a UUID

func (*PathMap) RegisterEventChange

func (f *PathMap) RegisterEventChange(cb *EventCB, data *EventCBData) error

RegisterEventChange requests registration for folder change event

func (*PathMap) Remove

func (f *PathMap) Remove() error

Remove a folder

func (*PathMap) Sync

func (f *PathMap) Sync() error

Sync Force folder files synchronization

func (*PathMap) UnRegisterEventChange

func (f *PathMap) UnRegisterEventChange() error

UnRegisterEventChange remove registered callback

type PathMapConfig

type PathMapConfig struct {
	ServerPath string `json:"serverPath"`
}

PathMapConfig Path mapping specific data

Jump to

Keyboard shortcuts

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