#![allow(clippy::too_many_arguments)]
use crate::*;
use holochain_zome_types::signature::Signature;
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct GetMetaOptions {}
impl From<&actor::GetMetaOptions> for GetMetaOptions {
fn from(_a: &actor::GetMetaOptions) -> Self {
Self {}
}
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct GetLinksOptions {}
impl From<&actor::GetLinksOptions> for GetLinksOptions {
fn from(_a: &actor::GetLinksOptions) -> Self {
Self {}
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GetActivityOptions {
pub include_valid_activity: bool,
pub include_rejected_activity: bool,
pub include_warrants: bool,
pub include_full_records: bool,
}
impl Default for GetActivityOptions {
fn default() -> Self {
Self {
include_valid_activity: true,
include_warrants: true,
include_rejected_activity: false,
include_full_records: false,
}
}
}
impl From<&actor::GetActivityOptions> for GetActivityOptions {
fn from(a: &actor::GetActivityOptions) -> Self {
Self {
include_valid_activity: a.include_valid_activity,
include_warrants: a.include_warrants,
include_rejected_activity: a.include_rejected_activity,
include_full_records: a.include_full_records,
}
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum CountersigningSessionNegotiationMessage {
AuthorityResponse(Vec<SignedAction>),
EnzymePush(Box<ChainOp>),
}
#[cfg_attr(feature = "test_utils", automock)]
pub trait HcP2pHandler: 'static + Send + Sync + std::fmt::Debug {
fn handle_call_remote(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
zome_call_params_serialized: ExternIO,
signature: Signature,
) -> BoxFut<'_, HolochainP2pResult<SerializedBytes>>;
fn handle_publish(
&self,
dna_hash: DnaHash,
ops: Vec<holochain_types::dht_op::DhtOp>,
) -> BoxFut<'_, HolochainP2pResult<()>>;
fn handle_get(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
dht_hash: holo_hash::AnyDhtHash,
) -> BoxFut<'_, HolochainP2pResult<WireOps>>;
fn handle_get_meta(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
dht_hash: holo_hash::AnyDhtHash,
options: GetMetaOptions,
) -> BoxFut<'_, HolochainP2pResult<MetadataSet>>;
fn handle_get_links(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
link_key: WireLinkKey,
options: GetLinksOptions,
) -> BoxFut<'_, HolochainP2pResult<WireLinkOps>>;
fn handle_count_links(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
query: WireLinkQuery,
) -> BoxFut<'_, HolochainP2pResult<CountLinksResponse>>;
fn handle_get_agent_activity(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
agent: AgentPubKey,
query: ChainQueryFilter,
options: GetActivityOptions,
) -> BoxFut<'_, HolochainP2pResult<AgentActivityResponse>>;
fn handle_must_get_agent_activity(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
author: AgentPubKey,
filter: holochain_zome_types::chain::ChainFilter,
) -> BoxFut<'_, HolochainP2pResult<MustGetAgentActivityResponse>>;
fn handle_validation_receipts_received(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
receipts: ValidationReceiptBundle,
) -> BoxFut<'_, HolochainP2pResult<()>>;
fn handle_publish_countersign(
&self,
dna_hash: DnaHash,
op: holochain_types::dht_op::ChainOp,
) -> BoxFut<'_, HolochainP2pResult<()>>;
fn handle_countersigning_session_negotiation(
&self,
dna_hash: DnaHash,
to_agent: AgentPubKey,
message: CountersigningSessionNegotiationMessage,
) -> BoxFut<'_, HolochainP2pResult<()>>;
}
pub type DynHcP2pHandler = Arc<dyn HcP2pHandler>;