@@ -10,7 +10,7 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
1010 bucket: String . t ( ) ,
1111 key: String . t ( ) ,
1212 region: String . t ( ) ,
13- failover_buckets: [ { String . t ( ) , String . t ( ) } ] | nil
13+ failover_buckets: [ [ bucket: String . t ( ) , region: String . t ( ) ] ] | nil
1414 }
1515 defstruct [ :bucket , :key , :region , :failover_buckets ]
1616
@@ -31,10 +31,11 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
3131 doc: "The AWS region of the s3 bucket."
3232 ] ,
3333 failover_buckets: [
34- type: { :list , { :tuple , [ :string , :string ] } } ,
34+ type: { :list , :keyword_list } ,
3535 required: false ,
3636 doc:
37- "A list of tuples containing {bucket_name, region} to use as failover if the primary bucket fails."
37+ "A list of keyword lists containing [bucket: bucket_name, region: region] to use as failover if the primary bucket fails. \n
38+ The directory structure in failover buckets must match the primary bucket."
3839 ]
3940 ]
4041
@@ -176,7 +177,12 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
176177
177178 defp try_failover_buckets ( _op , [ ] , _opts , _state ) , do: { :error , "All buckets failed" }
178179
179- defp try_failover_buckets ( op , [ { bucket , region } | remaining_buckets ] , opts , state ) do
180+ defp try_failover_buckets (
181+ op ,
182+ [ [ bucket: bucket , region: region ] | remaining_buckets ] ,
183+ opts ,
184+ state
185+ ) do
180186 Logger . info ( % {
181187 bucket: bucket ,
182188 key: state . key ,
@@ -202,8 +208,7 @@ defmodule RemotePersistentTerm.Fetcher.S3 do
202208 end
203209
204210 defp perform_request ( op , bucket , region , opts ) do
205- op
206- |> apply ( [ bucket , opts ] )
211+ op . ( bucket , opts )
207212 |> client ( ) . request ( region: region )
208213 end
209214
0 commit comments