1use core::borrow::Borrow;
2use dashmap::DashMap;
3use std::cell::Cell;
4use std::ops::Deref;
5use std::sync::Arc;
6
7use serde::{Deserialize, Serialize};
8use tokio::sync::{RwLock, watch};
9
10use crate::config::mechtron::MechtronConfig;
11use crate::loc::ToSurface;
12use crate::particle::Stub;
13use crate::substance::Bin;
14use crate::wave::core::cmd::CmdMethod;
15use crate::wave::exchange::asynch::ProtoTransmitter;
16use crate::wave::exchange::asynch::ProtoTransmitterBuilder;
17use crate::wave::{DirectedProto, Pong, Wave};
18use crate::{BindConfig, SpaceErr, Substance};
19use crate::point::Point;
20
21pub mod asynch;
22pub mod synch;
23
24#[derive(Clone)]
25pub struct ArtRef<A> {
26 artifact: Arc<A>,
27 pub point: Point,
28}
29
30impl<A> ArtRef<A> {
31 pub fn new(artifact: Arc<A>, point: Point) -> Self {
32 Self { artifact, point }
33 }
34}
35
36impl<A> ArtRef<A>
37where
38 A: Clone,
39{
40 pub fn contents(&self) -> A {
41 (*self.artifact).clone()
42 }
43}
44
45impl<A> ArtRef<A> {
46 pub fn bundle(&self) -> Point {
47 self.point.clone().to_bundle().unwrap()
48 }
49 pub fn point(&self) -> &Point {
50 &self.point
51 }
52}
53
54impl<A> Deref for ArtRef<A> {
55 type Target = Arc<A>;
56
57 fn deref(&self) -> &Self::Target {
58 &self.artifact
59 }
60}
61
62impl<A> Drop for ArtRef<A> {
63 fn drop(&mut self) {
64 }
66}
67
68pub struct FetchErr {}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct Artifact {
72 pub point: Point,
73 pub bin: Bin,
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
77pub struct ArtifactRequest {
78 pub point: Point,
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
82pub struct ArtifactResponse {
83 pub to: Point,
84 pub payload: Bin,
85}