BitMapCache

package
v0.0.0-...-7f82f8f Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpBits = [8]uint8{1, 2, 4, 8, 16, 32, 64, 128}

Functions

This section is empty.

Types

type Bit16Cache

type Bit16Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

---------------------------16-------------------------------------

func NewBit16Cache

func NewBit16Cache(capa int) *Bit16Cache

func (*Bit16Cache) GetIndex

func (this *Bit16Cache) GetIndex(index int) uint64

func (*Bit16Cache) ReadFrom

func (this *Bit16Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit16Cache) ResetIndex

func (this *Bit16Cache) ResetIndex(index int, value uint64)

func (*Bit16Cache) SetLastBit

func (this *Bit16Cache) SetLastBit(index int) bool

func (*Bit16Cache) ShiftOneBit

func (this *Bit16Cache) ShiftOneBit()

func (*Bit16Cache) WriteTo

func (this *Bit16Cache) WriteTo(w io.Writer) (int, error)

type Bit1Cache

type Bit1Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

-----------------1------------------------------

func NewBit1Cache

func NewBit1Cache(capa int) *Bit1Cache

func (*Bit1Cache) GetIndex

func (this *Bit1Cache) GetIndex(index int) uint64

func (*Bit1Cache) ReadFrom

func (this *Bit1Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit1Cache) ResetIndex

func (this *Bit1Cache) ResetIndex(index int, value uint64)

func (*Bit1Cache) SetLastBit

func (this *Bit1Cache) SetLastBit(index int) bool

func (*Bit1Cache) ShiftOneBit

func (this *Bit1Cache) ShiftOneBit()

func (*Bit1Cache) WriteTo

func (this *Bit1Cache) WriteTo(w io.Writer) (int, error)

type Bit2Cache

type Bit2Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

-----------------2------------------------------

func NewBit2Cache

func NewBit2Cache(capa int) *Bit2Cache

func (*Bit2Cache) GetIndex

func (this *Bit2Cache) GetIndex(index int) uint64

func (*Bit2Cache) ReadFrom

func (this *Bit2Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit2Cache) ResetIndex

func (this *Bit2Cache) ResetIndex(index int, value uint64)

func (*Bit2Cache) SetLastBit

func (this *Bit2Cache) SetLastBit(index int) bool

func (*Bit2Cache) ShiftOneBit

func (this *Bit2Cache) ShiftOneBit()

func (*Bit2Cache) WriteTo

func (this *Bit2Cache) WriteTo(w io.Writer) (int, error)

type Bit32Cache

type Bit32Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

-----------------------------32------------------------

func NewBit32Cache

func NewBit32Cache(capa int) *Bit32Cache

func (*Bit32Cache) GetIndex

func (this *Bit32Cache) GetIndex(index int) uint64

func (*Bit32Cache) ReadFrom

func (this *Bit32Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit32Cache) ResetIndex

func (this *Bit32Cache) ResetIndex(index int, value uint64)

func (*Bit32Cache) SetLastBit

func (this *Bit32Cache) SetLastBit(index int) bool

func (*Bit32Cache) ShiftOneBit

func (this *Bit32Cache) ShiftOneBit()

func (*Bit32Cache) WriteTo

func (this *Bit32Cache) WriteTo(w io.Writer) (int, error)

type Bit4Cache

type Bit4Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

---------------------------4--------------------------------

func NewBit4Cache

func NewBit4Cache(capa int) *Bit4Cache

func (*Bit4Cache) GetIndex

func (this *Bit4Cache) GetIndex(index int) uint64

func (*Bit4Cache) ReadFrom

func (this *Bit4Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit4Cache) ResetIndex

func (this *Bit4Cache) ResetIndex(index int, value uint64)

func (*Bit4Cache) SetLastBit

func (this *Bit4Cache) SetLastBit(index int) bool

func (*Bit4Cache) ShiftOneBit

func (this *Bit4Cache) ShiftOneBit()

func (*Bit4Cache) WriteTo

func (this *Bit4Cache) WriteTo(w io.Writer) (int, error)

type Bit64Cache

type Bit64Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

---------------------------64----------------------------

func NewBit64Cache

func NewBit64Cache(capa int) *Bit64Cache

func (*Bit64Cache) GetIndex

func (this *Bit64Cache) GetIndex(index int) uint64

func (*Bit64Cache) ReadFrom

func (this *Bit64Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit64Cache) ResetIndex

func (this *Bit64Cache) ResetIndex(index int, value uint64)

func (*Bit64Cache) SetLastBit

func (this *Bit64Cache) SetLastBit(index int) bool

func (*Bit64Cache) ShiftOneBit

func (this *Bit64Cache) ShiftOneBit()

func (*Bit64Cache) WriteTo

func (this *Bit64Cache) WriteTo(w io.Writer) (int, error)

type Bit8Cache

type Bit8Cache struct {
	CacheCommon
	// contains filtered or unexported fields
}

---------------------------8--------------------------------

func NewBit8Cache

func NewBit8Cache(capa int) *Bit8Cache

func (*Bit8Cache) GetIndex

func (this *Bit8Cache) GetIndex(index int) uint64

func (*Bit8Cache) ReadFrom

func (this *Bit8Cache) ReadFrom(r io.Reader) (int, error)

func (*Bit8Cache) ResetIndex

func (this *Bit8Cache) ResetIndex(index int, value uint64)

func (*Bit8Cache) SetLastBit

func (this *Bit8Cache) SetLastBit(index int) bool

func (*Bit8Cache) ShiftOneBit

func (this *Bit8Cache) ShiftOneBit()

func (*Bit8Cache) WriteTo

func (this *Bit8Cache) WriteTo(w io.Writer) (int, error)

type Cache

type Cache interface {
	//how many bits of the id's flag, eg: 1,2,4,8,16,32,64
	Bits() int

	// buffer capacity
	Capacity() int

	//how much value != 0
	Count() int

	//get the max index
	MaxIndex() int

	// all id's flags <<1
	ShiftOneBit()

	//set last bit, if is the first time return true
	SetLastBit(index int) bool

	//get index value
	GetIndex(index int) uint64

	//set index value
	SetIndex(index int, value uint64)

	ReadFrom(r io.Reader) (int, error)
	WriterTo(w io.Writer) (int, error)
}

type CacheCommon

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

func (*CacheCommon) Bits

func (this *CacheCommon) Bits() int

func (*CacheCommon) Capacity

func (this *CacheCommon) Capacity() int

func (*CacheCommon) Count

func (this *CacheCommon) Count() int

func (*CacheCommon) MaxIndex

func (this *CacheCommon) MaxIndex() int

Jump to

Keyboard shortcuts

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