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 yourVISUALorEDITOR(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 usinggranica 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
| Field | Description |
|---|---|
freeze-for | Minimum time before an object can be crunched after creation |
crunch-after | When to start crunching eligible objects |
tier | Lifecycle tiering configuration |
expire-after | Automatic expiration for objects |
cleaner | Whether to delete source data after crunching |
non-current-expire-after | Expiration for non-current object versions |
uncrunch-expire-after | How 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: 30ddelete-after— Expiry period for objects in the Recycle Bin (e.g.,30dfor 30 days). Objects are automatically and permanently deleted after this period.
See also
- How crunching works — Learn how Crunch optimizes your data
Use the Granica CLI
Every command and flag available in the Granica command-line interface.
Monitoring
Learn how to monitor your Granica Crunch deployment.