nvm

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BigHashMetaBlock uint8 = iota
	BigHashMetaBucketBlock
	BlockCacheMetaBlock
	BlockCacheMetaIndexBlock
	DataBlock
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BigHash

type BigHash struct {
	CacheSize uint64

	BucketSize     uint64
	GenerationTime uint64

	Clock *clock.Clock
	// contains filtered or unexported fields
}

func NewBigHash

func NewBigHash(cacheSize uint64, bucketSize uint64, bfSize uint32, allocator *alloc.Allocator) *BigHash

func (*BigHash) Delete

func (h *BigHash) Delete(key []byte) error

func (*BigHash) Insert

func (h *BigHash) Insert(key []byte, value []byte, cost int64, expire int64) error

func (*BigHash) Lookup

func (h *BigHash) Lookup(key []byte) (item *alloc.AllocItem, cost int64, expire int64, ok bool, err error)

type BlockCache

type BlockCache struct {
	Offset uint64

	Clock     *clock.Clock
	CacheSize uint64

	RegionSize uint32
	// contains filtered or unexported fields
}

func NewBlockCache

func NewBlockCache(cacheSize int, regionSize int, cleanRegionSize uint32, offset uint64, allocator *alloc.Allocator, errHandler func(err error)) *BlockCache

func (*BlockCache) Delete

func (c *BlockCache) Delete(key []byte)

func (*BlockCache) Insert

func (c *BlockCache) Insert(key []byte, value []byte, cost int64, expire int64) error

func (*BlockCache) Lookup

func (c *BlockCache) Lookup(key []byte) (item *alloc.AllocItem, cost int64, expire int64, ok bool, err error)

type BlockEntry

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

type BlockInfo

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

type BlockInfoP

type BlockInfoP struct {
	KeyHash  uint64
	Address  uint32
	SizeHint uint32
}

type Bucket

type Bucket struct {
	Bloomfilter *bf.Bloomfilter
	// contains filtered or unexported fields
}

type BucketEntry

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

type BucketHeader

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

type BucketP

type BucketP struct {
	Index       uint64
	Bloomfilter *bf.Bloomfilter
}

used in persisit data

type NvmStore

type NvmStore[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewNvmStore

func NewNvmStore[K comparable, V any](
	file string, blockSize int, cacheSize int, bucketSize int, regionSize int,
	cleanRegionSize int, sizePct uint8, bigHashMaxEntrySize int, bfSize int, errorHandler func(err error),
	keySerializer internal.Serializer[K],
	valueSerializer internal.Serializer[V],
) (*NvmStore[K, V], error)

func (*NvmStore[K, V]) Delete

func (n *NvmStore[K, V]) Delete(key K) error

func (*NvmStore[K, V]) Get

func (n *NvmStore[K, V]) Get(key K) (value V, cost int64, expire int64, ok bool, err error)

func (*NvmStore[K, V]) HandleAsyncError

func (n *NvmStore[K, V]) HandleAsyncError(err error)

func (*NvmStore[K, V]) Set

func (n *NvmStore[K, V]) Set(key K, value V, cost int64, expire int64) error

func (*NvmStore[K, V]) SetClock

func (n *NvmStore[K, V]) SetClock(clock *clock.Clock)

type Region

type Region struct {
	EndOffset uint64
	// contains filtered or unexported fields
}

type RegionManager

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

func NewRegionManager

func NewRegionManager(offset uint64, regionSize, regionCount, cleanRegionSize uint32, removeFunc func(data []byte, endOffset uint64) error, allocator *alloc.Allocator, errHandler func(err error)) *RegionManager

func (*RegionManager) Allocate

func (m *RegionManager) Allocate(size int) (uint32, uint64, *bytes.Buffer, func(), error)

func (*RegionManager) GetData

func (m *RegionManager) GetData(index *BlockInfo, rid uint64, offset uint64, size uint64) (*alloc.AllocItem, error)

Directories

Path Synopsis
This is library for the Go language to enable use of Direct IO under all supported OSes of Go.
This is library for the Go language to enable use of Direct IO under all supported OSes of Go.

Jump to

Keyboard shortcuts

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