Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type BlockMeta
- func (b *BlockMeta) AddLength(n int)
- func (b BlockMeta) GetAddr() int64
- func (b BlockMeta) GetLength() int
- func (b BlockMeta) IsEmpty() bool
- func (b *BlockMeta) Set(length int, addr int64)
- func (b *BlockMeta) SetLength(n int)
- func (b *BlockMeta) SetPadding(n int16)
- func (b BlockMeta) String() string
- type File
- type FileDelegate
- type Inode
- func (n *Inode) AddBlockSize(idx int, size int)
- func (n *Inode) FindAvailable() int
- func (n *Inode) InitBlock(idx int, addr int64)
- func (n *Inode) ReadDisk(r bio.DiskReader) error
- func (n *Inode) SetBlock(idx int, size int, addr int64)
- func (n *Inode) Size() int
- func (n *Inode) String() string
- func (n *Inode) WriteDisk(w bio.DiskWriter)
- type RootDir
- type Volume
- func (v *Volume) Close()
- func (v *Volume) DoneFlush()
- func (v *Volume) ForceFlush()
- func (v *Volume) GetFlushNotify() chan struct{}
- func (v *Volume) GetInode(ino int32) (*Inode, error)
- func (v *Volume) MallocWriter(n int) *bio.DeviceWriter
- func (v *Volume) NextInode(i *Inode) (*Inode, error)
- func (v *Volume) OpenFile(name string, autoCreate bool) (*File, error)
- func (v *Volume) PrevInode(i *Inode) (*Inode, error)
- func (v *Volume) ReadDeviceAt(b []byte, off int64) (int, error)
Constants ¶
View Source
const ( BlockBit = 12 BlockSize = 1 << BlockBit Ones52 = 0xFFFFFFFFFFFFF Ones12 = 0xFFF )
View Source
const AddressSize = 8
View Source
const InodeSize = 128
View Source
const InodeTableSize = 128
View Source
const (
ReservedAreaSize = 128 * BlockSize
)
ReservedArea
Variables ¶
View Source
var ( InodeTableMagic = []byte{0x8a, 0x9c, 0x0, 0x1} ErrDecodeNotInodeTable = logex.Define("not inodeTable") )
View Source
var ( InodeMagic = []byte{0x8a, 0x9c, 0x0, 0x2} ErrDecodeNotInode = logex.Define("not inode") )
View Source
var ( ErrInodeHasNotPrev = logex.Define("the prev of inode is nil") ErrVolumeFileNotExists = logex.Define("file is not exists") ErrVolumeFileAlreadyExists = logex.Define("file is already exists") )
View Source
var (
ErrFileClosed = logex.Define("file is closed")
)
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address int64
func FakeAddress ¶
func InodeAddress ¶
func InodeTableAddress ¶
func InodeTableAddress(i *InodeTable) Address
func (Address) WriteDisk ¶
func (i Address) WriteDisk(w bio.DiskWriter)
type FileDelegate ¶
type Inode ¶
type Inode struct { Magic [4]byte Ino int32 Start int64 End int64 Create int64 // the address of previous IndirectBlock/Inode/IndirectIndo Prev int64 BlockMeta [11]BlockMeta }
1G 要读1万个 ...
func (*Inode) AddBlockSize ¶
func (*Inode) FindAvailable ¶
func (*Inode) WriteDisk ¶
func (n *Inode) WriteDisk(w bio.DiskWriter)
type Volume ¶
type Volume struct {
// contains filtered or unexported fields
}
func (*Volume) ForceFlush ¶
func (v *Volume) ForceFlush()
func (*Volume) GetFlushNotify ¶
func (v *Volume) GetFlushNotify() chan struct{}
func (*Volume) MallocWriter ¶
func (v *Volume) MallocWriter(n int) *bio.DeviceWriter
Click to show internal directories.
Click to hide internal directories.