Skip to content

About

compact bolt db

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BoltCompact

compact bolt db to save storage usage

bolt client command "compact" to lib

Installing

go get github.com/TheScenery/boltcompact

How to use

import (
	"github.com/TheScenery/boltcompact"
)

func main() {
	boltcompact.Compact("src.db", "dst.db", nil)
}

A message from the author

If you are using the successor of bold db named bbolt. It's a more featureful version of Bolt, And has contains this feature in it's API. You will not need to use this lib. Just use like below:

import bolt "go.etcd.io/bbolt"

// Open source database.
src, err := bolt.Open("src.db", 0444, nil)
if err != nil {
	return err
}
defer src.Close()

// Open destination database.
dst, err := bolt.Open("dst.db", fi.Mode(), nil)
if err != nil {
	return err
}
defer dst.Close()

// Run compaction.
txMaxSize := 65536
if err := bolt.Compact(dst, src, txMaxSize); err != nil {
	return err
}

Good Luck!

About

compact bolt db

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

⌂ 换网址