pool

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutChunkMetaBuffer added in v1.2.0

func PutChunkMetaBuffer(b *Buffer)

Types

type Buffer added in v1.2.0

type Buffer struct {
	B    []byte
	Swap []byte
}

func GetChunkMetaBuffer added in v1.2.0

func GetChunkMetaBuffer() *Buffer

func (*Buffer) Instance added in v1.2.0

func (b *Buffer) Instance() Object

func (*Buffer) MemSize added in v1.2.0

func (b *Buffer) MemSize() int

type FixedPool added in v1.1.0

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

func (*FixedPool) Get added in v1.1.0

func (p *FixedPool) Get() interface{}

func (*FixedPool) Put added in v1.1.0

func (p *FixedPool) Put(v interface{})

func (*FixedPool) Reset added in v1.1.0

func (p *FixedPool) Reset(size int, new func() interface{}, hook *HitRatioHook)

type HitRatioHook added in v1.1.0

type HitRatioHook struct {
	IncrTotal func(int64)
	IncrHit   func(int64)
}

func NewHitRatioHook added in v1.1.0

func NewHitRatioHook(total, hit func(int64)) *HitRatioHook

type ListPool added in v1.0.0

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

func NewListPool added in v1.0.0

func NewListPool() *ListPool

func (*ListPool) Get added in v1.0.0

func (u *ListPool) Get() *list.List

func (*ListPool) HitRatio added in v1.0.0

func (u *ListPool) HitRatio() float64

func (*ListPool) Put added in v1.0.0

func (u *ListPool) Put(v *list.List)

type Object added in v1.2.0

type Object interface {
	Instance() Object
	MemSize() int
}

type ObjectPool added in v1.2.0

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

func NewObjectPool added in v1.2.0

func NewObjectPool(size int, obj Object, maxLocalCacheSize int) *ObjectPool

func (*ObjectPool) Get added in v1.2.0

func (p *ObjectPool) Get() Object

func (*ObjectPool) Put added in v1.2.0

func (p *ObjectPool) Put(v Object)

func (*ObjectPool) SetHitRatioHook added in v1.2.0

func (p *ObjectPool) SetHitRatioHook(hook *HitRatioHook)

type Uint32Array

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

func NewUint32Array

func NewUint32Array() *Uint32Array

func (*Uint32Array) Get

func (u *Uint32Array) Get(size int) []uint32

func (*Uint32Array) HitRatio

func (u *Uint32Array) HitRatio() float64

func (*Uint32Array) Put

func (u *Uint32Array) Put(v *[]uint32)

Jump to

Keyboard shortcuts

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