v0.3.11 Latest Latest

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

Go to latest
Published: Jan 12, 2016 License: MIT Imports: 12 Imported by: 0




This section is empty.


View Source
var (
	ErrBadPath = errors.New("bad path")
	ErrIsDir   = errors.New("is directory")
View Source
var (
	ErrFileTooLarge    = errors.New("file too large for cache")
	ErrFileDisappeared = errors.New("file disappeared")


This section is empty.


type Cache

type Cache struct {
	// contains filtered or unexported fields

func NewCache

func NewCache(root string) (ret *Cache, err error)

func (*Cache) Info

func (me *Cache) Info() (ret CacheInfo)

func (*Cache) OpenFile

func (me *Cache) OpenFile(path string, flag int) (ret *File, err error)

func (*Cache) Remove

func (me *Cache) Remove(path string) (err error)

func (*Cache) SetCapacity

func (me *Cache) SetCapacity(capacity int64)

func (*Cache) TrimToCapacity

func (me *Cache) TrimToCapacity()

func (*Cache) WalkItems

func (me *Cache) WalkItems(cb func(ItemInfo))

Calls the function for every item known to the cache. The ItemInfo should not be modified.

type CacheInfo

type CacheInfo struct {
	Capacity int64
	Filled   int64
	NumItems int

type File

type File struct {
	// contains filtered or unexported fields

func (*File) Close

func (me *File) Close() error

func (*File) Read

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

func (*File) ReadAt

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

func (*File) Remove

func (me *File) Remove() (err error)

func (*File) Seek

func (me *File) Seek(offset int64, whence int) (ret int64, err error)

func (*File) Stat

func (me *File) Stat() (os.FileInfo, error)

func (*File) Write

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

type ItemInfo

type ItemInfo struct {
	Accessed time.Time
	Size     int64
	Path     string

type Iterator

type Iterator interface {
	Next() Iterator
	Value() interface{}

Jump to

Keyboard shortcuts

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