tidb: github.com/pingcap/tidb/util/bitmap Index | Files

package bitmap

import "github.com/pingcap/tidb/util/bitmap"


Package Files


type ConcurrentBitmap Uses

type ConcurrentBitmap struct {
    // contains filtered or unexported fields

ConcurrentBitmap is a static-length bitmap which is thread-safe on setting. It is implemented using CAS, as atomic bitwise operation is not supported by golang yet. (See https://github.com/golang/go/issues/24244) CAS operation is narrowed down to uint32 instead of longer types like uint64, to reduce probability of racing.

func NewConcurrentBitmap Uses

func NewConcurrentBitmap(bitLen int) *ConcurrentBitmap

NewConcurrentBitmap initializes a ConcurrentBitmap which can store bitLen of bits.

func (*ConcurrentBitmap) BytesConsumed Uses

func (cb *ConcurrentBitmap) BytesConsumed() int64

BytesConsumed returns size of this bitmap in bytes.

func (*ConcurrentBitmap) Set Uses

func (cb *ConcurrentBitmap) Set(bitIndex int) (isSetter bool)

Set sets the bit on bitIndex to be 1 (bitIndex starts from 0). isSetter indicates whether the function call this time triggers the bit from 0 to 1. bitIndex bigger than bitLen initialized will be ignored.

func (*ConcurrentBitmap) UnsafeIsSet Uses

func (cb *ConcurrentBitmap) UnsafeIsSet(bitIndex int) (isSet bool)

UnsafeIsSet returns if a bit on bitIndex is set (bitIndex starts from 0). bitIndex bigger than bitLen initialized will return false. This method is not thread-safe as it does not use atomic load.

Package bitmap imports 2 packages (graph) and is imported by 3 packages. Updated 2019-11-14. Refresh now. Tools for package owners.