MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / LSize

Method LSize

tx_list.go:246–269  ·  view source on GitHub ↗

LSize returns the size of key in the bucket in the bucket at given bucket and key.

(bucket string, key []byte)

Source from the content-addressed store, hash-verified

244
245// LSize returns the size of key in the bucket in the bucket at given bucket and key.
246func (tx *Tx) LSize(bucket string, key []byte) (int, error) {
247 if err := tx.checkTxIsClosed(); err != nil {
248 return 0, err
249 }
250
251 b, err := tx.db.bucketMgr.GetBucket(DataStructureList, bucket)
252 if err != nil {
253 return 0, err
254 }
255
256 var (
257 bucketId = b.Id
258 l *data.List
259 exist bool
260 )
261
262 if l, exist = tx.db.Index.List.exist(bucketId); !exist {
263 return 0, ErrBucket
264 }
265 if tx.CheckExpire(bucket, key) {
266 return 0, ErrListNotFound
267 }
268 return l.Size(string(key))
269}
270
271// LRange returns the specified elements of the list stored in the bucket at given bucket,key, start and end.
272// The offsets start and stop are zero-based indexes 0 being the first element of the list (the head of the list),

Callers 5

LRemMethod · 0.95
txLSizeFunction · 0.80
TestTx_LTrimFunction · 0.80
testLSizeFunction · 0.80

Calls 5

checkTxIsClosedMethod · 0.95
CheckExpireMethod · 0.95
GetBucketMethod · 0.80
existMethod · 0.80
SizeMethod · 0.65

Tested by 3

txLSizeFunction · 0.64
TestTx_LTrimFunction · 0.64