()
| 480 | db: db, |
| 481 | snp: snapshot, |
| 482 | } |
| 483 | |
| 484 | return s, nil |
| 485 | } |
| 486 | |
| 487 | func (db *DB) Compact() error { |
| 488 | return db.localDB.CompactRange(util.Range{ |
| 489 | Start: nil, |
| 490 | Limit: nil, |
| 491 | }) |
| 492 | } |
| 493 | |
| 494 | func (db *DB) Metrics() (tit string, metrics []map[string]interface{}) { |
| 495 | tit = "hybriddb cache" |
| 496 | costAdd := db.cache.Metrics.CostAdded() |
| 497 | costEvicted := db.cache.Metrics.CostEvicted() |
| 498 | metrics = []map[string]interface{}{ |
| 499 | {"used_cost": costAdd - costEvicted}, // Current memory usage (bytes) |
| 500 | {"cost_added": costAdd}, // Total memory sum of data added in history, incrementing (bytes) |
| 501 | {"cost_evicted": costEvicted}, // Free total memory, incrementing (bytes) |
| 502 | {"hits": db.cache.Metrics.Hits()}, // hits |
| 503 | {"misses": db.cache.Metrics.Misses()}, // misses |
| 504 | {"ratio": fmt.Sprintf("%.2f", db.cache.Metrics.Ratio())}, // hits / (hists + misses) |
| 505 | {"keys_added": db.cache.Metrics.KeysAdded()}, // number of keys added |
| 506 | {"keys_evicted": db.cache.Metrics.KeysEvicted()}, // delete key times |
| 507 | {"keys_updated": db.cache.Metrics.KeysUpdated()}, // update key times |
| 508 | {"gets_kept": db.cache.Metrics.GetsKept()}, // get total number of times the command is executed |
| 509 | // GetsDropped is the number of Get counter increments that are dropped |
| 510 | // internally. |
no outgoing calls