How policies work

Learn how to manage Granica using policies for automated data optimization.

Granica uses policies to control which buckets and objects are eligible for processing by Crunch. Policies define the rules that govern data processing behavior across your deployment. You manage policies using the Granica CLI.

Managing policies

Get, set, and delete bucket policies using the CLI:

granica policy <edit|get|set|delete>
  • granica policy edit — The preferred method. Opens the existing Crunch policies in your VISUAL or EDITOR (defaults to vi). Committing changes applies the policies; quitting without saving leaves existing policies in place.
  • granica policy get — Display the current Crunch policy.
  • granica policy set <file-path> — Set the policy from a YAML file.
  • granica policy delete — Remove the Crunch policy.

Policy YAML structure

A sample policy file looks like this:

universe: {}
standard:
  freeze-for: disable
  crunch-after: disable
  tier:
    - class: disable
      after: disable
  expire-after: disable
  object-include: disable
  object-exclude: disable
  cleaner: disable
  non-current-expire-after: disable
  uncrunch-expire-after: 1d
exclude: []
include: []

Bucket-level filters

  • include — List of bucket name patterns to include. When using granica crunch universe, only buckets matching these patterns are crunched.
  • exclude — List of bucket name patterns to exclude. Buckets matching these patterns are never crunched.

Object-level filters

  • object-include — Limit processing to specific objects (e.g., by prefix or pattern).
  • object-exclude — Exclude specific objects from processing.

You can use granica policy edit in combination with granica execute-policy to limit screening to specific objects via object-include and object-exclude filters.

Standard policy fields

FieldDescription
freeze-forMinimum time before an object can be crunched after creation
crunch-afterWhen to start crunching eligible objects
tierLifecycle tiering configuration
expire-afterAutomatic expiration for objects
cleanerWhether to delete source data after crunching
non-current-expire-afterExpiration for non-current object versions
uncrunch-expire-afterHow long to retain uncrunched data (default: 1d)

Recycle Bin

The Recycle Bin is a Crunch policy that persists deleted data for recovery. It is disabled by default. Enable it in your policy YAML:

standard:
  recycle-bin:
    delete-after: 30d
  • delete-after — Expiry period for objects in the Recycle Bin (e.g., 30d for 30 days). Objects are automatically and permanently deleted after this period.

See also

Was this page helpful?

On this page