| 195 | } |
| 196 | |
| 197 | func (ds *BoltDbStore) Get(key []byte) ([]byte, error) { |
| 198 | if len(key) == 0 { |
| 199 | return nil, _const.ErrKeyIsEmpty |
| 200 | } |
| 201 | tx, err := ds.conn.Begin(false) // Start a read-only transaction |
| 202 | if err != nil { |
| 203 | return nil, err |
| 204 | } |
| 205 | defer check(tx.Rollback) |
| 206 | bucket := tx.Bucket(bucketStable) |
| 207 | val := bucket.Get(key) |
| 208 | if val == nil { |
| 209 | return nil, _const.ErrKeyNotFound |
| 210 | } |
| 211 | return val, nil |
| 212 | } |
| 213 | |
| 214 | func (ds *BoltDbStore) SetUint64(key []byte, val uint64) error { |
| 215 | if len(key) == 0 { |