source

package
v0.0.0-...-44d8e33 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const ErrTypeFileObjectSchemeNotavaliable = ErrorType("schemenotavaliable")

Variables

This section is empty.

Functions

func IsSame

func IsSame(src Source, dst Source) bool

func NewFileObjectSchemeError

func NewFileObjectSchemeError(id string) error

func PanicErrorHandler

func PanicErrorHandler(err error)

func Read

func Read(s Source) ([]byte, error)

func RegisterCreator

func RegisterCreator(name string, creator func(id string) (Source, error))

Types

type ErrorType

type ErrorType string

func GetErrorType

func GetErrorType(err error) ErrorType

type File

type File string

func (File) AbsolutePath

func (f File) AbsolutePath() string

func (File) ID

func (f File) ID() string

func (File) ReadRaw

func (f File) ReadRaw() ([]byte, error)

type FileObjectError

type FileObjectError struct {
	Type   ErrorType
	Msg    string
	FileID string
}

func (*FileObjectError) Error

func (f *FileObjectError) Error() string

type SchemeWatcher

type SchemeWatcher struct {
	Scheme string
	Watcher
}

func NewSchemeWatcher

func NewSchemeWatcher(scheme string, watcher Watcher) *SchemeWatcher

func (*SchemeWatcher) Watch

func (w *SchemeWatcher) Watch(s Source, callback func()) (unwatcher func(), err error)

type Source

type Source interface {
	ReadRaw() ([]byte, error)
	AbsolutePath() string
	ID() string
}

func New

func New(id string) (Source, error)

type Text

type Text string

func (Text) AbsolutePath

func (f Text) AbsolutePath() string

func (Text) ID

func (f Text) ID() string

func (Text) ReadRaw

func (f Text) ReadRaw() ([]byte, error)

type Unwatcher

type Unwatcher struct {
	Hanlder func()
	Source  Source
}

type WatchManager

type WatchManager struct {
	Unwatchers []*Unwatcher

	ErrorHandler func(err error)
	// contains filtered or unexported fields
}

func NewWatchManager

func NewWatchManager() *WatchManager

func (*WatchManager) AddUnwatcher

func (w *WatchManager) AddUnwatcher(s Source, h func())

func (*WatchManager) C

func (w *WatchManager) C() chan int

func (*WatchManager) RegisterWatcher

func (w *WatchManager) RegisterWatcher(watcher Watcher) error

func (*WatchManager) Reset

func (w *WatchManager) Reset() error

func (*WatchManager) Start

func (w *WatchManager) Start() error

func (*WatchManager) Stop

func (w *WatchManager) Stop() error

func (*WatchManager) Unwatch

func (w *WatchManager) Unwatch()

func (*WatchManager) Watch

func (w *WatchManager) Watch(s Source, callback func()) (unwatcher func(), err error)

type Watcher

type Watcher interface {
	Watch(s Source, callback func()) (unwatcher func(), err error)
	Init() error
	StartWatching() error
	StopWatching() error
	ErrorChan() chan error
}

Directories

Path Synopsis
watchers

Jump to

Keyboard shortcuts

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