MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / GetBits

Method GetBits

structure/bitmap.go:132–147  ·  view source on GitHub ↗

GetBits function retrieves the bits for the provided key

(k string)

Source from the content-addressed store, hash-verified

130
131// GetBits function retrieves the bits for the provided key
132func (b *BitmapStructure) GetBits(k string) (*BitSet, error) {
133 // Convert the key to bytes
134 key := stringToBytesWithKey(k)
135 // Get the bits from the database
136 value, err := b.db.Get(key)
137 if err != nil {
138 return nil, err
139 }
140 // Create a new bitset from the retrieved bits
141 bit, err := newBitSet(value)
142 if err != nil {
143 return nil, err
144 }
145 // Return the bitset
146 return bit, nil
147}
148
149// GetBit function retrieves a bit at the specified offset in the bitmap for the provided key
150func (b *BitmapStructure) GetBit(k string, off uint) (bool, error) {

Calls 3

stringToBytesWithKeyFunction · 0.85
newBitSetFunction · 0.85
GetMethod · 0.65