Check performs several consistency checks on the database for this transaction. An error is returned if any inconsistency is found. It can be safely run concurrently on a writable transaction. However, this incurs a high cost for large databases and databases with a lot of subbuckets because of cac
(options ...CheckOption)
| 19 | // It also allows users to provide a customized `KVStringer` implementation, |
| 20 | // so that bolt can generate human-readable diagnostic messages. |
| 21 | func (tx *Tx) Check(options ...CheckOption) <-chan error { |
| 22 | chkConfig := checkConfig{ |
| 23 | kvStringer: HexKVStringer(), |
| 24 | } |
| 25 | for _, op := range options { |
| 26 | op(&chkConfig) |
| 27 | } |
| 28 | |
| 29 | ch := make(chan error) |
| 30 | go func() { |
| 31 | // Close the channel to signal completion. |
| 32 | defer close(ch) |
| 33 | tx.check(chkConfig, ch) |
| 34 | }() |
| 35 | return ch |
| 36 | } |
| 37 | |
| 38 | func (tx *Tx) check(cfg checkConfig, ch chan error) { |
| 39 | defer func() { |