[#1523] writecache: Simplify logic
1. Remove in-memory cache. It doesn't persist objects and if we want more speed, `NoSync` option can be used for the bolt DB. 2. Put to the metabase in a synchronous fashion. This considerably simplifies overall logic and plays nicely with the metabase bolt DB batch settings. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
4176b2a1bc
commit
ddaed283e9
9 changed files with 140 additions and 328 deletions
|
@ -22,20 +22,6 @@ func (c *cache) Delete(addr oid.Address) error {
|
|||
|
||||
saddr := addr.EncodeToString()
|
||||
|
||||
// Check memory cache.
|
||||
c.mtx.Lock()
|
||||
for i := range c.mem {
|
||||
if saddr == c.mem[i].addr {
|
||||
c.curMemSize -= uint64(len(c.mem[i].data))
|
||||
copy(c.mem[i:], c.mem[i+1:])
|
||||
c.mem = c.mem[:len(c.mem)-1]
|
||||
c.mtx.Unlock()
|
||||
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("in-mem DELETE"))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
c.mtx.Unlock()
|
||||
|
||||
// Check disk cache.
|
||||
var has int
|
||||
_ = c.db.View(func(tx *bbolt.Tx) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue