Documentation ¶
Index ¶
- Variables
- func RemoveContents(dir string) error
- type Config
- type EvictFunc
- type Item
- type ItemDisk
- func (itd *ItemDisk) Bytes() []byte
- func (itd *ItemDisk) Done()
- func (itd *ItemDisk) GetHIT() uint64
- func (itd *ItemDisk) GetHeader() http.Header
- func (itd *ItemDisk) GetStatusCode() int
- func (itd *ItemDisk) Len() int
- func (itd *ItemDisk) ValidRange(reqStart, reqEnd int64) (from, to, length int64, err error)
- func (itd *ItemDisk) Write(b []byte) (int, error)
- func (itd *ItemDisk) WriteTo(w io.Writer) (int64, error)
- func (itd *ItemDisk) WriteToRange(w io.Writer, from, to int64) (int64, error)
- type ItemMem
- func (itm *ItemMem) Bytes() []byte
- func (itm *ItemMem) Close()
- func (itm *ItemMem) Done()
- func (itm *ItemMem) GetHIT() uint64
- func (itm *ItemMem) GetHeader() http.Header
- func (itm *ItemMem) GetStatusCode() int
- func (itm *ItemMem) Len() int
- func (itm *ItemMem) ValidRange(reqStart, reqEnd int64) (from, to, length int64, err error)
- func (itm *ItemMem) Write(b []byte) (int, error)
- func (itm *ItemMem) WriteTo(w io.Writer) (n int64, err error)
- func (itm *ItemMem) WriteToRange(w io.Writer, from, to int64) (int64, error)
- type LSM
- type VFile
- func (vf *VFile) AutoExpire()
- func (vf *VFile) Close() error
- func (vf *VFile) CloseReader() error
- func (vf *VFile) CloseWriter() error
- func (vf *VFile) Expired() bool
- func (vf *VFile) ReadAt(b []byte, off int64) (int, error)
- func (vf *VFile) Seek() int64
- func (vf *VFile) Write(b []byte) (int, error)
- type VLog
Constants ¶
This section is empty.
Variables ¶
var ( ErrWrongRange = errors.New("Data is smaller that the range requested") ErrItemDiskWrite = errors.New("The disk items are inmutable") )
var (
ErrInvalidTTL = errors.New("The ttl is ouf of the possible ranges")
)
var (
ErrItemNotFound = errors.New("Item not found")
)
var ( // ErrReadingItemDisk is the error reponse if the range is not correct ErrReadingItemDisk = errors.New("The bytes read don't match with the body size definition") )
Functions ¶
func RemoveContents ¶
Types ¶
type Item ¶
type Item interface { Write(b []byte) (int, error) WriteTo(io.Writer) (int64, error) WriteToRange(io.Writer, int64, int64) (int64, error) ValidRange(reqStart, reqEnd int64) (from, to, length int64, err error) Bytes() []byte GetHIT() uint64 Len() int GetStatusCode() int GetHeader() http.Header Done() }
type ItemDisk ¶
type ItemDisk struct { Key uint64 StatusCode int VFile *VFile Off int64 HeadSize int64 BodySize int64 HIT uint64 // contains filtered or unexported fields }
ItemDisk is the struct that define the location of this item. Like the file where is stored and also the possition in the file for each element
func (*ItemDisk) Bytes ¶
Bytes will return the full content of the item in slice of bytes NOTE: Don't use for critical operations, it works without a sync.Pool, use WriteTo instead.
func (*ItemDisk) Done ¶
func (itd *ItemDisk) Done()
Done is a way to mark the item as "unused" so the expiration process can remove from the tree and sent it back to the pool
func (*ItemDisk) GetHeader ¶
GetHeader will read the header stored in bytes in the disk parse with the standar lib and return the interface http.Header
func (*ItemDisk) GetStatusCode ¶
GetStatusCode will return the HTTP reponse code of this item
func (*ItemDisk) ValidRange ¶
type ItemMem ¶
type ItemMem struct { Key uint64 StatusCode int Header http.Header Data []byte HIT uint64 // contains filtered or unexported fields }
ItemMem is the struct that store all the information related with the item. If the body is too big, then will be write in a temporary file that is also defined in the struct
func (*ItemMem) Close ¶
func (itm *ItemMem) Close()
Close will close and remove the underline file if is defined
func (*ItemMem) Done ¶
func (itm *ItemMem) Done()
Done is a way to mark the item as "unused" so the expiration process can remove from the tree and sent it back to the pool
func (*ItemMem) GetHeader ¶
GetHeader will read the header stored in bytes in the disk parse with the standar lib and return the interface http.Header
func (*ItemMem) GetStatusCode ¶
GetStatusCode will return the HTTP reponse code of this item
func (*ItemMem) ValidRange ¶
type VFile ¶
type VFile struct {
// contains filtered or unexported fields
}
func (*VFile) AutoExpire ¶
func (vf *VFile) AutoExpire()
AutoExpire will close all the open files related and define a time to close everything and delete the file
func (*VFile) CloseReader ¶
CloseReader will close the "reader" file
func (*VFile) CloseWriter ¶
CloseWriter will close the "writer" file