hybrid

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 8 Imported by: 93

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDiskOptions = Options{
	Type:            Disk,
	DBType:          LevelDB,
	Cleanup:         true,
	RemoveOlderThan: 24 * time.Hour * 2,
}
View Source
var DefaultHybridOptions = Options{
	Type:                 Hybrid,
	DBType:               PogrebDB,
	MemoryExpirationTime: time.Duration(5) * time.Minute,
	JanitorTime:          time.Duration(1) * time.Minute,
}
View Source
var DefaultMemoryOptions = Options{
	Type: Memory,
}
View Source
var DefaultOptions = Options{
	Type:                 Memory,
	MemoryExpirationTime: time.Duration(5) * time.Minute,
	JanitorTime:          time.Duration(1) * time.Minute,
}

Functions

This section is empty.

Types

type DBType added in v0.0.2

type DBType int
const (
	LevelDB DBType = iota
	PogrebDB
	BBoltDB
	BuntDB
)

type HybridMap

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

func New

func New(options Options) (*HybridMap, error)

func (*HybridMap) Close

func (hm *HybridMap) Close() error

func (*HybridMap) Del

func (hm *HybridMap) Del(key string) error

func (*HybridMap) Get

func (hm *HybridMap) Get(k string) ([]byte, bool)

func (*HybridMap) Scan

func (hm *HybridMap) Scan(f func([]byte, []byte) error)

func (*HybridMap) Set

func (hm *HybridMap) Set(k string, v []byte) error

func (*HybridMap) Size

func (hm *HybridMap) Size() int64

func (*HybridMap) TuneMemory

func (hm *HybridMap) TuneMemory()

type MapType

type MapType int
const (
	Memory MapType = iota
	Disk
	Hybrid
)

type Options

type Options struct {
	MemoryExpirationTime time.Duration
	DiskExpirationTime   time.Duration
	JanitorTime          time.Duration
	Type                 MapType
	DBType               DBType
	MemoryGuardForceDisk bool
	MemoryGuard          bool
	MaxMemorySize        int
	MemoryGuardTime      time.Duration
	Path                 string
	Cleanup              bool
	Name                 string
	// Remove temporary hmap in the temporary folder older than duration
	RemoveOlderThan time.Duration
}

Jump to

Keyboard shortcuts

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