Skip to content
Merged
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
15 changes: 0 additions & 15 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ members = [
"crates/query_editor",
"crates/review",
"crates/history",
"crates/inspectors",
"crates/agent_panel",
"crates/studio_update",
"crates/oauth_client",
Expand Down Expand Up @@ -65,7 +64,6 @@ graph_canvas = { path = "crates/graph_canvas" }
query_editor = { path = "crates/query_editor" }
review = { path = "crates/review" }
history = { path = "crates/history" }
inspectors = { path = "crates/inspectors" }
agent_panel = { path = "crates/agent_panel" }

# Zed, one release tag for every crate (docs/zed-pin.md). GPL-3.0-or-later and Apache-2.0.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ seconds, to run day to day); `script/bundle-linux` builds a tarball with a `.des
the graph through Studio; the agent writes only to a branch Studio creates for it, and never
receives the token.
- **Shell.** Command palette (⌘K), go to type or node (⌘P), split panes, several windows
restored on launch, the schema's `.pg` source, a storage inspector, and `omnigraph-studio://`
restored on launch, the schema's `.pg` source, and `omnigraph-studio://`
links that open a graph, node or query without running anything. `?` lists every binding.
- **Settings and shortcuts.** A settings tab (⌘,) generated from the settings schema, with
per-graph values. `settings.json` and `keymap.json` (Zed's keymap format, over Studio's
Expand Down Expand Up @@ -165,7 +165,7 @@ depend on each other.
| Layer | Crates |
|---|---|
| 6 | `studio`: the binary, menus, windows, deep links |
| 5 | `type_table`, `relationship_tree`, `graph_canvas`, `query_editor`, `review`, `history`, `inspectors`, `agent_panel`, `command_palette` |
| 5 | `type_table`, `relationship_tree`, `graph_canvas`, `query_editor`, `review`, `history`, `agent_panel`, `command_palette` |
| 4 | `studio_workspace`: panes, tabs, docks, modals, toasts |
| 3 | `graph_store`: connections, graph sessions, snapshot pins, exploration |
| 2 | `graph_client` (HTTP, no GPUI), `gq_language` (compiler wrapper, no GPUI), `studio_ui` |
Expand Down
4 changes: 2 additions & 2 deletions crates/graph_store/src/graph_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ pub mod cli {
}
pub use session::{
BranchStart, DraftEntry, DraftKey, ExternalWrite, FollowUp, GraphSession, HeadWatch, HeldAs,
Loadable, MergeEntry, MergeSent, MergeSettled, OutcomeEntry, OutcomeKind, ServerState,
SessionEvent, nothing_sent, open_session, open_session_behind,
Loadable, MergeEntry, MergeSent, MergeSettled, OutcomeEntry, OutcomeKind, SessionEvent,
nothing_sent, open_session, open_session_behind,
};

/// The user agent of Studio's requests.
Expand Down
74 changes: 8 additions & 66 deletions crates/graph_store/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use gq_language::{BuiltQuery, RelationshipGroup, SchemaModel, builder};
use graph_client::api::{
AccessAction, BranchCreateOutput, BranchCreateRequest, BranchDeleteOutput, BranchMergeOutput,
BranchMergeRequest, ChangeFeedOutput, ChangeOutput, ChangeRequest, CommitKind, CommitOutput,
DiffOutput, EntityKind, GraphListResponse, InvokeStoredQueryRequest, MergeBaseOutput,
QueryCatalogEntry, QueryRequest, ReadOutput, ReadTargetOutput, ReadinessOutput, SnapshotOutput,
DiffOutput, EntityKind, InvokeStoredQueryRequest, MergeBaseOutput, QueryCatalogEntry,
QueryRequest, ReadOutput, ReadTargetOutput, SnapshotOutput,
};
use graph_client::{
ApiErrorSummary, BlobAt, BlobCell, BlobMeta, CommitChanges, FeedAt, GraphClient, ReadError,
ServerHealth, Unauthorized, WriteOutcome,
Unauthorized, WriteOutcome,
};
use serde_json::Value;

Expand Down Expand Up @@ -330,15 +330,6 @@ impl BranchStart {
}
}

/// The server as the storage inspector shows it ([`GraphSession::server_state`]): each read's
/// own answer, so one failing leaves the others.
pub struct ServerState {
pub health: Result<ServerHealth, ReadError>,
pub readiness: Result<ReadinessOutput, ReadError>,
pub graphs: Result<GraphListResponse, ReadError>,
pub snapshot: Result<SnapshotOutput, ReadError>,
}

/// A read at a commit: the commit, the query text and its parameters, and the schema epoch it
/// was read under ([`GraphSession::schema_epoch`]).
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -2603,14 +2594,6 @@ impl GraphSession {
self.counts_stale.as_deref()
}

/// The storage snapshot the counts were read from, when it is `branch`'s.
pub fn snapshot_of(&self, branch: &str) -> Option<Arc<SnapshotOutput>> {
self.snapshot
.loaded()
.filter(|snapshot| snapshot.graph_branch == branch)
.cloned()
}

/// Reads `branch`'s head now, and resolves once the session holds what it answered, or no
/// read could be sent: a Refresh reads at the newest head, which the next poll would only
/// find later, and a view pinned at it still compares the heads after it.
Expand Down Expand Up @@ -3554,41 +3537,6 @@ impl GraphSession {
)
}

