forked from TrueCloudLab/frostfs-node
[#1085] writecache: add read-only mode
In read-only mode modifying operations are immediately returned with error and all background operations are suspended. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
9f963e001b
commit
ad01aaf8bf
7 changed files with 139 additions and 28 deletions
|
@ -12,6 +12,12 @@ var ErrBigObject = errors.New("too big object")
|
|||
|
||||
// Put puts object to write-cache.
|
||||
func (c *cache) Put(o *object.Object) error {
|
||||
c.modeMtx.RLock()
|
||||
defer c.modeMtx.RUnlock()
|
||||
if c.mode == ModeReadOnly {
|
||||
return ErrReadOnly
|
||||
}
|
||||
|
||||
sz := uint64(o.ToV2().StableSize())
|
||||
if sz > c.maxObjectSize {
|
||||
return ErrBigObject
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue