Skip to content

Migrate Oracle Cloud Object Storage AFS Adapter from Eclipse Store #35

@hadv

Description

@hadv

Overview

Migrate the Oracle Cloud Object Storage AFS adapter from Eclipse Store to NebulaStore .NET Core. This adapter enables NebulaStore to use Oracle Cloud Infrastructure (OCI) Object Storage as a backend storage system.

Source Repository

Eclipse Store Module: https://github.com/eclipse-store/store/tree/main/afs/oraclecloud/objectstorage

Module Structure

The Oracle Cloud Object Storage module consists of:

Core Components (Java)

  1. OracleCloudObjectStorageConnector.java - Main connector implementing BlobStoreConnector

    • Handles blob operations (read, write, delete)
    • Manages multipart uploads for large files (up to 50 GiB per blob)
    • Supports caching and non-caching modes
    • Uses Oracle's UploadManager for efficient transfers
  2. OracleCloudObjectStorageFileSystemCreator.java - Configuration-based factory

    • Parses configuration files (supports classpath, URL, file paths)
    • Creates authenticated OCI clients
    • Configures client settings (timeouts, async threads, etc.)
    • Supports region and endpoint configuration
  3. OracleCloudObjectStoragePathValidator.java - Path validation for OCI Object Storage

Dependencies

Java (Eclipse Store):

  • com.oracle.oci.sdk:oci-java-sdk-objectstorage (provided scope - user must supply)
  • org.eclipse.store:afs-blobstore
  • org.eclipse.serializer:configuration

Expected .NET Dependencies:

  • OCI.DotNetSDK.Objectstorage - Official Oracle Cloud Infrastructure .NET SDK
  • NebulaStore.Afs.Blobstore - Existing blobstore abstraction

Implementation Requirements

1. Create Project Structure

afs/oraclecloud/
├── objectstorage/
│   ├── NebulaStore.Afs.OracleCloud.ObjectStorage.csproj
│   ├── README.md
│   ├── src/
│   │   ├── OracleCloudObjectStorageConnector.cs
│   │   ├── OracleCloudObjectStorageConfiguration.cs
│   │   ├── OracleCloudObjectStoragePathValidator.cs
│   │   └── OracleCloudObjectStorageAfsIntegration.cs
│   └── test/
│       ├── NebulaStore.Afs.OracleCloud.ObjectStorage.Tests.csproj
│       ├── OracleCloudObjectStorageConnectorTests.cs
│       └── OracleCloudObjectStorageConfigurationTests.cs

2. Core Classes to Implement

OracleCloudObjectStorageConnector

  • Extend BlobStoreConnectorBase
  • Implement blob operations using OCI .NET SDK:
    • GetFileSize() - Get total size across all blobs
    • DirectoryExists() - Check if bucket/prefix exists
    • FileExists() - Check if object exists
    • ReadData() - Read blob data with range support
    • WriteData() - Write data with multipart upload support
    • DeleteFile() - Delete all blobs for a file
    • MoveFile() - Move/rename objects
    • CopyFile() - Copy objects
    • VisitChildren() - List objects with prefix
  • Support both caching and non-caching modes
  • Handle large files (split into multiple blobs, max 50 GiB per blob)
  • Use OCI's multipart upload for efficient transfers

OracleCloudObjectStorageConfiguration

  • Configuration builder pattern (similar to AwsS3Configuration)
  • Properties:
    • ConfigFilePath - Path to OCI config file
    • Profile - Profile name in config file
    • Region - OCI region
    • Namespace - OCI Object Storage namespace
    • Endpoint - Custom endpoint URL
    • UseCache - Enable/disable caching
    • ConnectionTimeout - Connection timeout in milliseconds
    • ReadTimeout - Read timeout in milliseconds
    • MaxAsyncThreads - Maximum async threads
  • Support authentication via:
    • Config file (default ~/.oci/config)
    • Instance principal (for OCI compute instances)
    • Resource principal (for OCI functions)
    • API key authentication

OracleCloudObjectStoragePathValidator

  • Validate bucket names (OCI naming rules)
  • Validate object names/paths
  • Implement IPathValidator interface

