# babuza-snapshot > Use for configuring and managing snapshots (File, S3, Memory). Triggers on: raft snapshot, babuza snapshot, snapshot s3, durable snapshot, snapshot manager - Author: Chen Chunchieh - Repository: fanaujie/babuza-skills - Version: 20260126153848 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/fanaujie/babuza-skills - Web: https://mule.run/skillshub/@@fanaujie/babuza-skills~babuza-snapshot:20260126153848 --- --- name: babuza-snapshot description: | Use for configuring and managing snapshots (File, S3, Memory). Triggers on: raft snapshot, babuza snapshot, snapshot s3, durable snapshot, snapshot manager --- # Babuza Snapshot Skill > **Package:** `github.com/fanaujie/babuza/pkg/snapshot` > > Snapshot management for state machine persistence and recovery in Babuza clusters. You are an expert at `babuza` snapshot management. Help users by: - **Writing code**: Configure Durable, Volatile, or S3 snapshot backends. - **Answering questions**: Explain chunked transfer, compression, and snapshot lifecycle. ## Documentation Refer to the local files for detailed API: - `./references/snapshot-api.md` - Snapshot interfaces and configuration structs. ## Key Patterns ### 1. Configuring Durable Snapshot (Filesystem) Standard configuration for production use. ```go import "github.com/fanaujie/babuza/pkg/builder" func buildDurableSnapshot() *ibabuza.BabuzaComponent { return builder.NewBabuzaComponentBuilder(&builder.BabuzaComponentConfig{ StorageRootDir: "/var/lib/babuza", SnapshotType: builder.DurableSnapshot, }).Build() } ``` ### 2. Configuring S3 Snapshot (Cloud) Use S3 or S3-compatible storage for snapshots. ```go import ( "github.com/fanaujie/babuza/pkg/builder" "github.com/fanaujie/babuza/pkg/snapshot/fs/cloudstorage" ) func buildS3Snapshot() *ibabuza.BabuzaComponent { return builder.NewBabuzaComponentBuilder(&builder.BabuzaComponentConfig{ StorageRootDir: "/var/lib/babuza", SnapshotType: builder.S3Snapshot, }).SetS3Config(&cloudstorage.S3Config{ Endpoint: "http://minio:9000", Region: "us-east-1", AccessKeyID: "minioadmin", SecretAccessKey: "minioadmin", Bucket: "snapshots", UsePathStyle: true, // Required for MinIO/S3-compatible }).Build() } ``` ## Snapshot Types | Backend | Builder Constant | Use Case | |---------|------------------|----------| | **Durable** | `builder.DurableSnapshot` | Production (Local Disk) | | **S3** | `builder.S3Snapshot` | Cloud (AWS S3, MinIO, GCS) | | **Volatile** | `builder.VolatileSnapshot` | Testing (In-Memory) | ## Features - **Chunked Transfer**: Large snapshots are streamed in chunks to avoid OOM. - **Compression**: Supports Snappy compression for state machine files. - **Rate Limiting**: Configurable transfer limits (see `babuza-transport`). ## When Answering Questions 1. **Recovery**: Explain that snapshots accelerate recovery by compacting the log. 2. **S3**: Mention that S3 support includes any S3-compatible provider (MinIO, DigitalOcean Spaces, etc.). 3. **Lifecycle**: Snapshots are typically triggered automatically based on `SnapshotCount` in config.