local

package
v0.0.0-...-fc8e4da Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2013 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Signature           string
	Path                string
	PendingMediaId      string
	MediaId             string
	UploadedAt          time.Time
	UpdatedAt           time.Time
	Status              string
	MissingOnFilesystem bool
	Name                string
	Extension           string
}

func (*File) ToJson

func (f *File) ToJson() string

type LocalDirectory

type LocalDirectory struct {
	Path                string
	Recurisive          bool
	Upload              bool
	MissingOnFilesystem bool
	UpdatedAt           time.Time
}

type LocalFileDescription

type LocalFileDescription struct {
	FullPath             string
	Name                 string
	IsDir                bool
	IsMedia              bool
	Upload               bool
	Recursive            bool
	Size                 int64
	MediaContained       int64
	DirectoriesContained int64
}

type Request

type Request struct {
	Type         string
	Id           string
	Data         string
	ResponseChan chan Response
}

type Response

type Response struct {
	Type      string
	RequestId string
	Data      interface{}
}

type SettingsData

type SettingsData struct {
	UploadImages    bool     `json:"Upload images"`
	UploadVideo     bool     `json:"Upload video"`
	UploadRaw       bool     `json:"Upload RAW"`
	ImageExtensions []string `json:"Image extensions"`
	RawExtensions   []string `json:"RAW extensions"`
	VideoExtensions []string `json:"Video extensions"`
}

type State

type State struct {
	Files           map[string]File `json:"Files"`
	Api             api.API
	StateFile       string
	MaxUploadsChan  chan int  `json:"-"`
	WatchFileChan   chan File `json:"-"`
	DirectFileChan  chan File `json:"-"`
	DoneChan        chan int  `json:"-"`
	ImageExtensions []string
	RawExtensions   []string
	VideoExtensions []string
	UploadImages    bool
	UploadVideo     bool
	UploadRaw       bool

	Directories map[string]LocalDirectory
	// contains filtered or unexported fields
}

func NewState

func NewState(path string) State

func (*State) AcceptRequestsFromController

func (state *State) AcceptRequestsFromController()

func (*State) DelDirectory

func (state *State) DelDirectory(path string)

func (*State) GetDirectory

func (state *State) GetDirectory(path string) (savedDirectory LocalDirectory, ok bool)

func (*State) GetFile

func (state *State) GetFile(sig string) (savedFile File, ok bool)

func (*State) HandleFile

func (appState *State) HandleFile(file File, uploadWg *sync.WaitGroup)

func (*State) Load

func (state *State) Load()

func (*State) RegisterController

func (state *State) RegisterController(newrequestChan chan Request)

func (*State) RegisterObserver

func (state *State) RegisterObserver(newObserverChan chan Response)

func (*State) RetryFile

func (state *State) RetryFile(path string, c chan File) (found, uploaded int64, err error)

func (*State) Save

func (state *State) Save()

func (*State) SetDirectory

func (state *State) SetDirectory(d LocalDirectory)

func (*State) SetFile

func (state *State) SetFile(file File)

func (*State) ToSettingsData

func (s *State) ToSettingsData() SettingsData

func (*State) UpdateDirectoryWatchers

func (state *State) UpdateDirectoryWatchers()

func (*State) UpdateToken

func (appState *State) UpdateToken()

func (*State) UploadDirectory

func (state *State) UploadDirectory(path string, c chan File) (found, uploaded int64, err error)

func (*State) UploadFile

func (state *State) UploadFile(path string, c chan File) (found, uploaded int64, err error)

func (*State) UploadWatchedDirectories

func (state *State) UploadWatchedDirectories()

func (*State) WatchFilesystem

func (s *State) WatchFilesystem(path string)

type Watcher

type Watcher struct {
	DoneChan chan int
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(s *State, path string) Watcher

func (*Watcher) Path

func (w *Watcher) Path() string

func (*Watcher) Start

func (w *Watcher) Start()

func (*Watcher) Stop

func (w *Watcher) Stop()

Jump to

Keyboard shortcuts

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