file2

package
v0.0.0-...-2c8b24f Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2015 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BLOCKSIZE = 4096
View Source
const CONTROLSIZE = 20
View Source
const MAX_HEAP = false
View Source
const MIN_HEAP = true

Variables

Functions

This section is empty.

Types

type BlockAllocator

type BlockAllocator interface {
	Free(key int64) error
	Allocate() (key int64, err error)
	AllocateBlocks(n int) (key int64, err error)
}

type BlockDevice

type BlockDevice interface {
	BlockReadWriter
	BlockAllocator
	Closer
	RootController
}

type BlockFile

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

func NewBlockFile

func NewBlockFile(path string, buf buf.Buffer) *BlockFile

func NewBlockFileCustomBlockSize

func NewBlockFileCustomBlockSize(path string, buf buf.Buffer, size uint32) *BlockFile

func (*BlockFile) Allocate

func (self *BlockFile) Allocate() (pos int64, err error)

func (*BlockFile) AllocateBlocks

func (self *BlockFile) AllocateBlocks(n int) (pos int64, err error)

func (*BlockFile) BlockSize

func (self *BlockFile) BlockSize() uint32

func (*BlockFile) Close

func (self *BlockFile) Close() error

func (*BlockFile) ControlData

func (self *BlockFile) ControlData() (data ByteSlice, err error)

func (*BlockFile) Free

func (self *BlockFile) Free(pos int64) error

func (*BlockFile) Open

func (self *BlockFile) Open() error

func (*BlockFile) Path

func (self *BlockFile) Path() string

func (*BlockFile) ReadBlock

func (self *BlockFile) ReadBlock(p int64) (ByteSlice, error)

func (*BlockFile) ReadBlocks

func (self *BlockFile) ReadBlocks(p int64, n int) (ByteSlice, error)

func (*BlockFile) Remove

func (self *BlockFile) Remove() error

func (*BlockFile) SetControlData

func (self *BlockFile) SetControlData(data ByteSlice) (err error)

func (*BlockFile) Size

func (self *BlockFile) Size() (uint64, error)

func (*BlockFile) WriteBlock

func (self *BlockFile) WriteBlock(p int64, block ByteSlice) error

type BlockReadWriter

type BlockReadWriter interface {
	BlockSizer
	ReadBlock(key int64) (block ByteSlice, err error)
	ReadBlocks(key int64, n int) (blocks ByteSlice, err error)
	WriteBlock(key int64, block ByteSlice) error
}

type BlockReader

type BlockReader interface {
	BlockSizer
	ReadBlock(key int64) (block ByteSlice, err error)
	ReadBlocks(key int64, n int) (blocks ByteSlice, err error)
}

type BlockSizer

type BlockSizer interface {
	BlockSize() uint32
}

type BlockWriter

type BlockWriter interface {
	BlockSizer
	WriteBlock(key int64, block ByteSlice) error
}

type Closer

type Closer interface {
	Close() error
}

type LFUCacheFile

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

func NewLFUCacheFile

func NewLFUCacheFile(file RemovableBlockDevice, size uint64) (cf *LFUCacheFile, err error)

func (*LFUCacheFile) Allocate

func (self *LFUCacheFile) Allocate() (key int64, err error)

func (*LFUCacheFile) AllocateBlocks

func (self *LFUCacheFile) AllocateBlocks(n int) (key int64, err error)

func (*LFUCacheFile) BlockSize

func (self *LFUCacheFile) BlockSize() uint32

func (*LFUCacheFile) Close

func (self *LFUCacheFile) Close() error

func (*LFUCacheFile) ControlData

func (self *LFUCacheFile) ControlData() (data bs.ByteSlice, err error)

func (*LFUCacheFile) Free

func (self *LFUCacheFile) Free(key int64) error

func (*LFUCacheFile) ReadBlock

func (self *LFUCacheFile) ReadBlock(key int64) (block bs.ByteSlice, err error)

func (*LFUCacheFile) ReadBlocks

func (self *LFUCacheFile) ReadBlocks(key int64, n int) (blocks bs.ByteSlice, err error)

func (*LFUCacheFile) Remove

func (self *LFUCacheFile) Remove() error

func (*LFUCacheFile) SetControlData

func (self *LFUCacheFile) SetControlData(data bs.ByteSlice) (err error)

func (*LFUCacheFile) WriteBlock

func (self *LFUCacheFile) WriteBlock(key int64, block bs.ByteSlice) (err error)

type LRUCacheFile

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

func NewLRUCacheFile

func NewLRUCacheFile(file RemovableBlockDevice, size uint64) (cf *LRUCacheFile, err error)

func OpenLRUCacheFile

func OpenLRUCacheFile(file RemovableBlockDevice, size uint64) (cf *LRUCacheFile, err error)

func (*LRUCacheFile) Allocate

func (self *LRUCacheFile) Allocate() (key int64, err error)

func (*LRUCacheFile) AllocateBlocks

func (self *LRUCacheFile) AllocateBlocks(n int) (key int64, err error)

func (*LRUCacheFile) BlockSize

func (self *LRUCacheFile) BlockSize() uint32

func (*LRUCacheFile) Close

func (self *LRUCacheFile) Close() error

func (*LRUCacheFile) ControlData

func (self *LRUCacheFile) ControlData() (data bs.ByteSlice, err error)

func (*LRUCacheFile) Free

func (self *LRUCacheFile) Free(key int64) error

func (*LRUCacheFile) Persist

func (self *LRUCacheFile) Persist() error

func (*LRUCacheFile) ReadBlock

func (self *LRUCacheFile) ReadBlock(key int64) (block bs.ByteSlice, err error)

func (*LRUCacheFile) ReadBlocks

func (self *LRUCacheFile) ReadBlocks(key int64, n int) (blocks bs.ByteSlice, err error)

func (*LRUCacheFile) Remove

func (self *LRUCacheFile) Remove() error

func (*LRUCacheFile) SetControlData

func (self *LRUCacheFile) SetControlData(data bs.ByteSlice) (err error)

func (*LRUCacheFile) WriteBlock

func (self *LRUCacheFile) WriteBlock(key int64, block bs.ByteSlice) (err error)

type Removable

type Removable interface {
	Remove() error
}

type RemovableBlockDevice

type RemovableBlockDevice interface {
	BlockDevice
	Removable
}

type RootController

type RootController interface {
	ControlData() (block ByteSlice, err error)
	SetControlData(block ByteSlice) (err error)
}

Jump to

Keyboard shortcuts

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