Object returns the object associated with the key
(key []byte)
| 112 | |
| 113 | // Object returns the object associated with the key |
| 114 | func (txn *Transaction) Object(key []byte) (*Object, error) { |
| 115 | mkey := MetaKey(txn.db, key) |
| 116 | obj, err := getObject(txn, mkey) |
| 117 | if err != nil { |
| 118 | return nil, err |
| 119 | } |
| 120 | if IsExpired(obj, Now()) { |
| 121 | return nil, ErrKeyNotFound |
| 122 | } |
| 123 | return obj, nil |
| 124 | } |
| 125 | |
| 126 | // Destory the object |
| 127 | func (txn *Transaction) Destory(obj *Object, key []byte) error { |