View Source Lightning.Storage.GCS (Lightning v2.10.4)
A storage backend module for handling file storage in Google Cloud Storage (GCS).
It implements the Lightning.Storage.Backend
behaviour to manage file storage operations in Google Cloud Storage. This includes storing files to GCS buckets and generating signed URLs for secure access to the stored files.
Responsibilities
- Storing Files: The
store/2
function uploads files from a local source path to a specified destination path within a GCS bucket. - Generating Signed URLs: The
get_url/1
function generates a signed URL for accessing a file stored in GCS. This signed URL is valid for a limited time (default 1 hour). - Configuration: The module relies on application configuration to determine the GCS bucket and Google API connection settings.
Example Usage
# Store a file in GCS
Lightning.Storage.GCS.store("/path/to/source", "destination/path")
# Get a signed URL for the stored file
{:ok, url} = Lightning.Storage.GCS.get_url("destination/path")