Skip to content

Commit de3e41e

Browse files
authored
Merge pull request #12 from tidesdb/tdb-go-library-reference-2
update go reference with list column families and column family stats…
2 parents aa81999 + 7b7af5a commit de3e41e

File tree

1 file changed

+42
-0
lines changed
  • src/content/docs/reference

1 file changed

+42
-0
lines changed

src/content/docs/reference/go.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,48 @@ for _, pair := range pairs {
135135
}
136136
```
137137

138+
### Column Family Statistics
139+
You can retrieve detailed statistics about a column family using the `GetColumnFamilyStat` method.
140+
141+
```go
142+
stat, err := db.GetColumnFamilyStat("example_cf")
143+
if err != nil {
144+
...
145+
}
146+
147+
// Access various statistics about the column family
148+
fmt.Printf("Column Family: %s\n", stat.Name)
149+
fmt.Printf("Memtable Size: %d bytes\n", stat.MemtableSize)
150+
fmt.Printf("Memtable Entries: %d\n", stat.MemtableEntryCount)
151+
fmt.Printf("Number of SSTables: %d\n", stat.NumSSTables)
152+
fmt.Printf("Incremental Merging: %t\n", stat.IncrementalMerging)
153+
154+
// Access configuration details
155+
fmt.Printf("Flush Threshold: %d\n", stat.Config.FlushThreshold)
156+
fmt.Printf("Max Level: %d\n", stat.Config.MaxLevel)
157+
fmt.Printf("Probability: %f\n", stat.Config.Probability)
158+
fmt.Printf("Compressed: %t\n", stat.Config.Compressed)
159+
fmt.Printf("Bloom Filter: %t\n", stat.Config.BloomFilter)
160+
161+
// Access SSTable statistics
162+
for i, sstStat := range stat.SSTableStats {
163+
fmt.Printf("SSTable %d - Path: %s, Size: %d bytes, Blocks: %d\n",
164+
i, sstStat.Path, sstStat.Size, sstStat.NumBlocks)
165+
}
166+
```
167+
168+
### Listing Column Families
169+
You can retrieve a list of all column families.
170+
```go
171+
cfList, err := db.ListColumnFamilies()
172+
if err != nil {
173+
...
174+
}
175+
176+
fmt.Println("Available column families:", cfList)
177+
```
178+
179+
138180
### Compaction
139181
Compaction is done manually or in background incrementally.
140182

0 commit comments

Comments
 (0)