mfs

package
v0.0.0-...-5a8ff1d Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	BlockSize: 1 << 20,
	RoundSize: 1 << 30,
}

DefaultConfig has the default value, with 1MB per block and 1GB per round.

Functions

This section is empty.

Types

type Config

type Config struct {
	BlockSize int32
	RoundSize int64
}

Config is the global config for mfs.

type File

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

File is a high level interface which can be read or write at specified offset.

func (*File) Fd

func (f *File) Fd() uint32

Fd returns the unique file id in this volume.

func (*File) ReadAt

func (f *File) ReadAt(b []byte, off int64) (n int, err error)

ReadAt implements io.ReaderAt

func (*File) String

func (f *File) String() string

func (*File) WriteAt

func (f *File) WriteAt(b []byte, off int64) (n int, err error)

WriteAt implements io.WriterAt

type Volume

type Volume struct {
	*Config
	// contains filtered or unexported fields
}

Volume can have many files.

func Open

func Open(name string, cfg *Config) (v *Volume, err error)

Open an exist volume or create a new volume on disk.

func (*Volume) Close

func (v *Volume) Close()

Close unmap all mapped files

func (*Volume) Files

func (v *Volume) Files() (ret []*File)

Files returns all files in this volume.

func (*Volume) Name

func (v *Volume) Name() string

Name is the name, also the path of the volume

func (*Volume) Open

func (v *Volume) Open(fd uint32) (f *File, err error)

Open a file on volume to read and write.

func (*Volume) String

func (v *Volume) String() string

Jump to

Keyboard shortcuts

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