StorageProviderCapabilities (storage_runtime/capabilities.rs)

AFFiNE · packages/backend/native/src/runtime/storage_runtime/capabilities.rs · rust · MIT
files

Maps storage backend configs to capability flags, enabling feature checks for storage providers.

// Source: https://github.com/toeverything/AFFiNE | License: MIT | Copyright 2022-present TOEVERYTHING PTE. LTD. and its affiliates
// Provided via justclaw.it.com; keep this notice with the code.
use crate::runtime::object_storage::StorageBackendConfig;

#[napi_derive::napi(object)]
pub struct StorageProviderCapabilities {
  pub put: bool,
  pub get: bool,
  pub head: bool,
  pub list: bool,
  pub delete: bool,
  pub presign_put: bool,
  pub presign_get: bool,
  pub multipart_direct: bool,
  pub proxy_upload: bool,
  pub assetpack: bool,
  pub server_mediated_only: bool,
}

pub(super) fn storage_provider_capabilities(backend: &StorageBackendConfig) -> StorageProviderCapabilities {
  match backend {
    StorageBackendConfig::Fs(_) => StorageProviderCapabilities {
      put: true,
      get

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key