add Flush to diff cache
parent
b86ecff037
commit
1309a2f478
|
@ -42,6 +42,17 @@ func (c *DiffCache) Close() {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *DiffCache) Flush() {
|
||||
if c.Coords != nil {
|
||||
c.Coords.Flush()
|
||||
c.Coords = nil
|
||||
}
|
||||
if c.Ways != nil {
|
||||
c.Ways.Flush()
|
||||
c.Ways = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DiffCache) Open() error {
|
||||
var err error
|
||||
c.Coords, err = newCoordsRefIndex(filepath.Join(c.Dir, "coords_index"))
|
||||
|
@ -213,6 +224,14 @@ func (index *bunchRefCache) getBunchId(id int64) int64 {
|
|||
return id / 64
|
||||
}
|
||||
|
||||
func (index *bunchRefCache) Flush() {
|
||||
if index.linearImport {
|
||||
// disable linear import flushes buffer
|
||||
index.SetLinearImport(false)
|
||||
index.SetLinearImport(true)
|
||||
}
|
||||
}
|
||||
|
||||
func (index *bunchRefCache) Close() {
|
||||
if index.linearImport {
|
||||
// disable linear import first to flush buffer
|
||||
|
|
Loading…
Reference in New Issue