Search documentation of phoenix_kit

# PhoenixKit.Storage.Manager (phoenix_kit v1.6.19)

View Source

Storage manager for handling file operations with redundancy and failover.

This module coordinates file storage across multiple buckets with automatic redundancy, failover, and variant generation.

# Summary

## Functions

delete_file(file_path, opts \\ [])

Deletes a file from all storage buckets.

file_exists?(file_path, opts \\ [])

Checks if a file exists in any storage bucket.

public_url(file_path, opts \\ [])

Gets a public URL for a file from the highest priority bucket that has it.

retrieve_file(file_path, opts \\ [])

Retrieves a file from storage with failover.

store_file(source_path, opts \\ [])

Stores a file across multiple buckets based on redundancy settings.

# Functions

# delete_file(file_path, opts \\ [])

Deletes a file from all storage buckets.

# file_exists?(file_path, opts \\ [])

Checks if a file exists in any storage bucket.

# public_url(file_path, opts \\ [])

Gets a public URL for a file from the highest priority bucket that has it.

# retrieve_file(file_path, opts \\ [])

Retrieves a file from storage with failover.

Tries each bucket in priority order until the file is found.

# store_file(source_path, opts \\ [])

Stores a file across multiple buckets based on redundancy settings.

## Options

- `:redundancy_copies` - Number of copies to store (default: from settings)
- `:priority_buckets` - List of specific bucket IDs to use (default: auto-select)
- `:force_bucket_ids` - List of specific bucket IDs to use (overrides priority_buckets)
- `:generate_variants` - Whether to generate variants (default: from settings)

## Returns

- `{:ok, file_result}` - File stored successfully with locations
- `{:error, reason}` - Failed to store file