-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathinfos.go
More file actions
32 lines (27 loc) · 749 Bytes
/
infos.go
File metadata and controls
32 lines (27 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// billy: Simple datastorage
// Copyright 2023 billy authors
// SPDX-License-Identifier: BSD-3-Clause
package billy
// Infos contains a set of statistics about the underlying datastore.
type Infos struct {
Shelves []*ShelfInfos
}
// ShelfInfos contains some statistics about the data stored in a single shelf.
type ShelfInfos struct {
SlotSize uint32
FilledSlots uint64
GappedSlots uint64
}
// Infos gathers and returns some stats about the database.
func (db *database) Infos() *Infos {
infos := new(Infos)
for _, shelf := range db.shelves {
slots, gaps := shelf.stats()
infos.Shelves = append(infos.Shelves, &ShelfInfos{
SlotSize: shelf.slotSize,
FilledSlots: slots - gaps,
GappedSlots: gaps,
})
}
return infos
}