API: Storage Server (HTTP + SignalR)

This document describes the integration surface exposed by Integraions/ManagedCode.Storage.Server.

Request Flow

flowchart LR
  Client --> Controller[StorageControllerBase / StorageController]
  Client --> Hub[StorageHubBase / StorageHub]
  Controller --> Storage[IStorage]
  Hub --> Storage
  Storage --> Provider[Concrete provider]

HTTP API

Default controller: Integraions/ManagedCode.Storage.Server/Controllers/StorageController.cs

Base route:

Upload (multipart)

Notes:

sequenceDiagram
  participant C as Client
  participant API as POST /api/storage/upload
  participant S as IStorage
  C->>API: multipart/form-data (IFormFile)
  API->>S: UploadAsync(stream, UploadOptions)
  S-->>API: Result<BlobMetadata>
  API-->>C: Result<BlobMetadata>

Upload (stream)

sequenceDiagram
  participant C as Client
  participant API as POST /api/storage/upload/stream
  participant S as IStorage
  C->>API: Request.Body + headers (X-File-Name, X-Content-Type, X-Directory)
  API->>S: UploadAsync(Request.Body, UploadOptions)
  S-->>API: Result<BlobMetadata>
  API-->>C: Result<BlobMetadata>

Download (file response)

Stream (inline)

Download as bytes

Chunked upload

Chunk payload model: Integraions/ManagedCode.Storage.Server/Models/FileUploadPayload.cs

sequenceDiagram
  participant C as Client
  participant API as Chunk endpoints
  participant Ch as ChunkUploadService
  participant S as IStorage
  loop For each chunk
    C->>API: POST /upload-chunks/upload (multipart)
    API->>Ch: AppendChunkAsync(...)
    Ch-->>API: Result
    API-->>C: Result
  end
  C->>API: POST /upload-chunks/complete (JSON)
  API->>Ch: CompleteAsync(...)
  Ch->>S: UploadAsync(mergedStream, UploadOptions) [CommitToStorage=true]
  S-->>Ch: Result<BlobMetadata>
  Ch-->>API: Result<ChunkUploadCompleteResponse>
  API-->>C: Result<ChunkUploadCompleteResponse>

SignalR Hub API

Default hub:

Key hub methods (base implementation in StorageHubBase<TStorage>):

Progress events emitted to the caller:

Event names are defined in Integraions/ManagedCode.Storage.Server/Hubs/StorageHubBase.cs (StorageHubEvents).

sequenceDiagram
  participant C as Client
  participant Hub as /hubs/storage
  participant S as IStorage
  C->>Hub: BeginUploadStreamAsync(descriptor)
  Hub-->>C: transferId
  C->>Hub: UploadStreamContentAsync(transferId, byteStream)
  Hub->>S: UploadAsync(tempFileStream, UploadOptions)
  S-->>Hub: Result<BlobMetadata>
  Hub-->>C: TransferStatus progress/completed events