Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ members = [
"desktop/platform/linux",
"desktop/platform/mac",
"desktop/platform/win",
"document/graph-storage",
"document/graph",
"document/container",
"document/document-format",
"document/format",
"editor",
"frontend/wrapper",
"libraries/dyn-any",
Expand Down Expand Up @@ -91,8 +91,8 @@ repeat-nodes = { path = "node-graph/nodes/repeat" }
math-nodes = { path = "node-graph/nodes/math" }
path-bool-nodes = { path = "node-graph/nodes/path-bool" }
graph-craft = { path = "node-graph/graph-craft" }
graph-storage = { path = "document/graph-storage", default-features = false }
document-format = { path = "document/document-format" }
document-graph = { path = "document/graph", default-features = false }
document-format = { path = "document/format" }
document-container = { path = "document/container" }
raster-nodes = { path = "node-graph/nodes/raster" }
graphene-std = { path = "node-graph/nodes/gstd" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "document-format"
description = "Typed handle for the .gdd document format, sitting over graph-storage and document-container"
description = "Typed handle for the .gdd document format, sitting over document-graph and document-container"
edition.workspace = true
version.workspace = true
license.workspace = true
authors.workspace = true

[features]
# Runtime bridge: the editorstorage conversion methods (stage/commit from a `NodeNetwork`,
# Runtime bridge: the editor <-> storage conversion methods (stage/commit from a `NodeNetwork`,
# `network_ids`, `declarations`). Off lets a standalone migration tool build without `graph-craft`
# or `core-types`. Forwards to `graph-storage/conversion`.
conversion = ["graph-storage/conversion", "dep:graph-craft", "dep:core-types"]
# or `core-types`. Forwards to `document-graph/conversion`.
conversion = ["document-graph/conversion", "dep:graph-craft", "dep:core-types"]
# Compressed-archive export/open. Each forwards to the matching `document-container` feature and
# gates that format's `ExportFormat` arm and sink. The folder/memory codec-free core needs neither.
zip = ["document-container/zip"]
Expand All @@ -19,7 +19,7 @@ default = ["conversion", "zip", "xz"]

[dependencies]
document-container = { workspace = true }
graph-storage = { workspace = true, default-features = false }
document-graph = { workspace = true, default-features = false }
graph-craft = { workspace = true, optional = true }
graphene-resource = { workspace = true }
core-types = { workspace = true, optional = true }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

use document_container::ContainerError;
#[cfg(feature = "conversion")]
use graph_storage::CommitError;
use graph_storage::CrdtError;
use document_graph::CommitError;
use document_graph::CrdtError;
use graphene_resource::ResourceHash;

use crate::codec::CodecError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<L: Layout> Gdd<L> {
// below, so only the gap is loaded from the byte store here.
let mut export_session = self.session.clone();
let mut hashes_from_store: Vec<ResourceHash> = Vec::new();
let mut links_to_promote: Vec<graph_storage::ResourceId> = Vec::new();
let mut links_to_promote: Vec<document_graph::ResourceId> = Vec::new();
for (id, entry) in &export_session.registry().resources {
let Some(hash) = entry.hash else { continue };
let embed = entry.has_embedded_source() || options.embed_all_resources;
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 13 additions & 13 deletions document/document-format/src/lib.rs → document/format/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Typed handle for `.gdd` documents.
//!
//! [`Gdd`] owns a [`graph_storage::Session`] plus a working-copy [`document_container::AnyContainer`].
//! [`Gdd`] owns a [`document_graph::Session`] plus a working-copy [`document_container::AnyContainer`].
//! Mutations flow through `Gdd` to keep the session and the on-disk working copy mirrored.
//! Export is a separate, explicit operation — see [`export::ExportFormat`].
//!
Expand All @@ -16,8 +16,8 @@ use std::path::Path;
use document_container::backends::folder::FolderBackend;
use document_container::{AnyContainer, AsyncContainer, ByteHolder, ContainerError};
#[cfg(feature = "conversion")]
use graph_storage::{CommitError, NodeMetadataSource};
use graph_storage::{Delta, HotOp, PeerId, Registry, Session};
use document_graph::{CommitError, NodeMetadataSource};
use document_graph::{Delta, HotOp, PeerId, Registry, Session};
#[cfg(feature = "conversion")]
use graphene_resource::LoadResource;
use graphene_resource::ResourceHash;
Expand Down Expand Up @@ -83,7 +83,7 @@ pub struct Gdd<L: Layout = GddV1Layout> {
pub(crate) view_settings: std::collections::BTreeMap<String, serde_json::Value>,
/// Per-network view settings (node-graph nav + previewing), keyed by stable [`NetworkId`]. Same per-peer
/// `session.json` treatment as [`view_settings`](Self::view_settings), but scoped per network.
pub(crate) network_view_settings: std::collections::BTreeMap<graph_storage::NetworkId, std::collections::BTreeMap<String, serde_json::Value>>,
pub(crate) network_view_settings: std::collections::BTreeMap<document_graph::NetworkId, std::collections::BTreeMap<String, serde_json::Value>>,
}

/// Native folder-backed convenience constructors. On wasm the editor builds an OPFS-backed
Expand Down Expand Up @@ -261,19 +261,19 @@ impl<L: Layout> Gdd<L> {
}

/// The per-network view settings read from `session.json` (node-graph nav + previewing), keyed by
/// [`NetworkId`](graph_storage::NetworkId). Opaque `ui::nav::*` / `ui::previewing` blobs the editor decodes.
pub fn network_view_settings(&self) -> &std::collections::BTreeMap<graph_storage::NetworkId, std::collections::BTreeMap<String, serde_json::Value>> {
/// [`NetworkId`](document_graph::NetworkId). Opaque `ui::nav::*` / `ui::previewing` blobs the editor decodes.
pub fn network_view_settings(&self) -> &std::collections::BTreeMap<document_graph::NetworkId, std::collections::BTreeMap<String, serde_json::Value>> {
&self.network_view_settings
}

/// Resolve each runtime `network_path` to its stable [`NetworkId`](graph_storage::NetworkId), so the
/// Resolve each runtime `network_path` to its stable [`NetworkId`](document_graph::NetworkId), so the
/// editor can key per-network, per-peer view state by a stable id. See [`Session::network_ids`].
#[cfg(feature = "conversion")]
pub fn network_ids<M: NodeMetadataSource>(
&self,
network: &graph_craft::document::NodeNetwork,
metadata: &M,
) -> Result<std::collections::HashMap<Vec<core_types::uuid::NodeId>, graph_storage::NetworkId>, CommitError> {
) -> Result<std::collections::HashMap<Vec<core_types::uuid::NodeId>, document_graph::NetworkId>, CommitError> {
self.session.network_ids(network, metadata)
}

Expand All @@ -292,17 +292,17 @@ impl<L: Layout> Gdd<L> {
(working, self.layout)
}

/// Resolve the proto-node declarations referenced by the registry into a [`graph_storage::Declarations`]
/// Resolve the proto-node declarations referenced by the registry into a [`document_graph::Declarations`]
/// map, loading each `ProtoNode`'s bytes from `byte_store` (the global cache in the editor, the
/// working-copy container for standalone). Only resources referenced by `Implementation::ProtoNode`
/// are visited, so image/font resources are skipped. Cold-path (open / `to_runtime`); async
/// because resource loads are.
#[cfg(feature = "conversion")]
pub async fn declarations(&self, byte_store: &dyn LoadResource) -> graph_storage::Declarations {
use graph_storage::Implementation;
pub async fn declarations(&self, byte_store: &dyn LoadResource) -> document_graph::Declarations {
use document_graph::Implementation;

let registry = self.session.registry();
let mut declarations = graph_storage::Declarations::new();
let mut declarations = document_graph::Declarations::new();

for node in registry.node_instances.values() {
let Implementation::ProtoNode(id) = node.implementation() else { continue };
Expand All @@ -317,7 +317,7 @@ impl<L: Layout> Gdd<L> {
log::error!("Declaration bytes for {id} (hash {hash}) missing from byte store");
continue;
};
match graph_storage::decode_declaration(resource.as_ref()) {
match document_graph::decode_declaration(resource.as_ref()) {
Ok(proto) => {
declarations.insert(*id, proto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

use document_container::AsyncContainer;
#[cfg(feature = "conversion")]
use graph_storage::NodeMetadataSource;
use graph_storage::{HotOp, Rev, TimeStamp};
use document_graph::NodeMetadataSource;
use document_graph::{HotOp, Rev, TimeStamp};
#[cfg(feature = "conversion")]
use graphene_resource::ResourceStorage;

Expand Down Expand Up @@ -200,7 +200,7 @@ impl<L: Layout> Gdd<L> {

/// Advance the published frontier to `rev` and persist it to `session.json`, so the silent/published
/// undo boundary survives a reopen. Called by the (future) broadcast transport as commits are shared.
pub fn publish_up_to(&mut self, rev: graph_storage::Rev) -> Result<(), Error> {
pub fn publish_up_to(&mut self, rev: document_graph::Rev) -> Result<(), Error> {
self.session.publish_up_to(rev);
self.persist_session_state()
}
Expand All @@ -209,7 +209,7 @@ impl<L: Layout> Gdd<L> {
/// enters the registry, history, or CRDT.
pub fn set_network_view_settings(
&mut self,
network_view_settings: std::collections::BTreeMap<graph_storage::NetworkId, std::collections::BTreeMap<String, serde_json::Value>>,
network_view_settings: std::collections::BTreeMap<document_graph::NetworkId, std::collections::BTreeMap<String, serde_json::Value>>,
) -> Result<(), Error> {
self.network_view_settings = network_view_settings;
self.persist_session_state()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<L: Layout> Gdd<L> {
/// `DataSource::Embedded` source resolved to the content hash) through the session so the registry
/// records the resource and the entry replicates, then writes the bytes into the working copy's
/// content-addressed store. The caller owns `id` allocation.
pub fn add_resource(&mut self, id: graph_storage::ResourceId, bytes: &[u8]) -> Result<(), Error> {
pub fn add_resource(&mut self, id: document_graph::ResourceId, bytes: &[u8]) -> Result<(), Error> {
let hash = ResourceHash::from(bytes);

self.working.write_non_blocking(&self.layout.resource_path(&hash), bytes)?;
Expand All @@ -37,7 +37,7 @@ impl<L: Layout> Gdd<L> {
/// than buffering them. Folder backends use `fs::copy` (CoW on supported filesystems); other
/// backends fall back to read-then-write. Native-only: there is no filesystem source path on wasm.
#[cfg(not(target_family = "wasm"))]
pub fn add_resource_from_path(&mut self, id: graph_storage::ResourceId, hash: ResourceHash, src: &Path) -> Result<(), Error> {
pub fn add_resource_from_path(&mut self, id: document_graph::ResourceId, hash: ResourceHash, src: &Path) -> Result<(), Error> {
let dest_path = self.layout.resource_path(&hash);
if let AnyContainer::Folder(folder) = self.working.as_ref() {
let full = folder.root().join(&dest_path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! Lives in `session.json`. Rewritten on retirement.

use graph_storage::{NetworkId, PeerId, Rev};
use document_graph::{NetworkId, PeerId, Rev};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use document_container::AnyContainer;
use document_container::backends::memory::MemoryBackend;
use document_format::{Codec, Error, GddV1, GddV1Layout, Layout, Manifest, io, manifest};
use graph_storage::{HotOp, Network, NetworkId, PeerId, ROOT_NETWORK, RegistryDelta, TimeStamp};
use document_graph::{HotOp, Network, NetworkId, PeerId, ROOT_NETWORK, RegistryDelta, TimeStamp};

fn empty_container() -> AnyContainer {
AnyContainer::Memory(MemoryBackend::new())
Expand Down Expand Up @@ -416,8 +416,8 @@ fn export_carries_resources() {
#[test]
fn embed_all_resources_materializes_link_only_resource() {
use document_format::{ExportFormat, ExportOptions};
use document_graph::NoMetadata;
use graph_craft::application_io::resource::ResourceStorage;
use graph_storage::NoMetadata;
use graphene_resource::{DataSource, ResourceHash, ResourceId, ResourceRegistry};

futures::executor::block_on(async {
Expand Down Expand Up @@ -483,8 +483,8 @@ fn embed_all_resources_materializes_link_only_resource() {
#[test]
fn export_materializes_embedded_resource_from_byte_store() {
use document_format::{ExportFormat, ExportOptions};
use document_graph::NoMetadata;
use graph_craft::application_io::resource::ResourceStorage;
use graph_storage::NoMetadata;
use graphene_resource::{DataSource, ResourceHash, ResourceId, ResourceRegistry};

futures::executor::block_on(async {
Expand Down Expand Up @@ -526,8 +526,8 @@ fn export_materializes_embedded_resource_from_byte_store() {
/// export, which previously failed at `embed_resource_sources` and fell back to the legacy blob.
#[test]
fn export_round_trips_unretired_hot_ops() {
use document_graph::NoMetadata;
use graph_craft::application_io::resource::ResourceStorage;
use graph_storage::NoMetadata;
use graphene_resource::{DataSource, ResourceId, ResourceRegistry};

futures::executor::block_on(async {
Expand Down Expand Up @@ -602,10 +602,10 @@ fn create_in_records_default_codecs_in_manifest() {
/// persistence and retirement, so the `peer_users` mapping survives a reopen.
#[test]
fn first_commit_registers_peer_and_survives_reopen() {
use document_graph::{NoMetadata, UserId};
use graph_craft::application_io::resource::HashMapResourceStorage;
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeInput, NodeNetwork};
use graph_craft::{ProtoNodeIdentifier, concrete};
use graph_storage::{NoMetadata, UserId};
use graphene_resource::ResourceRegistry;

futures::executor::block_on(async {
Expand Down Expand Up @@ -674,10 +674,10 @@ fn persist_path_writes_at_manifest_declared_codec_paths() {
/// editor-shaped path (declaration bytes live in the resource store, not the Gdd container).
#[test]
fn declarations_round_trip_through_byte_store() {
use document_graph::NoMetadata;
use graph_craft::application_io::resource::HashMapResourceStorage;
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeInput, NodeNetwork};
use graph_craft::{ProtoNodeIdentifier, concrete};
use graph_storage::NoMetadata;
use graphene_resource::ResourceRegistry;

const PROTO: &str = "graphene_core::ops::identity::IdentityNode";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "graph-storage"
name = "document-graph"
description = "Provides a delta based graph representation used in the Graphite file format"
edition.workspace = true
version.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl TryFrom<&NodeNetwork> for Registry {
pub type DeclarationBytes = HashMap<ResourceHash, Vec<u8>>;

/// A `from_runtime` conversion result: the reference-only [`Registry`] plus the proto-node
/// declaration *bytes* it extracted, keyed by content hash. `graph-storage` doesn't own a byte
/// declaration *bytes* it extracted, keyed by content hash. `document-graph` doesn't own a byte
/// store, so the caller (the `Gdd`) persists these into its content store; the registry only holds
/// the `ResourceId`/`ResourceHash` references.
pub struct RuntimeConversion {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub struct ExportSlot {

/// Content of a proto-node declaration. Stored as a content-addressed resource (serialized bytes
/// keyed by `ResourceHash`, held by the `Gdd` byte store) and referenced from
/// `Implementation::ProtoNode(ResourceId)`. `graph-storage` itself only holds the reference.
/// `Implementation::ProtoNode(ResourceId)`. `document-graph` itself only holds the reference.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProtoNode {
pub identifier: String,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Session {
/// op as its own `Delta` on the local chain. One `clock.tick()` per op (strictly causal within
/// a commit). Returns the new `Rev`s in commit order (empty if nothing changed) plus the
/// proto-node declaration bytes the conversion extracted, keyed by content hash, for the caller
/// to persist into its byte store (`graph-storage` itself is byte-unaware).
/// to persist into its byte store (`document-graph` itself is byte-unaware).
///
/// Stages the diff as hot ops rather than retired deltas: each op is applied to the registry and
/// pushed onto the hot log. The caller persists the returned hot frames and then calls `retire`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum ConversionError {

/// Resolved proto-node declarations, keyed by the `ResourceId` that `Implementation::ProtoNode`
/// references. The caller resolves these from its byte store (`ResourceId` → `ResourceHash` →
/// stored `ProtoNode` bytes) before converting, since `graph-storage` holds only references.
/// stored `ProtoNode` bytes) before converting, since `document-graph` holds only references.
pub type Declarations = std::collections::HashMap<ResourceId, ProtoNode>;

impl Registry {
Expand Down
2 changes: 1 addition & 1 deletion editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gpu = ["interpreted-executor/gpu", "dep:wgpu-executor"]
# Local dependencies
graphite-proc-macros = { workspace = true }
graph-craft = { workspace = true }
graph-storage = { workspace = true, features = ["conversion"] }
document-graph = { workspace = true, features = ["conversion"] }
document-format = { workspace = true }
document-container = { workspace = true }
graphene-hash = { workspace = true }
Expand Down
Loading
Loading