Documentation ¶
Index ¶
- Variables
- type Block
- func (b *Block) CRC() uint32
- func (b *Block) Copy(offset int, from []byte) int
- func (b *Block) EndAt(offset int)
- func (b *Block) IsEmpty() bool
- func (b *Block) IsPartial() bool
- func (b *Block) Merge(toMerge *Block)
- func (b *Block) Payload() []byte
- func (b *Block) Reset()
- func (b *Block) StartFrom(offset int)
- type BlockReaderStream
- type BlockWriterStream
- type Disk
- func (d *Disk) Mkdir(name string, all bool) error
- func (d *Disk) ReadAt(name string, p []byte, off int64) (int, error)
- func (d *Disk) ReadDir(name string) ([]os.FileInfo, error)
- func (d *Disk) Remove(name string, all bool) error
- func (d *Disk) Rename(oldname, newname string) error
- func (d *Disk) WriteAt(name string, p []byte, off int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPayloadSizeTooLarge indicates the input payload size is too big ErrPayloadSizeTooLarge = errors.New("disk: bad payload size") // ErrBadCRC indicates there is not CRC can be found in the block ErrBadCRC = errors.New("disk: not a valid CRC") )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a buffer aligned with disk data block with two offset (left and right) representing the start and end of the effective payload inside the buffer
func (*Block) Copy ¶
Copy copies a byte array to the offset of the buffer It also updates the effective payload offsets
type BlockReaderStream ¶
type BlockReaderStream struct {
// contains filtered or unexported fields
}
func (*BlockReaderStream) NextBlock ¶
func (brs *BlockReaderStream) NextBlock() (*Block, error)
type BlockWriterStream ¶
type BlockWriterStream struct {
// contains filtered or unexported fields
}
func (*BlockWriterStream) NextBlock ¶
func (bws *BlockWriterStream) NextBlock() (*Block, error)
NextBlock gets the next block from the input stream
type Disk ¶
type Disk struct { // Name is the name of the disk. Name string // Root is the root path of the disk // Usually it is the mount point of a disk or a directory // under the mount point. Root string }
TODO: interface?
Click to show internal directories.
Click to hide internal directories.