OracleCloudObjectStorageAfsIntegration

  • Extension methods for EmbeddedStorageConfiguration
  • Factory methods for creating file systems
  • Integration with NebulaStore's AFS system

3. Key Features

  1. Multipart Upload Support

    • Split large files into multiple blobs (max 50 GiB each)
    • Use OCI's multipart upload API for efficiency
    • Support parallel uploads
  2. Namespace Management

    • Auto-detect namespace from OCI client
    • Support explicit namespace configuration
  3. Authentication Methods

    • Config file authentication (default)
    • Instance principal (for OCI VMs)
    • Resource principal (for OCI Functions)
    • API key authentication
  4. Caching

    • Optional blob metadata caching
    • Reduce API calls for repeated operations
  5. Configuration

    • Support OCI config file format
    • Support classpath, URL, and file path loading
    • Configurable timeouts and connection settings

4. Usage Examples

Basic Usage

using OCI.ObjectStorage;
using NebulaStore.Afs.OracleCloud.ObjectStorage;
using NebulaStore.Storage.Embedded;

// Create OCI Object Storage client
var config = OracleCloudObjectStorageConfiguration.New()
    .SetConfigFilePath("~/.oci/config")
    .SetProfile("DEFAULT")
    .SetRegion("us-ashburn-1")
    .SetUseCache(true);

var client = config.CreateClient();
var connector = OracleCloudObjectStorageConnector.New(client);
var fileSystem = BlobStoreFileSystem.New(connector);

// Use with EmbeddedStorage
var storageConfig = EmbeddedStorageConfiguration.New()
    .SetStorageDirectory("oci-storage")
    .SetUseAfs(true)
    .SetAfsStorageType("oraclecloud.objectstorage")
    .SetAfsConnectionString("~/.oci/config")
    .Build();

using var storage = EmbeddedStorage.Start(storageConfig);

With Instance Principal

var config = OracleCloudObjectStorageConfiguration.New()
    .SetAuthenticationType(OciAuthType.InstancePrincipal)
    .SetRegion("us-ashburn-1");

var connector = OracleCloudObjectStorageConnector.New(config.CreateClient());

5. Testing Requirements

  • Unit tests for connector operations
  • Unit tests for configuration parsing
  • Unit tests for path validation
  • Integration tests (optional, requires OCI account)
  • Mock-based tests using test doubles for OCI client

6. Documentation

  • README.md with:
    • Overview and features
    • Installation instructions
    • Configuration guide
    • Usage examples
    • Authentication methods
    • Troubleshooting
  • XML documentation comments on all public APIs
  • Example code in examples/ directory

Implementation Notes

License Considerations

The Oracle OCI .NET SDK is licensed under the Universal Permissive License (UPL) v1.0 or Apache License 2.0, which should be compatible with EPL 2.0. However, similar to the Java implementation, the SDK should be marked as a user-provided dependency (not bundled).

Differences from Eclipse Store

  1. .NET SDK vs Java SDK - Use OCI.DotNetSDK.Objectstorage instead of oci-java-sdk-objectstorage
  2. Async/Await - Leverage .NET async patterns for I/O operations
  3. Configuration - Use .NET configuration patterns (builder pattern, options pattern)
  4. Streams - Use .NET Stream API instead of Java InputStream

Reference Implementations

Refer to existing NebulaStore AFS adapters for patterns:

  • afs/aws/s3/ - AWS S3 connector (similar cloud object storage)
  • afs/azure/storage/ - Azure Blob Storage connector
  • afs/googlecloud/firestore/ - Google Cloud Firestore connector

Acceptance Criteria

  • Project structure created following NebulaStore conventions
  • OracleCloudObjectStorageConnector implements all IBlobStoreConnector methods
  • OracleCloudObjectStorageConfiguration supports all authentication methods
  • Path validator implements OCI naming rules
  • Integration with EmbeddedStorageConfiguration via AFS system
  • Unit tests with >80% code coverage
  • README.md with comprehensive documentation
  • Example code demonstrating usage
  • All public APIs have XML documentation
  • Follows existing NebulaStore code style and patterns

Related Issues

None

References

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions