21126: Add AllowTrashWhenReadOnly flag.
[arvados.git] / services / keepstore / keepstore.go
index b9dbe2777e5d3ccca440b1c7632e6a344b83fa35..953aa047cbfa6ab6f7b55630aa30e83732adaf0e 100644 (file)
@@ -17,8 +17,6 @@ const MinFreeKilobytes = BlockSize / 1024
 
 var bufs *bufferPool
 
-// KeepError types.
-//
 type KeepError struct {
        HTTPCode int
        ErrMsg   string
@@ -51,7 +49,9 @@ func (e *KeepError) Error() string {
 func emptyTrash(mounts []*VolumeMount, interval time.Duration) {
        for range time.NewTicker(interval).C {
                for _, v := range mounts {
-                       v.EmptyTrash()
+                       if v.KeepMount.AllowTrash {
+                               v.EmptyTrash()
+                       }
                }
        }
 }