github.com/scottcagno/storage@v1.8.0/pkg/lsmtree/info.go (about) 1 package lsmtree 2 3 import "github.com/scottcagno/storage/pkg/util" 4 5 type Info struct { 6 waclSize int64 7 memtCount int64 8 memtSize int64 9 sstmSSTCount int64 10 sstmIndexSize int64 11 } 12 13 func (lsm *LSMTree) GetInfo() *Info { 14 lsm.lock.Lock() 15 defer lsm.lock.Unlock() 16 17 return &Info{ 18 waclSize: lsm.wacl.size(), 19 memtCount: int64(lsm.memt.countOfEntries()), 20 memtSize: lsm.memt.size, 21 sstmSSTCount: int64(lsm.sstm.sstcount), 22 sstmIndexSize: int64(util.Sizeof(lsm.sstm.index)), 23 } 24 } 25 26 func SizeInKB(size int64) int64 { 27 return size / 1000 28 } 29 30 func SizeInMB(size int64) int64 { 31 return size / 1000 / 1000 32 } 33 34 func (info *Info) String() string { 35 return "" 36 }