Documentation ¶
Overview ¶
Virtual file system client implementation for Go.
Index ¶
- Variables
- func List(u *url.URL) ([]string, error)
- func Open(u *url.URL) (io.ReadCloser, error)
- func OpenForAppend(u *url.URL) (io.WriteCloser, error)
- func OpenForWrite(u *url.URL) (io.WriteCloser, error)
- func RegisterFileSystem(schema string, fs FileSystem)
- func RegisterWatcher(schema string, creator WatcherCreator)
- func Remove(u *url.URL) error
- type FileSystem
- type ReadCloserFake
- type Watcher
- type WatcherCreator
Constants ¶
This section is empty.
Variables ¶
var FS_OperationNotImplementedError error = errors.New("Operation not implemented for this file system")
Functions ¶
func List ¶
Read all names under the given path as file names. Requires "u" to point to a directory. The list of file names returned should only be short, local names which can be appended to the URL to form a new one.
func OpenForAppend ¶
func OpenForAppend(u *url.URL) (io.WriteCloser, error)
Return a writer for appending data to the file given as "u". Any writer should guarantee that all data has been written by the time Close() returns without an error. No other guarantees have to be given.
func OpenForWrite ¶
func OpenForWrite(u *url.URL) (io.WriteCloser, error)
Return a writer for the file given as "u". Any writer should guarantee that all data has been written by the time Close() returns without an error. No other guarantees have to be given.
func RegisterFileSystem ¶
func RegisterFileSystem(schema string, fs FileSystem)
Register "fs" as a file system implementation for all URLs with the given "schema".
func RegisterWatcher ¶
func RegisterWatcher(schema string, creator WatcherCreator)
Register "creator" as a handler for watchers for all URLs with the given "schema".
Types ¶
type FileSystem ¶
type FileSystem interface { Open(*url.URL) (io.ReadCloser, error) OpenForWrite(*url.URL) (io.WriteCloser, error) OpenForAppend(*url.URL) (io.WriteCloser, error) List(*url.URL) ([]string, error) Watch(*url.URL, func(string, io.ReadCloser)) (Watcher, error) Remove(*url.URL) error }
Object providing all relevant operations for file systems. The individual file system backend implementations need to handle these properly, or return a FS_OperationNotImplementedError.
type ReadCloserFake ¶
type ReadCloserFake struct {
// contains filtered or unexported fields
}
Helper structure to offer read and close functionality on Doozer files.
func NewReadCloserFake ¶
func NewReadCloserFake(reader io.Reader) *ReadCloserFake
Create an ew ReadCloserFake object reading from "reader".
func (*ReadCloserFake) Close ¶
func (d *ReadCloserFake) Close() error
Close the ReadCloser, making all subsequent calls to Read() return EOF.
type Watcher ¶
type Watcher interface { // Stop listening for notifications on the given file. This may take // until the next event to take effect. Shutdown() error // Retrieve the error channel associated with the watcher. // It will stream a list of all errors created while watching. ErrChan() chan error }
Watchers are the objects doing the actual watching of individual files. They are configured by the WatcherCreator and will continue invoking their configured handlers until Shutdown() is called.
func Watch ¶
Watch the given "fileurl" for changes, sending all of them to the specified "handler". This will look up the required handler for the scheme specified in the URL and forward the watch request. A Watcher object is returned which can be used to stop watching, as defined by the individual watchers.
type WatcherCreator ¶
Objects describing how to watch a specific type of files, identified by their URL schema. Watch will be invoked whenever watching a file with the given schema is requested.