volume

package
v0.0.0-...-f2d997f Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReversedsizeOffsetPrefix = '\x11' //key= "\x01"+Reversesize(8 byte)+offset(8 byte) value=[]
	OffsetSizePrefix         = '\x22' //key= "\x02"+offset(8 byte)+size(8 byte) value=[]
)

Variables

View Source
var (
	TruncateSize  uint64 = 1 << 30            //1GB
	MaxVolumeSize uint64 = 512 * TruncateSize //512GB
)

Functions

This section is empty.

Types

type File

type File struct {
	DataFile *os.File
	Info     *FileInfo
	// contains filtered or unexported fields
}

func (*File) Read

func (f *File) Read(b []byte) (n int, err error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Write

func (f *File) Write(b []byte) (n int, err error)

type FileInfo

type FileInfo struct {
	Fid      uint64
	Offset   uint64
	Size     uint64
	Ctime    time.Time
	Mtime    time.Time
	Atime    time.Time
	FileName string
}

func (*FileInfo) MarshalBinary

func (iv *FileInfo) MarshalBinary() []byte

func (*FileInfo) UnMarshalBinary

func (iv *FileInfo) UnMarshalBinary(data []byte) (err error)

type Index

type Index interface {
	Has(fid uint64) bool
	Get(fid uint64) (*FileInfo, error)
	Set(fi *FileInfo) error
	Delete(fid uint64) error
	io.Closer
}

type LevelDBIndex

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

func NewLevelDBIndex

func NewLevelDBIndex(dir string, vid uint64) (index *LevelDBIndex, err error)

func (*LevelDBIndex) Close

func (l *LevelDBIndex) Close() error

func (*LevelDBIndex) Delete

func (l *LevelDBIndex) Delete(fid uint64) error

func (*LevelDBIndex) Get

func (l *LevelDBIndex) Get(fid uint64) (*FileInfo, error)

func (*LevelDBIndex) Has

func (l *LevelDBIndex) Has(fid uint64) bool

func (*LevelDBIndex) Set

func (l *LevelDBIndex) Set(fi *FileInfo) error

type Status

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

status主要存储空闲块的offset size

func NewStatus

func NewStatus(dir string, vid uint64) (status *Status, err error)

type Volume

type Volume struct {
	Id        uint64
	WriteAble bool
	// contains filtered or unexported fields
}

func NewVolume

func NewVolume(dir string, vid uint64) (v *Volume, err error)

func (*Volume) Close

func (v *Volume) Close()

func (*Volume) Delete

func (v *Volume) Delete(fid uint64, fileName string) error

func (*Volume) Get

func (v *Volume) Get(fid uint64) (*File, error)

func (*Volume) GetDatafileSize

func (v *Volume) GetDatafileSize() uint64

func (*Volume) GetMaxFreeSpace

func (v *Volume) GetMaxFreeSpace() uint64

func (*Volume) NewFile

func (v *Volume) NewFile(fid uint64, fileName string, size uint64) (f *File, err error)

Jump to

Keyboard shortcuts

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