pub struct UnsignedEnvelope<T> {
pub protocol: String,
pub msg_id: MessageId,
pub msg_type: MsgType,
pub from_actor_id: ActorId,
pub to_actor_id: Option<ActorId>,
pub vision_id: Option<VisionId>,
pub project_id: Option<ProjectId>,
pub task_id: Option<TaskId>,
pub lamport_ts: u64,
pub created_at: OffsetDateTime,
pub expires_at: Option<OffsetDateTime>,
pub body: T,
}Expand description
An envelope that has not yet been signed.
Fields§
§protocol: StringProtocol version string.
msg_id: MessageIdUnique message identifier.
msg_type: MsgTypeType discriminator matching the body.
from_actor_id: ActorIdActor that created this message.
to_actor_id: Option<ActorId>Intended recipient actor, if directed.
vision_id: Option<VisionId>Associated vision, if any.
project_id: Option<ProjectId>Associated project, if any.
task_id: Option<TaskId>Associated task, if any.
lamport_ts: u64Lamport logical timestamp for causal ordering.
created_at: OffsetDateTimeWall-clock creation time.
expires_at: Option<OffsetDateTime>Optional expiration time for this message.
body: TThe typed message body.
Implementations§
Source§impl<T> UnsignedEnvelope<T>where
T: RoutedBody + Serialize,
impl<T> UnsignedEnvelope<T>where
T: RoutedBody + Serialize,
Sourcepub fn new(
from_actor_id: ActorId,
to_actor_id: Option<ActorId>,
body: T,
) -> Self
pub fn new( from_actor_id: ActorId, to_actor_id: Option<ActorId>, body: T, ) -> Self
Creates a new unsigned envelope with auto-generated message ID and timestamp.
Sourcepub fn with_vision_id(self, vision_id: VisionId) -> Self
pub fn with_vision_id(self, vision_id: VisionId) -> Self
Sets the vision ID on this envelope.
Sourcepub fn with_project_id(self, project_id: ProjectId) -> Self
pub fn with_project_id(self, project_id: ProjectId) -> Self
Sets the project ID on this envelope.
Sourcepub fn with_task_id(self, task_id: TaskId) -> Self
pub fn with_task_id(self, task_id: TaskId) -> Self
Sets the task ID on this envelope.
Sourcepub fn with_lamport_ts(self, lamport_ts: u64) -> Self
pub fn with_lamport_ts(self, lamport_ts: u64) -> Self
Sets the Lamport logical timestamp on this envelope.
Sourcepub fn with_expires_at(self, expires_at: OffsetDateTime) -> Self
pub fn with_expires_at(self, expires_at: OffsetDateTime) -> Self
Sets the expiration time on this envelope.
Sourcepub fn sign(self, keypair: &StoredKeypair) -> Result<Envelope<T>, ProtocolError>
pub fn sign(self, keypair: &StoredKeypair) -> Result<Envelope<T>, ProtocolError>
Signs this envelope with the given keypair, producing a signed Envelope.
Trait Implementations§
Source§impl<T: Clone> Clone for UnsignedEnvelope<T>
impl<T: Clone> Clone for UnsignedEnvelope<T>
Source§fn clone(&self) -> UnsignedEnvelope<T>
fn clone(&self) -> UnsignedEnvelope<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more