forked from TrueCloudLab/frostfs-node
[#569] writecache: Allow to seal writecache after flush
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
b118734909
commit
0cb0fc1735
12 changed files with 436 additions and 344 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
// FlushWriteCachePrm represents parameters of a `FlushWriteCache` operation.
|
||||
type FlushWriteCachePrm struct {
|
||||
ignoreErrors bool
|
||||
seal bool
|
||||
}
|
||||
|
||||
// SetIgnoreErrors sets the flag to ignore read-errors during flush.
|
||||
|
@ -19,6 +20,11 @@ func (p *FlushWriteCachePrm) SetIgnoreErrors(ignore bool) {
|
|||
p.ignoreErrors = ignore
|
||||
}
|
||||
|
||||
// SetSeal sets the flag to left writecache in read-only mode after flush.
|
||||
func (p *FlushWriteCachePrm) SetSeal(v bool) {
|
||||
p.seal = v
|
||||
}
|
||||
|
||||
// errWriteCacheDisabled is returned when an operation on write-cache is performed,
|
||||
// but write-cache is disabled.
|
||||
var errWriteCacheDisabled = errors.New("write-cache is disabled")
|
||||
|
@ -29,6 +35,7 @@ func (s *Shard) FlushWriteCache(ctx context.Context, p FlushWriteCachePrm) error
|
|||
trace.WithAttributes(
|
||||
attribute.String("shard_id", s.ID().String()),
|
||||
attribute.Bool("ignore_errors", p.ignoreErrors),
|
||||
attribute.Bool("seal", p.seal),
|
||||
))
|
||||
defer span.End()
|
||||
|
||||
|
@ -47,5 +54,5 @@ func (s *Shard) FlushWriteCache(ctx context.Context, p FlushWriteCachePrm) error
|
|||
return ErrDegradedMode
|
||||
}
|
||||
|
||||
return s.writeCache.Flush(ctx, p.ignoreErrors)
|
||||
return s.writeCache.Flush(ctx, p.ignoreErrors, p.seal)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue