Documentation ¶
Index ¶
- Constants
- func FileBlockRegister(name string, handler fileBlockHandler) (err error)
- func FileBlockUse(name string) (handler fileBlockHandler, err error)
- func LoadIndexFromFile(filename string) (indexTable map[string]*Index, err error)
- func NewIndexWriter(filename string, trunc bool) (w *indexWriter, err error)
- func RangeIndexFromFile(filename string, doFunc func(key string, index *Index)) (err error)
- type Block
- func (b *Block) DefragContent(defragDuration time.Duration) (err error)
- func (b *Block) Del(key string) (err error)
- func (b *Block) Get(key string) (value []byte, err error)
- func (b *Block) Initiate(ctx context.Context, conf *config.Instance) (err error)
- func (b *Block) Range(doFunc func(key string, exist bool)) (err error)
- func (b *Block) Set(key string, value []byte) (err error)
- type BlockHandler
- type ContentReader
- type ContentWriter
- type Index
- type IndexReader
- type IndexWriter
- type Instance
- func (this *Instance) DefragContent(defragDuration time.Duration) (err error)
- func (this *Instance) Del(key string) (err error)
- func (this *Instance) Get(key string) (value []byte, err error)
- func (this *Instance) Initiate(ctx context.Context) (newCtx context.Context, err error)
- func (this *Instance) OnRequestShutdown(ctx context.Context, c *routing.Context) (context.Context, error)
- func (this *Instance) OnRequestStartup(ctx context.Context, c *routing.Context) (context.Context, error)
- func (this *Instance) OnShutdown(ctx context.Context) (context.Context, error)
- func (this *Instance) OnStartup(ctx context.Context) (newCtx context.Context, err error)
- func (this *Instance) Range(doFunc func(key string, exist bool)) (err error)
- func (this *Instance) Set(key string, value []byte) (err error)
- func (this *Instance) Use(ctx context.Context, handlerName string) (err error)
Constants ¶
View Source
const ( FilenameSuffixInSecond string = "20060102150405" FilenameBlockIndex string = "blockIndex" FilenameBlockIndexTemp string = "blockIndexTemp" )
Variables ¶
This section is empty.
Functions ¶
func FileBlockRegister ¶
func FileBlockUse ¶
func LoadIndexFromFile ¶
func NewIndexWriter ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
func (*Block) DefragContent ¶
content整理 set相同key的时候, 之前key的index会更新, 但是旧content还保留着 删除key时, content还保留着
type BlockHandler ¶
type BlockHandler interface { Initiate(ctx context.Context, conf *config.Instance) error Set(key string, value []byte) (err error) Get(key string) (value []byte, err error) Del(key string) (err error) DefragContent(defragDuration time.Duration) (err error) Range(doFunc func(key string, exist bool)) (err error) }
func NewFileBlockHandler ¶
func NewFileBlockHandler() BlockHandler
type ContentReader ¶
type ContentReader interface { Read(offset uint64, length uint32) (value []byte, err error) SequentialRead() (key string, index *Index, err error) Close() error }
func NewContentReader ¶
func NewContentReader(filename, basepath string) (r ContentReader, err error)
type ContentWriter ¶
type ContentWriter interface { Write(key []byte, value []byte) (index *Index, err error) Close() error Size() int64 }
func NewContentWriter ¶
func NewContentWriter(filename, basepath string) (w ContentWriter, err error)
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func NewDelIndex ¶
func NewDelIndex() (idx *Index)
func (*Index) MarshalBinary ¶
func (*Index) UnmarshalBinary ¶
type IndexReader ¶
func NewIndexReader ¶
func NewIndexReader(filename string) (r IndexReader, err error)
type IndexWriter ¶
type Instance ¶
func NewInstance ¶
func NewInstance() *Instance
func (*Instance) DefragContent ¶
func (*Instance) OnRequestShutdown ¶
func (*Instance) OnRequestStartup ¶
func (*Instance) OnShutdown ¶
Click to show internal directories.
Click to hide internal directories.