MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / Get

Method Get

kayak/wal/leveldb_wal.go:160–178  ·  view source on GitHub ↗

Get implements Wal.Get.

(i uint64)

Source from the content-addressed store, hash-verified

158
159// Get implements Wal.Get.
160func (p *LevelDBWal) Get(i uint64) (l *kt.Log, err error) {
161 if atomic.LoadUint32(&p.closed) == 1 {
162 err = ErrWalClosed
163 return
164 }
165
166 headerKey := append(append([]byte(nil), logHeaderKeyPrefix...), p.uint64ToBytes(i)...)
167
168 var headerData []byte
169 if headerData, err = p.db.Get(headerKey, nil); err == leveldb.ErrNotFound {
170 err = ErrNotExists
171 return
172 } else if err != nil {
173 err = errors.Wrap(err, "get log header failed")
174 return
175 }
176
177 return p.load(headerData)
178}
179
180// Close implements Wal.Close.
181func (p *LevelDBWal) Close() {

Callers 2

TestLevelDBWal_WriteFunction · 0.95
BenchmarkSignSignatureFunction · 0.95

Calls 3

uint64ToBytesMethod · 0.95
loadMethod · 0.95
GetMethod · 0.65

Tested by 2

TestLevelDBWal_WriteFunction · 0.76
BenchmarkSignSignatureFunction · 0.76