(key []byte, val []byte)
| 178 | } |
| 179 | |
| 180 | func (ds *BoltDbStore) Set(key []byte, val []byte) error { |
| 181 | if len(key) == 0 { |
| 182 | return _const.ErrKeyIsEmpty |
| 183 | } |
| 184 | tx, err := ds.conn.Begin(true) // Start a read-write transaction |
| 185 | if err != nil { |
| 186 | return err |
| 187 | } |
| 188 | defer check(tx.Rollback) |
| 189 | bucket := tx.Bucket(bucketStable) |
| 190 | err = bucket.Put(key, val) |
| 191 | if err != nil { |
| 192 | return err |
| 193 | } |
| 194 | return tx.Commit() |
| 195 | } |
| 196 | |
| 197 | func (ds *BoltDbStore) Get(key []byte) ([]byte, error) { |
| 198 | if len(key) == 0 { |