Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDevice ¶
func RegisterDevice(fsType string, imp DeviceBuilder)
func RegisterHeaderDevice(fsType string, imp HeaderDeviceBuilder) { reg.HeaderDevices[fsType] = imp }
func RegisterSimpleDevice ¶
func RegisterSimpleDevice(fsType string, imp SimpleDeviceBuilder)
Types ¶
type DeviceBuilder ¶
type HeaderDeviceBuilder func(mountPoint string, config []byte) HeaderDevice
type File ¶
type File interface { Read(offest, size int) (body []byte, err error) Write(offset int, body []byte) (int, error) Close() error }
File ... This interface support reading / writing large files
type HeaderDevice ¶
type HeaderDevice interface { Mount(config []byte) error Unmount() error List(path string) ([]string, error) Open(path string) (HeaderFile, error) }
HeaderDevice ... Devices that have a header as part of reading / writing
type HeaderFile ¶
type HeaderFile interface { Read() (header, body []byte, err error) Write(offset int, header, body []byte) (int, error) }
Devices with headers concept
HeaderFile ... Support for a file with header
type Registered ¶
type Registrar ¶
type Registrar struct { //HeaderDevices map[string]HeaderDeviceBuilder Devices map[string]DeviceBuilder SimpleDevices map[string]SimpleDeviceBuilder }
type SimpleDevice ¶
type SimpleDevice interface { StdDevice Open(path string) (SimpleFile, error) }
SimpleDevice ... Simplified interface for interacting with a device
func MountSimpleDevice ¶
func MountSimpleDevice(fsType, mountPoint string, config []byte) (SimpleDevice, error)
func MountHeaderDevice(fsType, mountPoint string, config []byte) (HeaderDevice, error) { imp, exists := reg.HeaderDevices[fsType] if !exists { return nil, errors.New(fmt.Sprintf("No file system type %s", fsType)) } return imp(mountPoint, config), nil }
type SimpleDeviceBuilder ¶
type SimpleDeviceBuilder func(mountPoint string, config []byte) SimpleDevice
Click to show internal directories.
Click to hide internal directories.