1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 // BlockSize for a Keep "block" is 64MB.
12 const BlockSize = 64 * 1024 * 1024
14 // MinFreeKilobytes is the amount of space a Keep volume must have available
15 // in order to permit writes.
16 const MinFreeKilobytes = BlockSize / 1024
20 type KeepError struct {
26 BadRequestError = &KeepError{400, "Bad Request"}
27 UnauthorizedError = &KeepError{401, "Unauthorized"}
28 CollisionError = &KeepError{500, "Collision"}
29 RequestHashError = &KeepError{422, "Hash mismatch in request"}
30 PermissionError = &KeepError{403, "Forbidden"}
31 DiskHashError = &KeepError{500, "Hash mismatch in stored data"}
32 ExpiredError = &KeepError{401, "Expired permission signature"}
33 NotFoundError = &KeepError{404, "Not Found"}
34 VolumeBusyError = &KeepError{503, "Volume backend busy"}
35 GenericError = &KeepError{500, "Fail"}
36 FullError = &KeepError{503, "Full"}
37 SizeRequiredError = &KeepError{411, "Missing Content-Length"}
38 TooLongError = &KeepError{413, "Block is too large"}
39 MethodDisabledError = &KeepError{405, "Method disabled"}
40 ErrNotImplemented = &KeepError{500, "Unsupported configuration"}
41 ErrClientDisconnect = &KeepError{503, "Client disconnected"}
44 func (e *KeepError) Error() string {
48 // Periodically (once per interval) invoke EmptyTrash on all volumes.
49 func emptyTrash(mounts []*VolumeMount, interval time.Duration) {
50 for range time.NewTicker(interval).C {
51 for _, v := range mounts {
52 if v.KeepMount.AllowTrash {