/// The server's health and readiness, the graphs it serves, and `branch`'s snapshot: what
/// the storage inspector shows, read together.
pub fn server_state(&mut self, branch: &str, cx: &mut Context<Self>) -> Task<ServerState> {
let client = self.client(cx);
// Each is a read of its own, counted and noted as one.
let health = {
let client = client.clone();
self.counted_read(async move { client.health().await }, cx)
};
let readiness = {
let client = client.clone();
self.counted_read(async move { client.readiness().await }, cx)
};
let graphs = self.counted_read(async move { client.graphs().await }, cx);
let snapshot = self.branch_snapshot(branch, cx);
cx.background_spawn(async move {
ServerState {
health: health.await,
readiness: readiness.await,
graphs: graphs.await,
snapshot: snapshot.await,
}
})
}

/// `branch`'s storage snapshot: its tables, versions and row counts.
pub fn branch_snapshot(
&mut self,
branch: &str,
cx: &mut Context<Self>,
) -> Task<Result<SnapshotOutput, ReadError>> {
let (client, graph, branch) = (self.client(cx), self.graph_id.clone(), branch.to_owned());
self.counted_read(async move { client.snapshot(&graph, &branch).await }, cx)
}

/// How many neighbours `id` has through `group`, at `snapshot` (the branch head when
/// `None`), with the commit the count holds at: the one asked for, or the one the read
/// answered at, for a count asked for at the head. A view pinned by its first answer
Expand Down Expand Up @@ -6851,7 +6799,7 @@ mod tests {
assert_eq!((reads_of("main"), reads_of("feature")), (3, 4));
}

/// The reads the history, the commit view, the review and the storage inspector ask for
/// The reads the history, the commit view and the review ask for
/// go through the session, so they count as running while they run and stop counting
/// when dropped.
#[gpui::test]
Expand All @@ -6862,12 +6810,7 @@ mod tests {
let path = request.uri().path().to_owned();
let held = seen.clone();
async move {
let feature = path.ends_with("/changes")
|| path.ends_with("/healthz")
|| path.ends_with("/readyz")
|| path.ends_with("/snapshot")
|| path == "/graphs";
if feature {
if path.ends_with("/changes") {
// A read that never answers, held until dropped.
held.fetch_add(1, Ordering::SeqCst);
futures::future::pending::<()>().await;
Expand Down Expand Up @@ -6897,17 +6840,16 @@ mod tests {
(
session.commit_changes("c1", None, 10, cx),
session.changes("main", Some("beginning".into()), None, 10, cx),
session.server_state("main", cx),
)
});
cx.run_until_parked();
assert_eq!(
held.load(Ordering::SeqCst) - held_before,
6,
"two change reads and four server reads"
2,
"two change reads"
);
session.read_with(cx, |session, _| {
assert_eq!(session.reads_in_flight, before + 6)
assert_eq!(session.reads_in_flight, before + 2)
});
drop(reads);
cx.run_until_parked();
Expand Down
26 changes: 0 additions & 26 deletions crates/inspectors/Cargo.toml

This file was deleted.

41 changes: 0 additions & 41 deletions crates/inspectors/src/inspectors.rs

This file was deleted.

Loading
Loading