Package land.oras

Class Registry.Builder

java.lang.Object
land.oras.Registry.Builder
Enclosing class:
Registry

public static class Registry.Builder extends Object
Builder for the registry
  • Method Details

    • defaults

      public Registry.Builder defaults()
      Return a new builder with default authentication using existing host auth
      Returns:
      The builder
    • defaults

      public Registry.Builder defaults(String registry)
      Return a new builder with default authentication using existing host auth and registry url
      Parameters:
      registry - The registry URL (ex: localhost:5000)
      Returns:
      The builder
    • from

      public Registry.Builder from(Registry registry)
      Return a new builder with the same configuration as the given registry
      Parameters:
      registry - The registry to copy the configuration from
      Returns:
      The builder
    • defaults

      public Registry.Builder defaults(String username, String password)
      Set username and password authentication
      Parameters:
      username - The username
      password - The password
      Returns:
      The builder
    • defaults

      public Registry.Builder defaults(String registry, String username, String password)
      Set username and password authentication
      Parameters:
      registry - The registry URL (ex: localhost:5000)
      username - The username
      password - The password
      Returns:
      The builder
    • insecure

      public Registry.Builder insecure()
      Set insecure communication and no authentification
      Returns:
      The builder
    • insecure

      public Registry.Builder insecure(String registry)
      Set insecure communication and no authentification
      Parameters:
      registry - The registry (ex: localhost:5000)
      Returns:
      The builder
    • insecure

      public Registry.Builder insecure(String registry, String username, String password)
      Return a new insecure builder with username and password authentication
      Parameters:
      registry - The registry (ex: localhost:5000)
      username - The username
      password - The password
      Returns:
      The builder
    • withRegistry

      public Registry.Builder withRegistry(String registry)
      Set the registry URL
      Parameters:
      registry - The registry URL
      Returns:
      The builder
    • withAuthProvider

      public Registry.Builder withAuthProvider(AuthProvider authProvider)
      Set the auth provider
      Parameters:
      authProvider - The auth provider
      Returns:
      The builder
    • withAuthToken

      public Registry.Builder withAuthToken(String authToken)
      Use given auth token for the registry. Useful when the auth token is obtained by other mean (like a token exchange). Caller are responsible to handle token expiration if any
      Parameters:
      authToken - The auth token
      Returns:
      The builder
    • withParallelism

      public Registry.Builder withParallelism(int parallelism)
      Set the maximum number of concurrent downloads when pulling an artifact with multiple layers. Default is 4.
      Parameters:
      parallelism - The maximum number of parallel uploads/download
      Returns:
      The builder
    • withExecutorService

      public Registry.Builder withExecutorService(ExecutorService executorService)
      Set the executor service to use for parallel uploads/downloads. By default it uses a parallelism level given by withParallelism() and a fixed thread pool. Only uses for layers upload/download, not for manifest or index upload/download.
      Parameters:
      executorService - The executor service
      Returns:
      The builder
    • withInsecure

      public Registry.Builder withInsecure(boolean insecure)
      Set the insecure flag
      Parameters:
      insecure - Insecure
      Returns:
      The builder
    • withSkipTlsVerify

      public Registry.Builder withSkipTlsVerify(boolean skipTlsVerify)
      Set the skip TLS verify flag
      Parameters:
      skipTlsVerify - Skip TLS verify
      Returns:
      The builder
    • withCaFile

      public Registry.Builder withCaFile(Path caFilePath)
      Set the CA file for TLS verification
      Parameters:
      caFilePath - The path to a PEM-encoded CA certificate or bundle
      Returns:
      The builder
    • withCaFile

      public Registry.Builder withCaFile(String caFilePath)
      Set the CA file for TLS verification
      Parameters:
      caFilePath - The path to a PEM-encoded CA certificate or bundle
      Returns:
      The builder
    • withCaContent

      public Registry.Builder withCaContent(String caContent)
      Set the CA certificates from PEM-encoded content
      Parameters:
      caContent - The PEM-encoded CA certificate or bundle content
      Returns:
      The builder
    • withMeterRegistry

      public Registry.Builder withMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Set the meter registry for metrics. Following Micrometer best practices for libraries, a SimpleMeterRegistry is used by default when no registry is provided.
      Parameters:
      meterRegistry - The meter registry
      Returns:
      The builder
    • withMaxRetries

      public Registry.Builder withMaxRetries(int maxRetries)
      Set the maximum number of attempts for retryable requests (default: 3). A value of 1 disables retries entirely. Retryable conditions: HTTP 429, HTTP 5xx, network errors (IOException / timeout). Token-refresh requests are never retried regardless of this setting.
      Parameters:
      maxRetries - Maximum attempts (must be >= 1)
      Returns:
      The builder
    • withRetryDelay

      public Registry.Builder withRetryDelay(long retryDelayMs)
      Set the initial delay before the first retry in milliseconds (default: 500). Subsequent delays are doubled up to the limit set by withMaxRetryDelay(long).
      Parameters:
      retryDelayMs - Initial delay in milliseconds (must be >= 0)
      Returns:
      The builder
    • withMaxRetryDelay

      public Registry.Builder withMaxRetryDelay(long maxRetryDelayMs)
      Set the upper bound on retry delay in milliseconds (default: 30 000).
      Parameters:
      maxRetryDelayMs - Maximum delay cap in milliseconds (must be >= 0)
      Returns:
      The builder
    • withTagListMaxPages

      public Registry.Builder withTagListMaxPages(int tagListMaxPages)
      Set the maximum number of pages fetched during a full tag listing (0 = unlimited, not recommanded).
      Parameters:
      tagListMaxPages - maximum number of pages (0 means unlimited)
      Returns:
      The builder
    • withReferrerListMaxPages

      public Registry.Builder withReferrerListMaxPages(int referrerListMaxPages)
      Set the maximum number of pages fetched during a full referrer listing (0 = unlimited).
      Parameters:
      referrerListMaxPages - maximum number of pages (0 means unlimited)
      Returns:
      The builder
    • withPolicy

      public Registry.Builder withPolicy(ContainersPolicy policy)
      Set the containers trust policy to enforce during pull operations.
      Parameters:
      policy - the containers policy to enforce.
      Returns:
      the builder
      See Also:
    • builder

      public static Registry.Builder builder()
      Return a new builder
      Returns:
      The builder
    • build

      public Registry build()
      Build the registry
      Returns:
      The registry