byte_pool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytePool

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

func NewBytePool

func NewBytePool(elemNum int, maxElemSize int) *BytePool

NewBytePool creates a new BytePool

PARAMS:

  • elemNum: int, the max element num of BytePool
  • maxElemSize: int, the max length of each element

RETURNS:

  • a pointer point to the BytePool

func (*BytePool) Get

func (pool *BytePool) Get(index int32) []byte

Get the byte slice

PARAMS:

  • index: int, index of the BytePool

RETURNS:

  • key: []byte type store in the BytePool

func (*BytePool) MaxElemSize

func (pool *BytePool) MaxElemSize() int

MaxElemSize returns the space allocate for each element

func (*BytePool) Set

func (pool *BytePool) Set(index int32, key []byte) error

Set sets the index node of BytePool with key

PARAMS:

  • index: index of the byte Pool
  • key: []byte key

type FixedBytePool

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

func NewFixedBytePool

func NewFixedBytePool(elemNum int, elemSize int) *FixedBytePool

NewFixedBytePool creates a new FixedBytePool

PARAMS:

  • elemNum: int, the max element num of FixedBytePool
  • elemSize: int, the max length of each element

RETURNS:

  • a pointer point to the FixedBytePool

func (*FixedBytePool) Get

func (pool *FixedBytePool) Get(index int32) []byte

Get the byte slice of giving index and length

PARAMS:

  • index: int, index of the FixedBytePool

RETURNS:

  • key: []byte type store in the FixedBytePool

func (*FixedBytePool) MaxElemSize

func (pool *FixedBytePool) MaxElemSize() int

MaxElemSize return the space allocate for each element

func (*FixedBytePool) Set

func (pool *FixedBytePool) Set(index int32, key []byte) error

Set sets the index node of FixedBytePool with key

PARAMS:

  • index: index of the byte Pool
  • key: []byte key

type IBytePool

type IBytePool interface {
	Set(int32, []byte) error
	Get(int32) []byte

	MaxElemSize() int
}

Jump to

Keyboard shortcuts

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