pub struct TestDag {
pub dag: NameDag,
pub seg_size: usize,
pub dir: TempDir,
pub output: Arc<Mutex<Vec<String>>>,
}Expand description
Dag structure for testing purpose.
Fields§
§dag: NameDag§seg_size: usize§dir: TempDir§output: Arc<Mutex<Vec<String>>>Implementations§
Source§impl TestDag
impl TestDag
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a TestDag for testing.
Side effect of the TestDag will be removed on drop.
Sourcepub fn draw(text: &str) -> Self
pub fn draw(text: &str) -> Self
Crates a TestDag using the given ASCII.
This is just new, followed by drawdag, with an extra rule that
comments like “# master: M” at the end can be used to specify master
heads .
Sourcepub async fn draw_client(text: &str) -> Self
pub async fn draw_client(text: &str) -> Self
Similar to draw but creates a lazy client so all vertexes
in the master group are lazy.
Sourcepub fn new_with_segment_size(seg_size: usize) -> Self
pub fn new_with_segment_size(seg_size: usize) -> Self
Creates a TestDag with a specific segment size.
Sourcepub fn drawdag(&mut self, text: &str, master_heads: &[&str])
pub fn drawdag(&mut self, text: &str, master_heads: &[&str])
Add vertexes to the graph. Does not resolve vertexes remotely.
Sourcepub async fn drawdag_async(&mut self, text: &str, master_heads: &[&str])
pub async fn drawdag_async(&mut self, text: &str, master_heads: &[&str])
Add vertexes to the graph. Async version that might resolve vertexes remotely on demand.
Sourcepub fn drawdag_with_limited_heads(
&mut self,
text: &str,
master_heads: &[&str],
heads: Option<&[&str]>,
)
pub fn drawdag_with_limited_heads( &mut self, text: &str, master_heads: &[&str], heads: Option<&[&str]>, )
Add vertexes to the graph.
If heads is set, ignore part of the graph. Only consider specified
heads.
pub async fn drawdag_with_limited_heads_async( &mut self, text: &str, master_heads: &[&str], heads: Option<&[&str]>, validate: bool, )
Sourcepub fn annotate_ascii(&self, text: &str) -> String
pub fn annotate_ascii(&self, text: &str) -> String
Replace ASCII with Ids in the graph.
Sourcepub fn render_segments(&self) -> String
pub fn render_segments(&self) -> String
Render the segments.
Sourcepub fn render_graph(&self) -> String
pub fn render_graph(&self) -> String
Render the graph.
Sourcepub async fn client(&self) -> TestDag
pub async fn client(&self) -> TestDag
Use this DAG as the “server”, return the “client” Dag that has lazy Vertexes.
Sourcepub fn set_remote(&mut self, server_dag: &Self)
pub fn set_remote(&mut self, server_dag: &Self)
Update remote protocol to use the (updated) server graph.
Sourcepub fn with_remote(self, server_dag: &Self) -> Self
pub fn with_remote(self, server_dag: &Self) -> Self
Alternative syntax of set_remote.
Sourcepub async fn client_cloned_data(&self) -> TestDag
pub async fn client_cloned_data(&self) -> TestDag
Similar to client, but also clone the Dag from the server.
Sourcepub async fn pull_ff_master(
&mut self,
server: &Self,
old_master: impl Into<Vertex>,
new_master: impl Into<Vertex>,
) -> Result<()>
pub async fn pull_ff_master( &mut self, server: &Self, old_master: impl Into<Vertex>, new_master: impl Into<Vertex>, ) -> Result<()>
Pull from the server Dag using the master fast forward fast path.
Sourcepub fn remote_protocol(
&self,
output: Arc<Mutex<Vec<String>>>,
) -> Arc<dyn RemoteIdConvertProtocol>
pub fn remote_protocol( &self, output: Arc<Mutex<Vec<String>>>, ) -> Arc<dyn RemoteIdConvertProtocol>
Remote protocol used to resolve Id <-> Vertex remotely using the test dag as the “server”.
Logs of the remote access will be written to output.
Sourcepub fn debug_segments(&self, level: Level, group: Group) -> String
pub fn debug_segments(&self, level: Level, group: Group) -> String
Describe segments at the given level and group as a string.
Sourcepub fn contains_vertex_locally(&self, name: impl Into<Vertex>) -> bool
pub fn contains_vertex_locally(&self, name: impl Into<Vertex>) -> bool
Check that a vertex exists locally.
Auto Trait Implementations§
impl !Freeze for TestDag
impl !RefUnwindSafe for TestDag
impl Send for TestDag
impl Sync for TestDag
impl Unpin for TestDag
impl !UnwindSafe for TestDag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more