Social & Economy

aether-ugc

User-generated content pipeline and approval workflow

The aether-ugc crate handles the full lifecycle of user-generated content in Aether, from upload through scanning, approval, storage, and versioning. It integrates with the content moderation system for automated and human review.

Overview

User-generated content (UGC) is central to Aether's creator ecosystem. This crate manages:

  • Upload sessions with chunked transfer for large files.
  • Validation pipeline that checks file types, sizes, and structural integrity.
  • Moderation integration that routes content through automated scanning and human review.
  • Approval workflow with configurable policies (auto-approve, manual review, or hybrid).
  • Artifact storage with content-addressed deduplication.
  • Version history for tracking changes to published assets.

Key Types

UgcRuntime

The top-level runtime that processes UGC uploads and moderation signals each tick.

use aether_ugc::{UgcRuntime, UgcRuntimeConfig};

let config = UgcRuntimeConfig {
    max_upload_size_mb: 100,
    max_concurrent_uploads: 10,
    auto_approve_trusted: true,
};
let runtime = UgcRuntime::new(config);

UploadSession

Manages a chunked upload, tracking progress and assembling the final artifact.

use aether_ugc::{UploadSession, UploadConfig, ChunkUpload};

let session = UploadSession::new(UploadConfig {
    max_chunk_size: 1024 * 1024, // 1 MB
    max_total_size: 100 * 1024 * 1024,
});
session.push_chunk(ChunkUpload { index: 0, data: bytes })?;

ValidationPipeline

Runs a sequence of validation stages on uploaded content.

use aether_ugc::{ValidationPipeline, PipelineStage, FileValidation, FileType};

let pipeline = ValidationPipeline::new(vec![
    PipelineStage::FileTypeCheck,
    PipelineStage::SizeCheck,
    PipelineStage::IntegrityCheck,
]);
let report = pipeline.validate(&artifact)?;

ApprovalWorkflow

Manages the approval state machine for submitted content.

use aether_ugc::{ApprovalWorkflow, ApprovalPolicy, ApprovalStatus};

let workflow = ApprovalWorkflow::new(ApprovalPolicy::ManualReview);
workflow.submit(artifact_id)?;
// After moderation review:
workflow.approve(artifact_id, reviewer_id)?;
assert_eq!(workflow.status(artifact_id), ApprovalStatus::Approved);

AssetStorage

Content-addressed storage backend with deduplication.

use aether_ugc::{AssetStorage, InMemoryStorage, StorageError};

let storage = InMemoryStorage::new();
let address = storage.store(&bytes)?;
let retrieved = storage.load(&address)?;

VersionHistory

Tracks versions of a published asset, enabling rollback and change history.

use aether_ugc::{VersionHistory, AssetVersion};

let mut history = VersionHistory::new(asset_id);
history.publish(AssetVersion {
    version: 2,
    content_hash: new_hash,
    changelog: "Fixed texture alignment".into(),
})?;

SignedManifest

A cryptographically signed manifest listing all artifacts in a content package.

use aether_ugc::{ManifestBuilder, ManifestEntry, SignedManifest};

let mut builder = ManifestBuilder::new();
builder.add(ManifestEntry {
    path: "models/chair.glb".into(),
    hash: content_hash,
    size: 524288,
});
let manifest: SignedManifest = builder.sign(&signing_key)?;

Usage Examples

Full Upload Flow

use aether_ugc::{
    UploadRequest, ValidationPipeline, ApprovalWorkflow,
    ApprovalPolicy, AssetStorage, InMemoryStorage,
};

let storage = InMemoryStorage::new();
let pipeline = ValidationPipeline::default();
let workflow = ApprovalWorkflow::new(ApprovalPolicy::AutoApprove);

// Upload -> Validate -> Store -> Approve
let report = pipeline.validate(&uploaded_data)?;
let address = storage.store(&uploaded_data)?;
workflow.submit(address)?;