Skip to content

Commit

Permalink
Implement Google Cloud Storage Store
Browse files Browse the repository at this point in the history
Signed-off-by: David Anyatonwu <[email protected]>
  • Loading branch information
onyedikachi-david committed Dec 17, 2024
1 parent f672af7 commit bdb9ce8
Show file tree
Hide file tree
Showing 5 changed files with 2,897 additions and 0 deletions.
13 changes: 13 additions & 0 deletions deployment-examples/gcs-store-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
stores:
gcs_store:
type: "gcs_store"
bucket: "my-bucket"
key_prefix: "my-prefix/"
consider_expired_after_s: 3600
retry:
max_retries: 3
initial_delay_millis: 100
max_delay_millis: 1000
jitter: 0.1
multipart_max_concurrent_uploads: 10
max_retry_buffer_per_request: 5242880 # 5MB
47 changes: 47 additions & 0 deletions nativelink-config/src/stores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,26 @@ pub enum StoreSpec {
/// ```
///
noop(NoopSpec),

/// GCS store will use Google Cloud Storage (GCS) as a backend to store
/// the files. This configuration can be used to share files
/// across multiple instances.
///
/// **Example JSON Config:**
/// ```json
/// "gcs_store": {
/// "bucket": "crossplane-bucket-af79aeca9",
/// "key_prefix": "test-prefix-index/",
/// "retry": {
/// "max_retries": 6,
/// "delay": 0.3,
/// "jitter": 0.5
/// },
/// "multipart_max_concurrent_uploads": 10
/// }
/// ```
///
gcs_store(GcsSpec),
}

/// Configuration for an individual shard of the store.
Expand Down Expand Up @@ -1063,3 +1083,30 @@ pub struct Retry {
#[serde(default)]
pub retry_on_errors: Option<Vec<ErrorCode>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct GcsSpec {
/// The name of the GCS bucket.
pub bucket: String,

/// Optional prefix to prepend to all keys in the bucket.
pub key_prefix: Option<String>,

/// If set, objects older than this many seconds will be considered expired
/// and will be treated as if they don't exist.
#[serde(default)]
pub consider_expired_after_s: u32,

/// Configuration for retrying failed operations.
#[serde(default)]
pub retry: Retry,

/// Maximum number of bytes to buffer for retrying requests.
/// Defaults to 5MB if not specified.
pub max_retry_buffer_per_request: Option<usize>,

/// Maximum number of concurrent uploads for multipart operations.
/// Defaults to 10 if not specified.
pub multipart_max_concurrent_uploads: Option<usize>,
}
Loading

0 comments on commit bdb9ce8

Please sign in to comment.