| 1 | package checkpoint |
| 2 | |
| 3 | // Option overrides a Store default at construction time. |
| 4 | type Option func(*Store) |
| 5 | |
| 6 | // WithRetainCheckpoints caps how many turns of file payloads the store retains. |
| 7 | // A value below 1 is ignored, leaving DefaultRetainCheckpoints in place. |
| 8 | func WithRetainCheckpoints(turns int) Option { |
| 9 | return func(s *Store) { |
| 10 | if turns > 0 { |
| 11 | s.retainN = turns |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | // WithBlobQuota sets the soft byte budget for retained file payloads. A value |
| 17 | // below 1 is ignored, leaving DefaultBlobQuotaBytes in place. |
| 18 | func WithBlobQuota(bytes int64) Option { |
| 19 | return func(s *Store) { |
| 20 | if bytes > 0 { |
| 21 | s.blobQuota = bytes |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 |