refactor: workspace layout — crates/, app at root, legacy C++ removed

Single mechanical restructure commit:
- root Cargo.toml = oakapp bin + workspace; one cargo build produces
  oakapp, oak-cli, oak-worker, liboakengine.dylib
- app/rust/src -> src/ (app at repo root, no rust/ nesting)
- src/<mod>/rust -> crates/oak<mod>; src/oakcore-rs -> crates/oakcore;
  src/bindings/oakotio -> crates/oakotio; src/engine/rust ->
  crates/oakengine (keeps cdylib+staticlib+rlib)
- public C headers include/<mod>/ -> crates/oakengine/include/<mod>/
- OFX SDK headers vendored into crates/oakplugin/ofx/ (HostSupport gone)
- legacy deleted: old src/ C++ modules, engine/, core/, ffmpeg_bridge/,
  app/ (Qt), cli/worker C++, root CMakeLists, third_party/KDDockWidgets
  submodule, otio-install, all build-* output (~40GB)
- oakstorage kept but excluded from the workspace (skeleton w/ todos);
  gpui excluded (own workspace)
- verified: cargo build green, cargo test --workspace 1845/0
  (with the documented OCIO_RS_* env override for the homebrew OCIO)
This commit is contained in:
2026-08-10 20:24:25 +08:00
parent f8540e3892
commit 013a175707
4212 changed files with 8331 additions and 2274987 deletions
+47
View File
@@ -0,0 +1,47 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The backend interface. `StorageBackend` is the Rust trait shape of
//! M10 §2.3's manual C vtable; `ffi.rs` marshals foreign (C-side)
//! vtable registrations onto the same registry.
use crate::uri::StorageUri;
/// A storage backend (M10 §2.3 vtable semantics).
pub trait StorageBackend: Send + Sync {
/// Backend name ("ove-xml" / "otio" / "oakdb").
fn name(&self) -> &'static str;
/// URI scheme this backend serves ("file" / "oakdb").
fn uri_scheme(&self) -> &'static str;
/// Whether this backend claims the URI (suffix, magic bytes,
/// reachability — backend's own judgement).
fn can_handle(&self, uri: &StorageUri) -> bool;
/// Load a project; returns an owned oaknode project handle
/// (CHandle with refcount 1) or an error code/context.
fn load(&self, uri: &StorageUri) -> crate::error::Result<crate::handle::CHandle>;
/// Save a project to the URI. `options` is the M10 bitmask
/// (OAKSTORAGE_SAVE_COMPRESS etc.); unknown bits are ignored.
fn save(
&self,
project: crate::handle::CHandle,
uri: &StorageUri,
options: u32,
) -> crate::error::Result<()>;
}
@@ -0,0 +1,77 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The database backend (PostgreSQL + SQLite via SeaORM).
//!
//! URI forms:
//! - `oakdb+sqlite:///absolute/path.db` — local file database
//! - `oakdb+pg://user:pass@host:5432/dbname` — PostgreSQL
//!
//! The async SeaORM API is driven by a private current-thread tokio
//! runtime so the public surface stays synchronous (M10: no callbacks,
//! sync commands only). The graph payload is the same serialized form
//! the ove-xml backend produces — one serialization truth.
/// The database backend (schemes `oakdb+sqlite` / `oakdb+pg`).
pub struct DatabaseBackend {
// Private current-thread runtime + SeaORM connection cache.
}
impl DatabaseBackend {
/// Construct (no connection is opened until first use).
pub fn new() -> Self {
todo!()
}
/// Parse the URI into a SeaORM connection URL + project key
/// (query param `?project=` or row id; default: singleton "default"
/// project row).
pub(crate) fn parse_target(
uri: &crate::uri::StorageUri,
) -> crate::error::Result<(String, String)> {
todo!()
}
}
impl crate::backend::StorageBackend for DatabaseBackend {
fn name(&self) -> &'static str {
todo!()
}
fn uri_scheme(&self) -> &'static str {
todo!()
}
fn can_handle(&self, uri: &crate::uri::StorageUri) -> bool {
todo!()
}
fn load(
&self,
uri: &crate::uri::StorageUri,
) -> crate::error::Result<crate::handle::CHandle> {
todo!()
}
fn save(
&self,
project: crate::handle::CHandle,
uri: &crate::uri::StorageUri,
options: u32,
) -> crate::error::Result<()> {
todo!()
}
}
+29
View File
@@ -0,0 +1,29 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Built-in backends.
pub mod database;
pub mod otio;
pub mod ove_xml;
use std::sync::Arc;
/// All built-in backends in arbitration order (registered into
/// [`crate::registry::Registry::global`] at crate init).
pub fn builtins() -> Vec<Arc<dyn crate::backend::StorageBackend>> {
todo!()
}
+59
View File
@@ -0,0 +1,59 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The `.otio` backend (import/export semantics via the native
//! `oakotio` crate). OTIO is a one-way interchange format: `load`
//! imports into a fresh project; `save` exports the current timeline.
/// The otio backend (`file://` + `.otio`).
pub struct OtioBackend;
impl OtioBackend {
/// Construct.
pub fn new() -> Self {
todo!()
}
}
impl crate::backend::StorageBackend for OtioBackend {
fn name(&self) -> &'static str {
todo!()
}
fn uri_scheme(&self) -> &'static str {
todo!()
}
fn can_handle(&self, uri: &crate::uri::StorageUri) -> bool {
todo!()
}
fn load(
&self,
uri: &crate::uri::StorageUri,
) -> crate::error::Result<crate::handle::CHandle> {
todo!()
}
fn save(
&self,
project: crate::handle::CHandle,
uri: &crate::uri::StorageUri,
options: u32,
) -> crate::error::Result<()> {
todo!()
}
}
+61
View File
@@ -0,0 +1,61 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The `.ove` XML file backend. Graph (de)serialization is delegated
//! to oaknode's serializer C ABI (`bridge::node`); this backend owns
//! the file container: version header probe, optional compression
//! (OAKSTORAGE_SAVE_COMPRESS), and byte-exact round-trip behavior
//! pinned by the golden tests (M10 §4).
/// The ove-xml backend (`file://` + `.ove`).
pub struct OveXmlBackend;
impl OveXmlBackend {
/// Construct.
pub fn new() -> Self {
todo!()
}
}
impl crate::backend::StorageBackend for OveXmlBackend {
fn name(&self) -> &'static str {
todo!()
}
fn uri_scheme(&self) -> &'static str {
todo!()
}
fn can_handle(&self, uri: &crate::uri::StorageUri) -> bool {
todo!()
}
fn load(
&self,
uri: &crate::uri::StorageUri,
) -> crate::error::Result<crate::handle::CHandle> {
todo!()
}
fn save(
&self,
project: crate::handle::CHandle,
uri: &crate::uri::StorageUri,
options: u32,
) -> crate::error::Result<()> {
todo!()
}
}
+19
View File
@@ -0,0 +1,19 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! C ABI imports from other oak modules.
pub mod node;
+37
View File
@@ -0,0 +1,37 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! oaknode C ABI imports (project + serializer family; signatures
//! mirror include/node/*.h verbatim).
use std::ffi::{c_char, c_int};
use crate::handle::CHandle;
extern "C" {
/// `oaknode_project_init`.
pub fn oaknode_project_init() -> CHandle;
/// `oaknode_project_free`.
pub fn oaknode_project_free(project: *mut CHandle);
/// `oaknode_project_load_from_data` (XML text → project).
pub fn oaknode_project_load_from_data(data: *const c_char) -> CHandle;
/// `oaknode_project_save_to_data` (project → XML, two-stage string).
pub fn oaknode_project_save_to_data(
project: CHandle,
buf: *mut c_char,
buf_size: c_int,
) -> c_int;
}
+82
View File
@@ -0,0 +1,82 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Error and info codes (M10 §2.1; -MMCCCC scheme, module 10).
/// Success.
pub const OAKSTORAGE_OK: i32 = 0;
/// Project version too old (info code, positive).
pub const OAKSTORAGE_TOO_OLD: i32 = 1;
/// Project version too new (info code).
pub const OAKSTORAGE_TOO_NEW: i32 = 2;
/// Unknown project version (info code).
pub const OAKSTORAGE_UNKNOWN_VERSION: i32 = 3;
/// Null handle or invalid argument.
pub const OAKSTORAGE_E_INVALID: i32 = -100001;
/// Call not valid in the current state.
pub const OAKSTORAGE_E_STATE: i32 = -100002;
/// Entry not found.
pub const OAKSTORAGE_E_NOT_FOUND: i32 = -100003;
/// The underlying operation failed.
pub const OAKSTORAGE_E_FAILED: i32 = -100004;
/// No backend claimed the URI.
pub const OAKSTORAGE_E_NO_BACKEND: i32 = -100005;
/// Parse/format failure (XML/DB constraint).
pub const OAKSTORAGE_E_FORMAT: i32 = -100006;
/// I/O failure.
pub const OAKSTORAGE_E_IO: i32 = -100007;
/// Allocation failed.
pub const OAKSTORAGE_E_NOMEM: i32 = -100008;
/// Crate-internal result type.
pub type Result<T> = std::result::Result<T, Error>;
/// Crate-internal error.
#[derive(Debug)]
pub enum Error {
/// Null handle or invalid argument.
Invalid,
/// Wrong state.
State,
/// Not found.
NotFound,
/// Operation failed (context string is log-only).
Failed(String),
/// No backend claimed the URI.
NoBackend,
/// Format error.
Format(String),
/// I/O error.
Io(String),
/// Out of memory.
NoMem,
}
impl Error {
/// Map to the public error code.
pub fn code(&self) -> i32 {
match self {
Error::Invalid => OAKSTORAGE_E_INVALID,
Error::State => OAKSTORAGE_E_STATE,
Error::NotFound => OAKSTORAGE_E_NOT_FOUND,
Error::Failed(_) => OAKSTORAGE_E_FAILED,
Error::NoBackend => OAKSTORAGE_E_NO_BACKEND,
Error::Format(_) => OAKSTORAGE_E_FORMAT,
Error::Io(_) => OAKSTORAGE_E_IO,
Error::NoMem => OAKSTORAGE_E_NOMEM,
}
}
}
+143
View File
@@ -0,0 +1,143 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! C ABI export layer: implements M10 §2.2/§2.3 verbatim
//! (`oakstorage_probe/open/save/project_free/project_take_project/
//! project_project/project_uri/last_error/debug_alive_count` and the
//! backend vtable registration pair).
use std::ffi::{c_char, c_int, c_uint, c_void};
use crate::handle::CHandle;
/// Save options bitmask: compress the ove-xml container.
pub const OAKSTORAGE_SAVE_COMPRESS: c_uint = 0x1;
/// `oakstorage_probe`: which backend claims this URI (two-stage
/// string; negative = E_NO_BACKEND).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_probe(uri: *const c_char, buf: *mut c_char, buf_size: c_int) -> c_int {
todo!()
}
/// `oakstorage_open`: open a project session by URI (owned handle;
/// `result_code` receives an OAKSTORAGE_* code incl. the positive
/// version info codes).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_open(uri: *const c_char, result_code: *mut c_int) -> CHandle {
todo!()
}
/// `oakstorage_save`: save a project to a URI (options bitmask;
/// unknown bits ignored by backends).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_save(
project: CHandle,
uri: *const c_char,
options: c_uint,
) -> c_int {
todo!()
}
/// `oakstorage_project_free` (NULL/empty no-op).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_project_free(session: *mut CHandle) {
todo!()
}
/// `oakstorage_project_take_project`: ownership transfer out of the
/// session (the session becomes an empty shell; still free it).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_project_take_project(session: CHandle) -> CHandle {
todo!()
}
/// `oakstorage_project_project`: borrowed project handle (empty after
/// take).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_project_project(session: CHandle) -> CHandle {
todo!()
}
/// `oakstorage_project_uri` (two-stage string).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_project_uri(
session: CHandle,
buf: *mut c_char,
buf_size: c_int,
) -> c_int {
todo!()
}
/// `oakstorage_last_error` (two-stage string; per-thread last error
/// detail).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_last_error(buf: *mut c_char, buf_size: c_int) -> c_int {
todo!()
}
/// `oakstorage_debug_alive_count` (leak assertions in tests).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_debug_alive_count() -> c_int {
todo!()
}
/// C-side backend vtable (M10 §2.3; the layout is the C header's
/// struct — implementer copies it field-for-field).
#[repr(C)]
pub struct OakStorageBackendVtable {
/// Backend name (static string).
pub name: *const c_char,
/// URI scheme served (static string).
pub uri_scheme: *const c_char,
/// can_handle.
pub can_handle: Option<unsafe extern "C" fn(uri: *const c_char) -> c_int>,
/// load.
pub load: Option<
unsafe extern "C" fn(
uri: *const c_char,
result_code: *mut c_int,
err_buf: *mut c_char,
err_buf_size: c_int,
) -> CHandle,
>,
/// save.
pub save: Option<
unsafe extern "C" fn(
project: CHandle,
uri: *const c_char,
options: c_uint,
err_buf: *mut c_char,
err_buf_size: c_int,
) -> c_int,
>,
}
/// `oakstorage_backend_register`: register a foreign backend (the
/// vtable is not copied — the caller guarantees it outlives
/// unregistration).
#[no_mangle]
pub unsafe extern "C" fn oakstorage_backend_register(
backend: *const OakStorageBackendVtable,
) -> c_int {
todo!()
}
/// `oakstorage_backend_unregister`.
#[no_mangle]
pub unsafe extern "C" fn oakstorage_backend_unregister(name: *const c_char) -> c_int {
todo!()
}
+88
View File
@@ -0,0 +1,88 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Refcounted-handle scaffolding (same per-module pattern as the other
//! crates; duplicated on purpose — handle function pointers must run
//! code from the creating DLL).
use std::sync::atomic::AtomicU32;
/// ABI version stamped into every handle.
pub const OAKSTORAGE_ABI_VERSION: u32 = 1;
/// Heap box behind a handle's `ctx`.
pub struct RefBox<T: ?Sized> {
/// Atomic reference count.
pub refs: AtomicU32,
/// Boxed value.
pub value: T,
}
/// `#[repr(C)]` mirror of the public handle structs.
#[repr(C)]
pub struct CHandle {
/// Opaque box pointer.
pub ctx: *mut std::ffi::c_void,
/// Atomic increment.
pub addref: Option<unsafe extern "C" fn(*mut std::ffi::c_void)>,
/// Atomic decrement; destroys at zero.
pub release: Option<unsafe extern "C" fn(*mut std::ffi::c_void)>,
/// ABI version.
pub abi_version: u32,
}
impl CHandle {
/// The empty handle.
pub fn null() -> Self {
todo!()
}
}
/// Owned handle with count 1; empty on allocation failure.
pub fn make_owned<T: Send + 'static>(value: T) -> CHandle {
todo!()
}
/// Borrowed handle for an object owned elsewhere.
///
/// # Safety
/// Caller guarantees `ptr` outlives every derived handle.
pub unsafe fn make_borrowed<T: Send + 'static>(ptr: *mut T) -> CHandle {
todo!()
}
/// Typed view into a handle; `None` for empty handles.
///
/// # Safety
/// `T` must be the boxed type.
pub unsafe fn get<T: 'static>(h: &CHandle) -> Option<&T> {
todo!()
}
/// Panic-catching FFI wrapper for i32-returning exports.
pub fn guard<F: FnOnce() -> crate::error::Result<()>>(f: F) -> i32 {
todo!()
}
/// Panic-catching FFI wrapper for handle-returning exports.
pub fn guard_handle<F: FnOnce() -> crate::error::Result<CHandle>>(f: F) -> CHandle {
todo!()
}
/// Panic-catching FFI wrapper for void exports.
pub fn guard_void<F: FnOnce()>(f: F) {
todo!()
}
+34
View File
@@ -0,0 +1,34 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! # oakstorage — project persistence (Rust)
//!
//! Single module owning project load/save. Backends are pluggable
//! (ove-xml today, oakdb tomorrow) behind URI dispatch. Manual:
//! docs/zh/plans/riir/M10-oakstorage.md.
#![deny(unsafe_op_in_unsafe_fn)]
#![warn(missing_docs)]
pub mod backend;
pub mod backends;
pub mod bridge;
pub mod error;
pub mod ffi;
pub mod handle;
pub mod registry;
pub mod session;
pub mod uri;
+50
View File
@@ -0,0 +1,50 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The backend registry: registration, arbitration, lookup.
use std::sync::{Arc, Mutex};
use crate::backend::StorageBackend;
use crate::uri::StorageUri;
/// Process-wide backend registry (built-ins pre-registered).
pub struct Registry {
backends: Mutex<Vec<Arc<dyn StorageBackend>>>,
}
impl Registry {
/// Global registry.
pub fn global() -> &'static Registry {
todo!()
}
/// Register a backend (registration order = arbitration order
/// within a scheme). Duplicate names are rejected with E_STATE.
pub fn register(&self, backend: Arc<dyn StorageBackend>) -> crate::error::Result<()> {
todo!()
}
/// Unregister by name; unknown name is E_NOT_FOUND.
pub fn unregister(&self, name: &str) -> crate::error::Result<()> {
todo!()
}
/// First backend claiming `uri` (E_NO_BACKEND when none).
pub fn resolve(&self, uri: &StorageUri) -> crate::error::Result<Arc<dyn StorageBackend>> {
todo!()
}
}
+52
View File
@@ -0,0 +1,52 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! The project session (M10 §2.2 `OakStorageProject`): wraps a loaded
//! project plus its source URI. `take` transfers the project handle
//! out, leaving an empty shell that must still be freed.
use crate::handle::CHandle;
use crate::uri::StorageUri;
/// An open project session.
pub struct Session {
/// Source URI.
uri: StorageUri,
/// The project handle (None after [`Session::take`]).
project: Option<CHandle>,
}
impl Session {
/// Wrap a freshly loaded project.
pub fn new(uri: StorageUri, project: CHandle) -> Self {
todo!()
}
/// Source URI.
pub fn uri(&self) -> &StorageUri {
todo!()
}
/// Borrowed project handle (None after take).
pub fn project(&self) -> Option<&CHandle> {
todo!()
}
/// Transfer the project out (C++ take_project semantics).
pub fn take(&mut self) -> Option<CHandle> {
todo!()
}
}
+46
View File
@@ -0,0 +1,46 @@
// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! URI parsing and classification. The core never sees bare file
//! paths — every entry point takes a URI (M10 §2.2).
/// A parsed storage URI.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StorageUri {
/// Scheme ("file", "oakdb", …).
pub scheme: String,
/// Scheme-specific body (path for file://, connection string for
/// oakdb://).
pub body: String,
}
impl StorageUri {
/// Parse a URI string; bare paths are normalized to file:// URIs
/// (C++ callers pass plain paths — M10 §2.2 note).
pub fn parse(s: &str) -> crate::error::Result<StorageUri> {
todo!()
}
/// File extension (lowercased, without dot) for file:// URIs.
pub fn extension(&self) -> Option<String> {
todo!()
}
/// Back to string form.
pub fn to_uri_string(&self) -> String {
todo!()
}
}